Avoid potential negative array index access to cached text.
[LibreOffice.git] / solenv / gbuild / PackageSet.mk
blobe85c3eceaf5dc0e3230cb92e8cedb6f504db4dee
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 # class PackageSet
12 # Allows to bundle a set of packages under one name.
14 # This is intended to be used by gbuild classes that want to provide a
15 # filelist for installer, but for implementation reasons have to use
16 # several Packages internally (e.g., because of different source dirs).
18 $(dir $(call gb_PackageSet_get_target,%)).dir :
19 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
21 $(dir $(call gb_PackageSet_get_target,%))%/.dir :
22 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
24 $(call gb_PackageSet_get_target,%) :
25 $(call gb_Output_announce,$*,$(true),PKS,2)
26 $(call gb_Trace_StartRange,$*,PKS)
27 cat $(sort $(FILELISTS)) > $@
28 $(call gb_Trace_EndRange,$*,PKS)
30 .PHONY : $(call gb_PackageSet_get_clean_target,%)
31 $(call gb_PackageSet_get_clean_target,%) :
32 $(call gb_Output_announce,$*,$(false),PKS,2)
33 rm -f $(call gb_PackageSet_get_target,$*)
35 # Create and register a package set.
37 # gb_PackageSet_PackageSet set
38 define gb_PackageSet_PackageSet
39 $(call gb_PackageSet_PackageSet_internal,$(1))
41 $$(eval $$(call gb_Module_register_target,$(call gb_PackageSet_get_target,$(1)),$(call gb_PackageSet_get_clean_target,$(1))))
42 $(call gb_Helper_make_userfriendly_targets,$(1),PackageSet)
44 endef
46 # Create a package set.
48 # gb_PackageSet_PackageSet_internal set
49 define gb_PackageSet_PackageSet_internal
50 $(call gb_PackageSet_get_target,$(1)) : FILELISTS :=
52 $(call gb_PackageSet_get_target,$(1)) :| $(dir $(call gb_PackageSet_get_target,$(1))).dir
54 endef
56 # Add a package to the set.
58 # A package can be added more than once.
60 # gb_PackageSet_add_package set package
61 define gb_PackageSet_add_package
62 $(call gb_PackageSet_get_target,$(1)) : FILELISTS += $(call gb_Package_get_target,$(2))
64 $(call gb_PackageSet_get_target,$(1)) : $(call gb_Package_get_target,$(2))
65 $(call gb_PackageSet_get_clean_target,$(1)) : $(call gb_Package_get_clean_target,$(2))
67 endef
69 # Add several packages to the set at once.
71 # gb_PackageSet_add_packages set package(s)
72 define gb_PackageSet_add_packages
73 $(foreach package,$(2),$(call gb_PackageSet_add_package,$(1),$(package)))
75 endef
77 # vim: set noet sw=4 ts=4: