xref: /trunk/main/solenv/gbuild/Deliver.mk (revision cdf0e10c)
1#*************************************************************************
2#
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# Copyright 2000, 2010 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
28gb_Deliver_GNUCOPY := $(GNUCOPY)
29
30# if ($true) then old files will get removed from the target location before
31# they are copied there. In multi-user environments, this is needed you need to
32# be the owner of the target file to be able to modify timestamps
33gb_Deliver_CLEARONDELIVER := $(true)
34
35define gb_Deliver_init
36gb_Deliver_DELIVERABLES :=
37
38endef
39
40define gb_Deliver_add_deliverable
41gb_Deliver_DELIVERABLES += $$(patsubst $(REPODIR)/%,%,$(2)):$$(patsubst $(REPODIR)/%,%,$(1))
42$(if $(gb_HIRESTIME),,.LOW_RESOLUTION_TIME : $(1))
43
44endef
45
46ifeq ($(strip $(gb_Deliver_GNUCOPY)),)
47define gb_Deliver_deliver
48mkdir -p $(dir $(2)) && $(if $(gb_Deliver_CLEARONDELIVER),rm -f $(2) &&) cp -f $(1) $(2) && touch -r $(1) $(2)
49endef
50else
51define gb_Deliver_deliver
52mkdir -p $(dir $(2)) && $(gb_Deliver_GNUCOPY) $(if $(gb_Deliver_CLEARONDELIVER),--remove-destination) --force --preserve=timestamps $(1) $(2)
53endef
54endif
55
56
57# We are currently only creating a deliver.log, if only one module gets build.
58# As it is possible to add gbuild modules into other (which is done for example for
59# the toplevel ooo module already) it does not make sense to create a deliver.log once
60# fully migrated. The whole process should be rethought then.
61# We need the trailing whitespace so that the newline of echo does not become part of the last record.
62define gb_Deliver_setdeliverlogcommand
63ifeq ($$(words $(gb_Module_ALLMODULES)),1)
64$$(eval $$(call gb_Output_announce,$$(strip $$(gb_Module_ALLMODULES)),$$(true),LOG,1))
65deliverlog : COMMAND := \
66 mkdir -p $$(OUTDIR)/inc/$$(strip $$(gb_Module_ALLMODULES)) \
67 && RESPONSEFILE=$$(call var2file,$(shell $(gb_MKTEMP)),100,$$(sort $$(gb_Deliver_DELIVERABLES))) \
68 && $(gb_AWK) -f $$(GBUILDDIR)/processdelivered.awk < $$$${RESPONSEFILE} \
69        > $$(OUTDIR)/inc/$$(strip $(gb_Module_ALLMODULES))/gb_deliver.log \
70 && rm -f $$$${RESPONSEFILE}
71else
72$$(eval $$(call gb_Output_announce,more than one module - creating no deliver.log,$$(true),LOG,1))
73deliverlog : COMMAND := true
74endif
75endef
76
77# FIXME: this does not really work for real multi repository builds, but the
78# deliver.log format is broken in that case anyway
79.PHONY : deliverlog showdeliverables
80deliverlog:
81	$(eval $(call gb_Deliver_setdeliverlogcommand))
82	$(call gb_Helper_abbreviate_dirs, $(COMMAND))
83
84# all : deliverlog
85
86define gb_Deliver_print_deliverable
87$(info $(1) $(patsubst $(OUTDIR)/%,%,$(2)))
88endef
89
90showdeliverables :
91	$(eval MAKEFLAGS := s)
92	$(foreach deliverable,$(sort $(gb_Deliver_DELIVERABLES)),\
93			$(call gb_Deliver_print_deliverable,$(REPODIR)/$(firstword $(subst :, ,$(deliverable))),$(REPODIR)/$(lastword $(subst :, ,$(deliverable)))))
94	true
95# vim: set noet sw=4 ts=4:
96