Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / solenv / gbuild / InstallScript.mk
bloba6c7121ae7406d2ff5346cf4f295a3e7bd3271b3
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 # InstallScript class
12 gb_InstallScript_TARGET := $(SRCDIR)/solenv/bin/par2script.pl
13 gb_InstallScript_COMMAND := $(PERL) $(gb_InstallScript_TARGET)
15 gb_InstallScript__make_arglist = $(subst $(WHITESPACE),$(COMMA),$(strip $(1)))
17 define gb_InstallScript__get_files
18 $(notdir $(shell cat $(foreach module,$(1),$(call gb_InstallModule_get_filelist,$(module)))))
19 endef
21 define gb_InstallScript__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_InstallScript__if_silent
27 $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),$(1),$(2))
28 endef
30 define gb_InstallScript__command
31 $(call gb_Helper_abbreviate_dirs,\
32 RESPONSEFILE=$(call gb_var2file,$(shell $(gb_MKTEMP)),\
33 $(call gb_InstallScript__make_arglist,\
34 $(call gb_InstallScript__get_files,$(SCP_MODULES))) \
35 ) && \
36 $(gb_InstallScript_COMMAND) \
37 $(call gb_InstallScript__if_silent,-q) \
38 -i $(call gb_InstallScript__make_arglist,$(call gb_InstallScript__get_dirs,$(SCP_MODULES))) \
39 -o $(1) \
40 @@$${RESPONSEFILE} && \
41 rm -f $${RESPONSEFILE} \
43 endef
45 $(dir $(call gb_InstallScript_get_target,%))%/.dir :
46 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
48 $(dir $(call gb_InstallScript_get_target,%)).dir :
49 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
51 $(call gb_InstallScript_get_target,%) : $(gb_InstallScript_TARGET)
52 $(call gb_Output_announce,$*,$(true),INS,4)
53 $(call gb_Trace_StartRange,$*,INS)
54 $(call gb_InstallScript__command,$@,$*)
55 $(call gb_Trace_EndRange,$*,INS)
57 .PHONY : $(call gb_InstallScript_get_clean_target,%)
58 $(call gb_InstallScript_get_clean_target,%) :
59 $(call gb_Output_announce,$*,$(false),INS,4)
60 rm -f $(call gb_InstallScript_get_target,$*)
62 # gb_InstallScript_InstallScript(<target>)
63 define gb_InstallScript_InstallScript
64 $(call gb_InstallScript_get_target,$(1)) :| $(dir $(call gb_InstallScript_get_target,$(1))).dir
65 $(call gb_InstallScript_get_target,$(1)) : SCP_MODULES :=
67 $$(eval $$(call gb_Module_register_target,$(call gb_InstallScript_get_target,$(1)),$(call gb_InstallScript_get_clean_target,$(1))))
68 $(call gb_Helper_make_userfriendly_targets,$(1),InstallScript)
70 endef
72 define gb_InstallScript_use_module
73 $(call gb_InstallScript_get_target,$(1)) : $(call gb_InstallModule_get_target,$(2))
74 $(call gb_InstallScript_get_clean_target,$(1)) : $(call gb_InstallModule_get_clean_target,$(2))
75 $(call gb_InstallScript_get_target,$(1)) : SCP_MODULES += $(2)
77 endef
79 define gb_InstallScript_use_modules
80 $(foreach module,$(2),$(call gb_InstallScript_use_module,$(1),$(module)))
82 endef
84 # vim: set shiftwidth=4 tabstop=4 noexpandtab: