xref: /aoo4110/main/solenv/gbuild/Deliver.mk (revision b1cdbd2c)
1#**************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20#**************************************************************
21
22
23
24gb_Deliver_GNUCOPY := $(GNUCOPY)
25
26# if ($true) then old files will get removed from the target location before
27# they are copied there. In multi-user environments, this is needed you need to
28# be the owner of the target file to be able to modify timestamps
29gb_Deliver_CLEARONDELIVER := $(true)
30
31define gb_Deliver_init
32gb_Deliver_DELIVERABLES :=
33
34endef
35
36define gb_Deliver_add_deliverable
37gb_Deliver_DELIVERABLES += $$(patsubst $(REPODIR)/%,%,$(2)):$$(patsubst $(REPODIR)/%,%,$(1))
38$(if $(gb_HIRESTIME),,.LOW_RESOLUTION_TIME : $(1))
39
40endef
41
42ifeq ($(strip $(gb_Deliver_GNUCOPY)),)
43define gb_Deliver_deliver
44mkdir -p $(dir $(2)) && $(if $(gb_Deliver_CLEARONDELIVER),rm -f $(2) &&) cp -f $(1) $(2) && touch -r $(1) $(2)
45endef
46else
47define gb_Deliver_deliver
48mkdir -p $(dir $(2)) && $(gb_Deliver_GNUCOPY) $(if $(gb_Deliver_CLEARONDELIVER),--remove-destination) --force --preserve=timestamps $(1) $(2)
49endef
50endif
51
52
53# We are currently only creating a deliver.log, if only one module gets build.
54# As it is possible to add gbuild modules into other (which is done for example for
55# the toplevel ooo module already) it does not make sense to create a deliver.log once
56# fully migrated. The whole process should be rethought then.
57# We need the trailing whitespace so that the newline of echo does not become part of the last record.
58define gb_Deliver_setdeliverlogcommand
59ifeq ($$(words $(gb_Module_ALLMODULES)),1)
60$$(eval $$(call gb_Output_announce,$$(strip $$(gb_Module_ALLMODULES)),$$(true),LOG,1))
61deliverlog : COMMAND := \
62 mkdir -p $$(OUTDIR)/inc/$$(strip $$(gb_Module_ALLMODULES)) \
63 && RESPONSEFILE=$$(call var2file,$(shell $(gb_MKTEMP)),100,$$(sort $$(gb_Deliver_DELIVERABLES))) \
64 && $(gb_AWK) -f $$(GBUILDDIR)/processdelivered.awk < $$$${RESPONSEFILE} \
65        > $$(OUTDIR)/inc/$$(strip $(gb_Module_ALLMODULES))/gb_deliver.log \
66 && rm -f $$$${RESPONSEFILE}
67else
68$$(eval $$(call gb_Output_announce,more than one module - creating no deliver.log,$$(true),LOG,1))
69deliverlog : COMMAND := true
70endif
71endef
72
73# FIXME: this does not really work for real multi repository builds, but the
74# deliver.log format is broken in that case anyway
75.PHONY : deliverlog showdeliverables
76deliverlog:
77	$(eval $(call gb_Deliver_setdeliverlogcommand))
78	$(call gb_Helper_abbreviate_dirs, $(COMMAND))
79
80# all : deliverlog
81
82define gb_Deliver_print_deliverable
83$(info $(1) $(patsubst $(OUTDIR)/%,%,$(2)))
84endef
85
86showdeliverables :
87	$(eval MAKEFLAGS := s)
88	$(foreach deliverable,$(sort $(gb_Deliver_DELIVERABLES)),\
89			$(call gb_Deliver_print_deliverable,$(REPODIR)/$(firstword $(subst :, ,$(deliverable))),$(REPODIR)/$(lastword $(subst :, ,$(deliverable)))))
90	true
91# vim: set noet sw=4 ts=4:
92