xref: /aoo42x/main/solenv/gbuild/Package.mk (revision e189e7f1)
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
27*e189e7f1SArrigo Marchioridefine gb_PackagePart_deliver_destination
28*e189e7f1SArrigo Marchiori$(1)/% :
29*e189e7f1SArrigo Marchiori	$$(call gb_Deliver_deliver,$$<,$$@)
30*e189e7f1SArrigo Marchiori
31*e189e7f1SArrigo Marchioriendef
32*e189e7f1SArrigo Marchiori
33*e189e7f1SArrigo Marchiori$(foreach destination,$(call gb_PackagePart_get_destinations),$(eval $(call gb_PackagePart_deliver_destination,$(destination))))
34*e189e7f1SArrigo Marchiori
35*e189e7f1SArrigo Marchiori
36cdf0e10cSrcweir
37cdf0e10cSrcweirdefine gb_PackagePart_PackagePart
38cdf0e10cSrcweir$(OUTDIR)/$(1) : $(2)
39cdf0e10cSrcweir$(2) :| $(3)
40b63233d8Sdamjan$(call gb_Deliver_add_deliverable,$(OUTDIR)/$(1),$(2),$(3))
41cdf0e10cSrcweirendef
42cdf0e10cSrcweir
43cdf0e10cSrcweir
44cdf0e10cSrcweir# Package class
45cdf0e10cSrcweir
46cdf0e10cSrcweir.PHONY : $(call gb_Package_get_clean_target,%)
47cdf0e10cSrcweir$(call gb_Package_get_clean_target,%) :
48cdf0e10cSrcweir	$(call gb_Output_announce,$*,$(false),PKG,2)
49b63233d8Sdamjan	RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),500,$(FILES)) \
50b63233d8Sdamjan	&& cat $${RESPONSEFILE} | xargs rm -f \
51*e189e7f1SArrigo Marchiori	&& rm -f $${RESPONSEFILE}
52cdf0e10cSrcweir
53cdf0e10cSrcweir$(call gb_Package_get_preparation_target,%) :
54cdf0e10cSrcweir	mkdir -p $(dir $@) && touch $@
55cdf0e10cSrcweir
56cdf0e10cSrcweir$(call gb_Package_get_target,%) :
57cdf0e10cSrcweir	$(call gb_Output_announce,$*,$(true),PKG,2)
58cdf0e10cSrcweir	mkdir -p $(dir $@) && touch $@
59cdf0e10cSrcweir
60cdf0e10cSrcweir
61cdf0e10cSrcweirdefine gb_Package_Package
62cdf0e10cSrcweirgb_Package_SOURCEDIR_$(1) := $(2)
63cdf0e10cSrcweir$(call gb_Package_get_clean_target,$(1)) : FILES := $(call gb_Package_get_target,$(1)) $(call gb_Package_get_preparation_target,$(1))
64cdf0e10cSrcweir$$(eval $$(call gb_Module_register_target,$(call gb_Package_get_target,$(1)),$(call gb_Package_get_clean_target,$(1))))
65cdf0e10cSrcweir$(call gb_Package_get_target,$(1)) : $(call gb_Package_get_preparation_target,$(1))
66cdf0e10cSrcweir
67cdf0e10cSrcweirendef
68cdf0e10cSrcweir
69cdf0e10cSrcweirdefine gb_Package_add_file
70cdf0e10cSrcweir$(call gb_Package_get_target,$(1)) : $(OUTDIR)/$(2)
71cdf0e10cSrcweir$(call gb_Package_get_clean_target,$(1)) : FILES += $(OUTDIR)/$(2)
72cdf0e10cSrcweir$(call gb_PackagePart_PackagePart,$(2),$$(gb_Package_SOURCEDIR_$(1))/$(3),$(call gb_Package_get_preparation_target,$(1)))
73cdf0e10cSrcweir
74cdf0e10cSrcweirendef
75cdf0e10cSrcweir
763e9d7d56SAndre Fischer#
773e9d7d56SAndre Fischer# Add multiple files $(3), which are located in directory $(2) to the package $(1).
783e9d7d56SAndre Fischer#
793e9d7d56SAndre Fischerdefine gb_Package_add_files
803e9d7d56SAndre Fischer$(foreach header,$(3), $(call gb_Package_add_file,$(strip $(1)),$(strip $(2))/$(header),$(header)))
813e9d7d56SAndre Fischerendef
823e9d7d56SAndre Fischer
83cdf0e10cSrcweirdefine gb_Package_add_customtarget
84cdf0e10cSrcweir$(call gb_Package_get_preparation_target,$(1)) : $(call gb_CustomTarget_get_target,$(2))
85cdf0e10cSrcweir$(call gb_Package_get_clean_target,$(1)) : $(call gb_CustomTarget_get_clean_target,$(2))
86b63233d8Sdamjan$(eval $(call gb_CustomTarget_CustomTarget,$(2),$(3)))
87cdf0e10cSrcweir
88cdf0e10cSrcweirendef
89cdf0e10cSrcweir
90cdf0e10cSrcweir# vim: set noet sw=4 ts=4:
91