xref: /trunk/main/solenv/gbuild/Package.mk (revision cdf0e10c)
1#*************************************************************************
2#
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# Copyright 2000, 2011 Oracle and/or its affiliates.
6#
7# OpenOffice.org - a multi-platform office productivity suite
8#
9# This file is part of OpenOffice.org.
10#
11# OpenOffice.org is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Lesser General Public License version 3
13# only, as published by the Free Software Foundation.
14#
15# OpenOffice.org is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU Lesser General Public License version 3 for more details
19# (a copy is included in the LICENSE file that accompanied this code).
20#
21# You should have received a copy of the GNU Lesser General Public License
22# version 3 along with OpenOffice.org.  If not, see
23# <http://www.openoffice.org/license.html>
24# for a copy of the LGPLv3 License.
25#
26#*************************************************************************
27
28
29# PackagePart class
30
31$(foreach destination,$(call gb_PackagePart_get_destinations), $(destination)/%) :
32	$(call gb_Deliver_deliver,$<,$@)
33
34define gb_PackagePart_PackagePart
35$(OUTDIR)/$(1) : $(2)
36$(2) :| $(3)
37$(call gb_Deliver_add_deliverable,$(OUTDIR)/$(1),$(2))
38
39endef
40
41
42# Package class
43
44.PHONY : $(call gb_Package_get_clean_target,%)
45$(call gb_Package_get_clean_target,%) :
46	$(call gb_Output_announce,$*,$(false),PKG,2)
47	-$(call gb_Helper_abbreviate_dirs,\
48		rm -f $(FILES))
49
50$(call gb_Package_get_preparation_target,%) :
51	mkdir -p $(dir $@) && touch $@
52
53$(call gb_Package_get_target,%) :
54	$(call gb_Output_announce,$*,$(true),PKG,2)
55	mkdir -p $(dir $@) && touch $@
56
57
58define gb_Package_Package
59gb_Package_SOURCEDIR_$(1) := $(2)
60$(call gb_Package_get_clean_target,$(1)) : FILES := $(call gb_Package_get_target,$(1)) $(call gb_Package_get_preparation_target,$(1))
61$$(eval $$(call gb_Module_register_target,$(call gb_Package_get_target,$(1)),$(call gb_Package_get_clean_target,$(1))))
62$(call gb_Package_get_target,$(1)) : $(call gb_Package_get_preparation_target,$(1))
63
64endef
65
66define gb_Package_add_file
67$(call gb_Package_get_target,$(1)) : $(OUTDIR)/$(2)
68$(call gb_Package_get_clean_target,$(1)) : FILES += $(OUTDIR)/$(2)
69$(call gb_PackagePart_PackagePart,$(2),$$(gb_Package_SOURCEDIR_$(1))/$(3),$(call gb_Package_get_preparation_target,$(1)))
70
71endef
72
73define gb_Package_add_customtarget
74$(call gb_Package_get_preparation_target,$(1)) : $(call gb_CustomTarget_get_target,$(2))
75$(call gb_Package_get_clean_target,$(1)) : $(call gb_CustomTarget_get_clean_target,$(2))
76$(call gb_CustomTarget_CustomTarget,$(2))
77
78endef
79
80# vim: set noet sw=4 ts=4:
81