Bump for 3.6-28
[LibreOffice.git] / solenv / gbuild / InstallScript.mk
blob35ea142ca147d9f7b26a02093a47385877470f39
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
2 # Version: MPL 1.1 / GPLv3+ / LGPLv3+
4 # The contents of this file are subject to the Mozilla Public License Version
5 # 1.1 (the "License"); you may not use this file except in compliance with
6 # the License or as specified alternatively below. You may obtain a copy of
7 # the License at http://www.mozilla.org/MPL/
9 # Software distributed under the License is distributed on an "AS IS" basis,
10 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 # for the specific language governing rights and limitations under the
12 # License.
14 # Major Contributor(s):
15 # Copyright (C) 2012 Red Hat, Inc., David Tardon <dtardon@redhat.com>
16 # (initial developer)
18 # All Rights Reserved.
20 # For minor contributions see the git repository.
22 # Alternatively, the contents of this file may be used under the terms of
23 # either the GNU General Public License Version 3 or later (the "GPLv3+"), or
24 # the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
25 # in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
26 # instead of those above.
28 # InstallScriptTarget class
30 gb_InstallScriptTarget_TARGET := $(SOLARENV)/bin/par2script.pl
31 gb_InstallScriptTarget_COMMAND := $(PERL) $(gb_InstallScriptTarget_TARGET)
33 gb_InstallScriptTarget__make_arglist = $(subst $(WHITESPACE),$(COMMA),$(strip $(1)))
35 define gb_InstallScriptTarget__get_files
36 $(notdir $(shell cat $(foreach module,$(1),$(call gb_InstallModule_get_filelist,$(module)))))
37 endef
39 # Pass first arg if make is running in silent mode, second arg otherwise
40 define gb_InstallScriptTarget__if_silent
41 $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),$(1),$(2))
42 endef
44 define gb_InstallScriptTarget__command
45 $(call gb_Output_announce,$(2),$(true),INS,4)
46 $(call gb_Helper_abbreviate_dirs,\
47 RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),100,\
48 $(call gb_InstallScriptTarget__make_arglist,\
49 $(call gb_InstallScriptTarget__get_files,$(SCP_MODULES))) \
50 ) && \
51 $(gb_InstallScriptTarget_COMMAND) \
52 $(call gb_InstallScriptTarget__if_silent,-q) \
53 -i $(OUTDIR)/par/osl \
54 -o $(1) \
55 @@$${RESPONSEFILE} && \
56 rm -f $${RESPONSEFILE} \
58 endef
60 $(dir $(call gb_InstallScriptTarget_get_target,%))%/.dir :
61 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
63 $(dir $(call gb_InstallScriptTarget_get_target,%)).dir :
64 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
66 $(call gb_InstallScriptTarget_get_target,%) :
67 $(call gb_InstallScriptTarget__command,$@,$*)
69 .PHONY : $(call gb_InstallScriptTarget_get_clean_target,%)
70 $(call gb_InstallScriptTarget_get_clean_target,%) :
71 $(call gb_Output_announce,$*,$(false),INS,4)
72 rm -f $(call gb_InstallScriptTarget_get_target,$*)
74 # gb_InstallScriptTarget_InstallScriptTarget(<target>)
75 define gb_InstallScriptTarget_InstallScriptTarget
76 $(call gb_InstallScriptTarget_get_target,$(1)) :| $(dir $(call gb_InstallScriptTarget_get_target,$(1))).dir
77 $(call gb_InstallScriptTarget_get_target,$(1)) : SCP_MODULES :=
79 endef
81 define gb_InstallScriptTarget_use_module
82 $(call gb_InstallScriptTarget_get_target,$(1)) : $(call gb_InstallModule_get_target,$(2))
83 $(call gb_InstallScriptTarget_get_clean_target,$(1)) : $(call gb_InstallModule_get_clean_target,$(2))
84 $(call gb_InstallScriptTarget_get_target,$(1)) : SCP_MODULES += $(2)
86 endef
88 define gb_InstallScriptTarget_use_modules
89 $(foreach module,$(2),$(call gb_InstallScriptTarget_use_module,$(1),$(module)))
91 endef
93 # InstallScript class
95 # gb_InstallScript_InstallScript(<target>)
96 define gb_InstallScript_InstallScript
97 $(call gb_InstallScriptTarget_InstallScriptTarget,$(1))
99 $(call gb_InstallScript_get_target,$(1)) : $(call gb_InstallScriptTarget_get_target,$(1))
100 $(call gb_InstallScript_get_clean_target,$(1)) : $(call gb_InstallScriptTarget_get_clean_target,$(1))
102 $(call gb_Deliver_add_deliverable,$(call gb_InstallScript_get_target,$(1)),$(call gb_InstallScriptTarget_get_target,$(1)),$(1))
104 $$(eval $$(call gb_Module_register_target,$(call gb_InstallScript_get_target,$(1)),$(call gb_InstallScript_get_clean_target,$(1))))
106 endef
108 define gb_InstallScript_use_module
109 $(call gb_InstallScriptTarget_use_module,$(1),$(2))
111 endef
113 define gb_InstallScript_use_modules
114 $(call gb_InstallScriptTarget_use_modules,$(1),$(2))
116 endef
118 # vim: set shiftwidth=4 tabstop=4 noexpandtab: