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