Bump for 3.6-28
[LibreOffice.git] / solenv / gbuild / Package.mk
blobe1d199e4f1428ae0a4164fadf128605b9af8365f
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
2 #*************************************************************************
4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 #
6 # Copyright 2000, 2011 Oracle and/or its affiliates.
8 # OpenOffice.org - a multi-platform office productivity suite
10 # This file is part of OpenOffice.org.
12 # OpenOffice.org is free software: you can redistribute it and/or modify
13 # it under the terms of the GNU Lesser General Public License version 3
14 # only, as published by the Free Software Foundation.
16 # OpenOffice.org is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU Lesser General Public License version 3 for more details
20 # (a copy is included in the LICENSE file that accompanied this code).
22 # You should have received a copy of the GNU Lesser General Public License
23 # version 3 along with OpenOffice.org. If not, see
24 # <http://www.openoffice.org/license.html>
25 # for a copy of the LGPLv3 License.
27 #*************************************************************************
30 # PackagePart class
32 # a pattern rule with multiple targets is actually executed only once for each
33 # match, so define only pattern rules with one target here
34 # the .dir is for make 3.81, which ignores trailing /
35 define gb_PackagePart__rule
36 $(1)/.dir :
37 $$(if $$(wildcard $$(dir $$@)),,mkdir -p $$(dir $$@))
38 $(1)/%/.dir :
39 $$(if $$(wildcard $$(dir $$@)),,mkdir -p $$(dir $$@))
40 $(1)/% :
41 $$(call gb_Deliver_deliver,$$<,$$@)
42 endef
44 $(foreach destination,$(call gb_PackagePart_get_destinations),$(eval \
45 $(call gb_PackagePart__rule,$(destination))))
47 define gb_PackagePart_PackagePart
48 $(OUTDIR)/$(1) : $(2) | $(dir $(OUTDIR)/$(1)).dir
49 $(2) :| $(3)
50 $(call gb_Deliver_add_deliverable,$(OUTDIR)/$(1),$(2),$(3))
51 endef
54 # Package class
56 .PHONY : $(call gb_Package_get_clean_target,%)
57 $(call gb_Package_get_clean_target,%) :
58 $(call gb_Output_announce,$*,$(false),PKG,2)
59 RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),500,$(FILES)) \
60 && cat $${RESPONSEFILE} | xargs $(if $(filter MACOSX,$(OS_FOR_BUILD)),-n 1000) rm -f \
61 && rm -f $${RESPONSEFILE}
63 $(call gb_Package_get_preparation_target,%) :
64 mkdir -p $(dir $@) && touch $@
66 $(call gb_Package_get_target,%) :
67 $(call gb_Output_announce,$*,$(true),PKG,2)
68 mkdir -p $(dir $@) && touch $@
70 # for other targets that want to create Packages, does not register at Module
71 define gb_Package_Package_internal
72 gb_Package_SOURCEDIR_$(1) := $(2)
73 $(call gb_Package_get_clean_target,$(1)) : FILES := $(call gb_Package_get_target,$(1)) $(call gb_Package_get_preparation_target,$(1))
74 $(call gb_Package_get_target,$(1)) : $(call gb_Package_get_preparation_target,$(1))
76 endef
78 define gb_Package_Package
79 $(call gb_Package_Package_internal,$(1),$(2))
80 $$(eval $$(call gb_Module_register_target,$(call gb_Package_get_target,$(1)),$(call gb_Package_get_clean_target,$(1))))
82 endef
84 define gb_Package_add_file
85 $(call gb_Package_get_target,$(1)) : $(OUTDIR)/$(2)
86 $(call gb_Package_get_clean_target,$(1)) : FILES += $(OUTDIR)/$(2)
87 $(call gb_PackagePart_PackagePart,$(2),$$(gb_Package_SOURCEDIR_$(1))/$(3),$(call gb_Package_get_preparation_target,$(1)))
89 endef
91 # Adds several files at once.
93 # Files are copied directly into the specified directory.
95 # Example:
96 # $(eval $(call gb_Package_Package,foo_inc,$(SRCDIR)/foo/inc))
97 # $(eval $(call gb_Package_add_files,foo_inc,inc/foo,foo/bar/foo.hxx))
98 # # -> inc/foo/foo.hxx
99 define gb_Package_add_files
100 $(foreach file,$(3),$(call gb_Package_add_file,$(1),$(2)/$(notdir $(file)),$(file)))
102 endef
104 # Adds several files at once.
106 # Files are copied including subdirectories.
108 # Example:
109 # $(eval $(call gb_Package_Package,foo_inc,$(SRCDIR)/foo/inc))
110 # $(eval $(call gb_Package_add_files,foo_inc,inc,foo/bar/foo.hxx))
111 # # -> inc/foo/bar/foo.hxx
112 define gb_Package_add_files_with_dir
113 $(foreach file,$(3),$(call gb_Package_add_file,$(1),$(2)/$(file),$(file)))
115 endef
117 # vim: set noet sw=4: