bump product version to 4.1.6.2
[LibreOffice.git] / solenv / gbuild / InstallScript.mk
blob36aeb1e82657f2a8dab026746c4613b54d343ef3
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 # InstallScriptTarget class
12 gb_InstallScriptTarget_TARGET := $(SOLARENV)/bin/par2script.pl
13 gb_InstallScriptTarget_COMMAND := $(PERL) $(gb_InstallScriptTarget_TARGET)
15 gb_InstallScriptTarget__make_arglist = $(subst $(WHITESPACE),$(COMMA),$(strip $(1)))
17 define gb_InstallScriptTarget__get_files
18 $(notdir $(shell cat $(foreach module,$(1),$(call gb_InstallModule_get_filelist,$(module)))))
19 endef
21 define gb_InstallScriptTarget__get_dirs
22 $(sort $(dir $(shell cat $(foreach module,$(1),$(call gb_InstallModule_get_filelist,$(module))))))
23 endef
25 # Pass first arg if make is running in silent mode, second arg otherwise
26 define gb_InstallScriptTarget__if_silent
27 $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),$(1),$(2))
28 endef
30 define gb_InstallScriptTarget__command
31 $(call gb_Output_announce,$(2),$(true),INS,4)
32 $(call gb_Helper_abbreviate_dirs,\
33 RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),100,\
34 $(call gb_InstallScriptTarget__make_arglist,\
35 $(call gb_InstallScriptTarget__get_files,$(SCP_MODULES))) \
36 ) && \
37 $(gb_InstallScriptTarget_COMMAND) \
38 $(call gb_InstallScriptTarget__if_silent,-q) \
39 -i $(call gb_InstallScriptTarget__make_arglist,$(call gb_InstallScriptTarget__get_dirs,$(SCP_MODULES))) \
40 -o $(1) \
41 @@$${RESPONSEFILE} && \
42 rm -f $${RESPONSEFILE} \
44 endef
46 $(dir $(call gb_InstallScriptTarget_get_target,%))%/.dir :
47 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
49 $(dir $(call gb_InstallScriptTarget_get_target,%)).dir :
50 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
52 $(call gb_InstallScriptTarget_get_target,%) : $(gb_InstallScriptTarget_TARGET)
53 $(call gb_InstallScriptTarget__command,$@,$*)
55 .PHONY : $(call gb_InstallScriptTarget_get_clean_target,%)
56 $(call gb_InstallScriptTarget_get_clean_target,%) :
57 $(call gb_Output_announce,$*,$(false),INS,4)
58 rm -f $(call gb_InstallScriptTarget_get_target,$*)
60 # gb_InstallScriptTarget_InstallScriptTarget(<target>)
61 define gb_InstallScriptTarget_InstallScriptTarget
62 $(call gb_InstallScriptTarget_get_target,$(1)) :| $(dir $(call gb_InstallScriptTarget_get_target,$(1))).dir
63 $(call gb_InstallScriptTarget_get_target,$(1)) : SCP_MODULES :=
65 endef
67 define gb_InstallScriptTarget_use_module
68 $(call gb_InstallScriptTarget_get_target,$(1)) : $(call gb_InstallModule_get_target,$(2))
69 $(call gb_InstallScriptTarget_get_clean_target,$(1)) : $(call gb_InstallModule_get_clean_target,$(2))
70 $(call gb_InstallScriptTarget_get_target,$(1)) : SCP_MODULES += $(2)
72 endef
74 define gb_InstallScriptTarget_use_modules
75 $(foreach module,$(2),$(call gb_InstallScriptTarget_use_module,$(1),$(module)))
77 endef
79 # InstallScript class
81 # gb_InstallScript_InstallScript(<target>)
82 define gb_InstallScript_InstallScript
83 $(call gb_InstallScriptTarget_InstallScriptTarget,$(1))
85 $(call gb_InstallScript_get_target,$(1)) : $(call gb_InstallScriptTarget_get_target,$(1))
86 $(call gb_InstallScript_get_target,$(1)) :| $(dir $(call gb_InstallScript_get_target,$(1))).dir
87 $(call gb_InstallScript_get_clean_target,$(1)) : $(call gb_InstallScriptTarget_get_clean_target,$(1))
89 $(call gb_Deliver_add_deliverable,$(call gb_InstallScript_get_target,$(1)),$(call gb_InstallScriptTarget_get_target,$(1)),$(1))
91 $$(eval $$(call gb_Module_register_target,$(call gb_InstallScript_get_target,$(1)),$(call gb_InstallScript_get_clean_target,$(1))))
92 $(call gb_Helper_make_userfriendly_targets,$(1),InstallScript)
94 endef
96 define gb_InstallScript_use_module
97 $(call gb_InstallScriptTarget_use_module,$(1),$(2))
99 endef
101 define gb_InstallScript_use_modules
102 $(call gb_InstallScriptTarget_use_modules,$(1),$(2))
104 endef
106 # vim: set shiftwidth=4 tabstop=4 noexpandtab: