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