xref: /aoo42x/main/solenv/gbuild/Package.mk (revision 3e9d7d56)
17871dc3eSAndrew Rist#**************************************************************
27871dc3eSAndrew Rist#
37871dc3eSAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
47871dc3eSAndrew Rist#  or more contributor license agreements.  See the NOTICE file
57871dc3eSAndrew Rist#  distributed with this work for additional information
67871dc3eSAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
77871dc3eSAndrew Rist#  to you under the Apache License, Version 2.0 (the
87871dc3eSAndrew Rist#  "License"); you may not use this file except in compliance
97871dc3eSAndrew Rist#  with the License.  You may obtain a copy of the License at
107871dc3eSAndrew Rist#
117871dc3eSAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
127871dc3eSAndrew Rist#
137871dc3eSAndrew Rist#  Unless required by applicable law or agreed to in writing,
147871dc3eSAndrew Rist#  software distributed under the License is distributed on an
157871dc3eSAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
167871dc3eSAndrew Rist#  KIND, either express or implied.  See the License for the
177871dc3eSAndrew Rist#  specific language governing permissions and limitations
187871dc3eSAndrew Rist#  under the License.
197871dc3eSAndrew Rist#
207871dc3eSAndrew Rist#**************************************************************
217871dc3eSAndrew Rist
227871dc3eSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir
25cdf0e10cSrcweir# PackagePart class
26cdf0e10cSrcweir
27cdf0e10cSrcweir$(foreach destination,$(call gb_PackagePart_get_destinations), $(destination)/%) :
28cdf0e10cSrcweir	$(call gb_Deliver_deliver,$<,$@)
29cdf0e10cSrcweir
30cdf0e10cSrcweirdefine gb_PackagePart_PackagePart
31cdf0e10cSrcweir$(OUTDIR)/$(1) : $(2)
32cdf0e10cSrcweir$(2) :| $(3)
33cdf0e10cSrcweir$(call gb_Deliver_add_deliverable,$(OUTDIR)/$(1),$(2))
34cdf0e10cSrcweir
35cdf0e10cSrcweirendef
36cdf0e10cSrcweir
37cdf0e10cSrcweir
38cdf0e10cSrcweir# Package class
39cdf0e10cSrcweir
40cdf0e10cSrcweir.PHONY : $(call gb_Package_get_clean_target,%)
41cdf0e10cSrcweir$(call gb_Package_get_clean_target,%) :
42cdf0e10cSrcweir	$(call gb_Output_announce,$*,$(false),PKG,2)
43cdf0e10cSrcweir	-$(call gb_Helper_abbreviate_dirs,\
44cdf0e10cSrcweir		rm -f $(FILES))
45cdf0e10cSrcweir
46cdf0e10cSrcweir$(call gb_Package_get_preparation_target,%) :
47cdf0e10cSrcweir	mkdir -p $(dir $@) && touch $@
48cdf0e10cSrcweir
49cdf0e10cSrcweir$(call gb_Package_get_target,%) :
50cdf0e10cSrcweir	$(call gb_Output_announce,$*,$(true),PKG,2)
51cdf0e10cSrcweir	mkdir -p $(dir $@) && touch $@
52cdf0e10cSrcweir
53cdf0e10cSrcweir
54cdf0e10cSrcweirdefine gb_Package_Package
55cdf0e10cSrcweirgb_Package_SOURCEDIR_$(1) := $(2)
56cdf0e10cSrcweir$(call gb_Package_get_clean_target,$(1)) : FILES := $(call gb_Package_get_target,$(1)) $(call gb_Package_get_preparation_target,$(1))
57cdf0e10cSrcweir$$(eval $$(call gb_Module_register_target,$(call gb_Package_get_target,$(1)),$(call gb_Package_get_clean_target,$(1))))
58cdf0e10cSrcweir$(call gb_Package_get_target,$(1)) : $(call gb_Package_get_preparation_target,$(1))
59cdf0e10cSrcweir
60cdf0e10cSrcweirendef
61cdf0e10cSrcweir
62cdf0e10cSrcweirdefine gb_Package_add_file
63cdf0e10cSrcweir$(call gb_Package_get_target,$(1)) : $(OUTDIR)/$(2)
64cdf0e10cSrcweir$(call gb_Package_get_clean_target,$(1)) : FILES += $(OUTDIR)/$(2)
65cdf0e10cSrcweir$(call gb_PackagePart_PackagePart,$(2),$$(gb_Package_SOURCEDIR_$(1))/$(3),$(call gb_Package_get_preparation_target,$(1)))
66cdf0e10cSrcweir
67cdf0e10cSrcweirendef
68cdf0e10cSrcweir
69*3e9d7d56SAndre Fischer#
70*3e9d7d56SAndre Fischer# Add multiple files $(3), which are located in directory $(2) to the package $(1).
71*3e9d7d56SAndre Fischer#
72*3e9d7d56SAndre Fischerdefine gb_Package_add_files
73*3e9d7d56SAndre Fischer$(foreach header,$(3), $(call gb_Package_add_file,$(strip $(1)),$(strip $(2))/$(header),$(header)))
74*3e9d7d56SAndre Fischerendef
75*3e9d7d56SAndre Fischer
76cdf0e10cSrcweirdefine gb_Package_add_customtarget
77cdf0e10cSrcweir$(call gb_Package_get_preparation_target,$(1)) : $(call gb_CustomTarget_get_target,$(2))
78cdf0e10cSrcweir$(call gb_Package_get_clean_target,$(1)) : $(call gb_CustomTarget_get_clean_target,$(2))
79cdf0e10cSrcweir$(call gb_CustomTarget_CustomTarget,$(2))
80cdf0e10cSrcweir
81cdf0e10cSrcweirendef
82cdf0e10cSrcweir
83cdf0e10cSrcweir# vim: set noet sw=4 ts=4:
84