bump product version to 6.3.0.0.beta1
[LibreOffice.git] / solenv / gbuild / InstallScript.mk
blob593bd3e0861b9ddffe862b92db687d45137e5694
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_Output_announce,$(2),$(true),INS,4)
32 $(call gb_Helper_abbreviate_dirs,\
33 RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),100,\
34 $(call gb_InstallScript__make_arglist,\
35 $(call gb_InstallScript__get_files,$(SCP_MODULES))) \
36 ) && \
37 $(gb_InstallScript_COMMAND) \
38 $(call gb_InstallScript__if_silent,-q) \
39 -i $(call gb_InstallScript__make_arglist,$(call gb_InstallScript__get_dirs,$(SCP_MODULES))) \
40 -o $(1) \
41 @@$${RESPONSEFILE} && \
42 rm -f $${RESPONSEFILE} \
44 endef
46 $(dir $(call gb_InstallScript_get_target,%))%/.dir :
47 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
49 $(dir $(call gb_InstallScript_get_target,%)).dir :
50 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
52 $(call gb_InstallScript_get_target,%) : $(gb_InstallScript_TARGET)
53 $(call gb_InstallScript__command,$@,$*)
55 .PHONY : $(call gb_InstallScript_get_clean_target,%)
56 $(call gb_InstallScript_get_clean_target,%) :
57 $(call gb_Output_announce,$*,$(false),INS,4)
58 rm -f $(call gb_InstallScript_get_target,$*)
60 # gb_InstallScript_InstallScript(<target>)
61 define gb_InstallScript_InstallScript
62 $(call gb_InstallScript_get_target,$(1)) :| $(dir $(call gb_InstallScript_get_target,$(1))).dir
63 $(call gb_InstallScript_get_target,$(1)) : SCP_MODULES :=
65 $$(eval $$(call gb_Module_register_target,$(call gb_InstallScript_get_target,$(1)),$(call gb_InstallScript_get_clean_target,$(1))))
66 $(call gb_Helper_make_userfriendly_targets,$(1),InstallScript)
68 endef
70 define gb_InstallScript_use_module
71 $(call gb_InstallScript_get_target,$(1)) : $(call gb_InstallModule_get_target,$(2))
72 $(call gb_InstallScript_get_clean_target,$(1)) : $(call gb_InstallModule_get_clean_target,$(2))
73 $(call gb_InstallScript_get_target,$(1)) : SCP_MODULES += $(2)
75 endef
77 define gb_InstallScript_use_modules
78 $(foreach module,$(2),$(call gb_InstallScript_use_module,$(1),$(module)))
80 endef
82 # vim: set shiftwidth=4 tabstop=4 noexpandtab: