gnumake2: first implementation of deliver.log generation

This commit is contained in:
Bjoern Michaelsen 2010-11-19 15:12:51 +01:00
parent 7e2a3c097f
commit 2afbd43d66
14 changed files with 108 additions and 35 deletions

View file

@ -230,8 +230,8 @@ $(call gb_ResTarget_get_target,%) : $(gb_Helper_MISCDUMMY) | $(gb_ResTarget_RSCT
$(call gb_ResTarget_get_outdir_target,%) :
$(call gb_Helper_abbreviate_dirs,\
$(call gb_Helper_deliver,$<,$@) && \
$(call gb_Helper_deliver,$(dir $<)/$(notdir $(ILSTTARGET)),$(ILSTTARGET)))
$(call gb_Deliver_deliver,$<,$@) && \
$(call gb_Deliver_deliver,$(dir $<)/$(notdir $(ILSTTARGET)),$(ILSTTARGET)))
define gb_ResTarget_ResTarget
$(call gb_ResTarget_get_target,$(1)) : LIBRARY = $(2)
@ -243,6 +243,8 @@ $(call gb_ResTarget_get_imagelist_target,$(1)) : $(call gb_ResTarget_get_target,
$(call gb_ResTarget_get_outdir_target,$(1)) : $(call gb_ResTarget_get_target,$(1))
$(call gb_ResTarget_get_outdir_target,$(1)) : ILSTTARGET = $(call gb_ResTarget_get_outdir_imagelist_target,$(1))
$(call gb_Deliver_add_deliverable,$(call gb_ResTarget_get_outdir_target,$(1)),$(call gb_ResTarget_get_target,$(1)))
$(call gb_Deliver_add_deliverable,$(call gb_ResTarget_get_outdir_imagelist_target,$(1)),$(call gb_ResTarget_get_imagelist_target,$(1)))
endef

View file

@ -65,11 +65,12 @@ $(call gb_ComponentTarget_get_target,%) :
$(eval $(call gb_Outpt_error,Unable to find component file $(call gb_ComponentTarget_get_source,,$*) in the repositories: $(gb_ComponentTarget_REPOS) or xlstproc is missing.))
$(call gb_ComponentTarget_get_external_target,%) :
$(call gb_Helper_deliver,$<,$@)
$(call gb_Deliver_deliver,$<,$@)
define gb_ComponentTarget_ComponentTarget
$(call gb_ComponentTarget_get_target,$(1)) : LIBFILENAME := $(2)
$(call gb_ComponentTarget_get_outdir_target,$(1)) : $(call gb_ComponentTarget_get_target,$(1))
$(call gb_Deliver_add_deliverable,$(call gb_ComponentTarget_get_outdir_target,$(1)),$(call gb_ComponentTarget_get_target,$(1)))
endef

79
solenv/gbuild/Deliver.mk Normal file
View file

@ -0,0 +1,79 @@
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# Copyright 2000, 2010 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
#
# This file is part of OpenOffice.org.
#
# OpenOffice.org is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# only, as published by the Free Software Foundation.
#
# OpenOffice.org is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License version 3 for more details
# (a copy is included in the LICENSE file that accompanied this code).
#
# You should have received a copy of the GNU Lesser General Public License
# version 3 along with OpenOffice.org. If not, see
# <http://www.openoffice.org/license.html>
# for a copy of the LGPLv3 License.
#
#*************************************************************************
# gb_Deliver_GNUCOPY is set by the platform
# if ($true) then old files will get removed from the target location before
# they are copied there. In multi-user environments, this is needed you need to
# be the owner of the target file to be able to modify timestamps
gb_Deliver_CLEARONDELIVER := $(true)
gb_Deliver__deliverprefix = mkdir -p $(dir $(1)) &&
ifeq ($(gb_Deliver_CLEARONDELIVER),$(true))
gb_Deliver__deliverprefix += rm -rf $(1) &&
endif
define gb_Deliver_init
gb_Deliver_DELIVERABLES :=
endef
# FIXME: this does not really work for real multi repository builds, but the
# deliver.log format is broken in that case anyway
define gb_Deliver_add_deliverable
gb_Deliver_DELIVERABLES += $$(patsubst $(SOURCE_ROOT_DIR)/%,%,$(2)):$$(patsubst $(SOURCE_ROOT_DIR)/%,%,$(1))
endef
define gb_Deliver_get_deliverlog
$(foreach deliverable,$(gb_Deliver_DELIVERABLES),$(NEWLINE)COPY $(subst :, ,$(deliverable)))
endef
define gb_Deliver_deliver
$(call gb_Deliver__deliverprefix,$(2)) $(gb_Deliver_GNUCOPY) -f $(1) $(2)
endef
define gb_Deliver_setdeliverlogcommand
ifeq ($$(words $(gb_Module_ALLMODULES)),1)
$$(eval $$(call gb_Output_announce,$$(strip $$(gb_Module_ALLMODULES)),$$(true),LOG,1))
deliverlog : COMMAND := mkdir -p $$(OUTDIR)/inc/$$(strip $$(gb_Module_ALLMODULES)) &&
deliverlog : COMMAND += echo "$$(strip $$(call gb_Deliver_DELIVERABLES))" | awk -f $$(GBUILDDIR)/processdelivered.awk > $$(OUTDIR)/inc/$$(strip $(gb_Module_ALLMODULES))/deliver.log
else
$$(eval $$(call gb_Output_announce,more than one module - creating no deliver.log,$$(true),LOG,1))
deliverlog : COMMAND := true
endif
endef
.PHONY : deliverlog
deliverlog:
$(eval $(call gb_Deliver_setdeliverlogcommand))
$(COMMAND)
all : deliverlog
# vim: set noet sw=4 ts=4:

View file

@ -40,8 +40,8 @@ $(call gb_Executable_get_clean_target,%) :
$(call gb_Executable_get_target,%) :
$(call gb_Helper_abbreviate_dirs,\
$(call gb_Helper_deliver,$<,$@) \
$(foreach target,$(AUXTARGETS), && $(call gb_Helper_deliver,$(dir $<)/$(notdir $(target)),$(target))))
$(call gb_Deliver_deliver,$<,$@) \
$(foreach target,$(AUXTARGETS), && $(call gb_Deliver_deliver,$(dir $<)/$(notdir $(target)),$(target))))
define gb_Executable_Executable
$(call gb_Executable__Executable_impl,$(1),Executable/$(1)$(gb_Executable_EXT))
@ -55,6 +55,7 @@ $(call gb_Executable_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2))
$(call gb_Executable_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2))
$(call gb_Executable_Executable_platform,$(1),$(2))
$(call gb_Module_register_target,$(call gb_Executable_get_target,$(1)),$(call gb_Executable_get_clean_target,$(1)))
$(call gb_Deliver_add_deliverable,$(call gb_Executable_get_target,$(1)),$(call gb_LinkTarget_get_target,$(2)))
endef

View file

@ -27,8 +27,6 @@
gb_Helper_NULLFILE := /dev/null
# gb_Helper_GNUCOPY is set by the platform
gb_Helper_MISC := $(WORKDIR)/Misc
# general propose phony target
@ -37,11 +35,6 @@ gb_Helper_PHONY := $(gb_Helper_MISC)/PHONY
# general propose empty dummy target
gb_Helper_MISCDUMMY := $(gb_Helper_MISC)/DUMMY
# if ($true) then old files will get removed from the target location before
# they are copied there. In multi-user environments, this is needed you need to
# be the owner of the target file to be able to cp -pf
gb_Helper_CLEARONDELIVER := $(true)
.PHONY : $(WORKDIR)/Misc/PHONY
$(gb_Helper_MISCDUMMY) :
@mkdir -p $(dir $@) && touch $@
@ -90,16 +83,6 @@ define gb_Helper_get_outdir_clean_target
$$(subst $(OUTDIR)/,$(WORKDIR)/Clean/OutDir/,$(1))
endef
gb_Helper__deliverprefix = mkdir -p $(dir $(1)) &&
ifeq ($(gb_Helper_CLEARONDELIVER),$(true))
gb_Helper__deliverprefix += rm -rf $(1) &&
endif
define gb_Helper_deliver
$(call gb_Helper__deliverprefix,$(2)) $(gb_Helper_GNUCOPY) -f $(1) $(2)
endef
define gb_Helper_register_repository
gb_Helper_CURRENTREPOSITORY := $(1)

View file

@ -50,8 +50,8 @@ $(WORKDIR)/Clean/OutDir/lib/%$(gb_Library_PLAINEXT) : $(call gb_LinkTarget_get_c
# EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on windows
$(gb_Library_OUTDIRLOCATION)/%$(gb_Library_PLAINEXT) :
$(call gb_Helper_abbreviate_dirs,\
$(call gb_Helper_deliver,$<,$@) \
$(foreach target,$(AUXTARGETS), && $(call gb_Helper_deliver,$(dir $<)/$(notdir $(target)),$(target))))
$(call gb_Deliver_deliver,$<,$@) \
$(foreach target,$(AUXTARGETS), && $(call gb_Deliver_deliver,$(dir $<)/$(notdir $(target)),$(target))))
define gb_Library_Library
ifeq (,$$(findstring $(1),$$(gb_Library_KNOWNLIBS)))
@ -73,6 +73,7 @@ $(call gb_LinkTarget_set_defs,$(2),\
$(call gb_Library_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(2))
$(call gb_Library_Library_platform,$(1),$(2),$(gb_Library_DLLDIR)/$(call gb_Library_get_dllname,$(1)))
$(call gb_Module_register_target,$(call gb_Library_get_target,$(1)),$(call gb_Library_get_clean_target,$(1)))
$(call gb_Deliver_add_deliverable,$(call gb_Library_get_target,$(1)),$(call gb_LinkTarget_get_target,$(2)))
endef

View file

@ -51,7 +51,7 @@ $(call gb_Module_get_target,%) :
.DEFAULT_GOAL := all
all :
$(call gb_Output_announce,top level modules: $(foreach module,$^,$(notdir $(module))),$(true),ALL,6)
$(call gb_Output_announce,top level modules: $(foreach module,$(filter-out deliverlog,$^),$(notdir $(module))),$(true),ALL,6)
$(call gb_Output_announce,loaded modules: $(sort $(gb_Module_ALLMODULES)),$(true),ALL,6)
$(call gb_Output_announce_title,all done.)
$(call gb_Output_announce_bell)
@ -65,7 +65,6 @@ clean :
install : all
uninstall : clean
define gb_Module_Module
gb_Module_ALLMODULES += $(1)
gb_Module_MODULELOCATIONS += $(1):$(dir $(realpath $(lastword $(MAKEFILE_LIST))))
@ -113,7 +112,7 @@ gb_Module_TARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_TARGETSTACK)),$$(gb
gb_Module_CLEANTARGETSTACK := $$(wordlist 2,$$(words $$(gb_Module_CLEANTARGETSTACK)),$$(gb_Module_CLEANTARGETSTACK))
ifneq ($$(gb_Module_TARGETSTACK),)
$$(warn corrupted module target stack!)
$$(eval $$(call gb_Output_error,Corrupted module target stack!))
endif
endef

View file

@ -29,10 +29,12 @@
# PackagePart class
$(foreach destination,$(call gb_PackagePart_get_destinations), $(destination)/%) :
$(call gb_Helper_deliver,$<,$@)
$(call gb_Deliver_deliver,$<,$@)
define gb_PackagePart_PackagePart
$(OUTDIR)/$(1) : $(2)
$(call gb_Deliver_add_deliverable,$(OUTDIR)/$(1),$(2))
endef
@ -60,7 +62,6 @@ $(call gb_Package_get_target,$(1)) : $(OUTDIR)/$(2)
$(call gb_Package_get_clean_target,$(1)) : FILES += $(OUTDIR)/$(2)
$(call gb_PackagePart_PackagePart,$(2),$$(gb_TARGET_PACKAGE_$(1)_SOURCEDIR)/$(3))
$(OUTDIR)/$(2) : $$(gb_TARGET_PACKAGE_$(1)_SOURCEDIR)/$(3)
endef
# vim: set noet sw=4 ts=4:

View file

@ -47,8 +47,8 @@ $(WORKDIR)/Clean/OutDir/lib/%$(gb_StaticLibrary_PLAINEXT) : $(call gb_LinkTarget
# EVIL: gb_StaticLibrary and gb_Library need the same deliver rule because they are indistinguishable on windows
$(gb_StaticLibrary_OUTDIRLOCATION)/%$(gb_StaticLibrary_PLAINEXT) :
$(call gb_Helper_abbreviate_dirs,\
$(call gb_Helper_deliver,$<,$@) \
$(foreach target,$(AUXTARGETS), && $(call gb_Helper_deliver,$(dir $<)/$(notdir $(target)),$(target))))
$(call gb_Deliver_deliver,$<,$@) \
$(foreach target,$(AUXTARGETS), && $(call gb_Deliver_deliver,$(dir $<)/$(notdir $(target)),$(target))))
define gb_StaticLibrary_StaticLibrary
ifeq (,$$(findstring $(1),$$(gb_StaticLibrary_KNOWNLIBS)))

View file

@ -170,6 +170,9 @@ endif
gb_GLOBALDEFS := $(sort $(gb_GLOBALDEFS))
include $(GBUILDDIR)/TargetLocations.mk
include $(GBUILDDIR)/Deliver.mk
$(eval $(call gb_Deliver_init))
# We are using a set of scopes that we might as well call classes.

View file

@ -135,7 +135,10 @@ endif
# Helper class
gb_Helper_abbreviate_dirs_native = $(gb_Helper_abbreviate_dirs)
gb_Helper_GNUCOPY := cp
# Deliver class
gb_Deliver_GNUCOPY := cp
# CObject class

View file

@ -133,7 +133,7 @@ endif
# Helper class
gb_Helper_abbreviate_dirs_native = $(gb_Helper_abbreviate_dirs)
gb_Helper_GNUCOPY := cp
gb_Deliver_GNUCOPY := cp
# CObject class

View file

@ -116,7 +116,7 @@ endif
# Helper class
gb_Helper_abbreviate_dirs_native = $(gb_Helper_abbreviate_dirs)
gb_Helper_GNUCOPY := $(firstword $(GNUCOPY) gnucp)
gb_Deliver_GNUCOPY := $(firstword $(GNUCOPY) gnucp)
# CObject class

View file

@ -177,7 +177,7 @@ endif
# Helper class
gb_Helper_GNUCOPY := cp
gb_Deliver_GNUCOPY := cp
gb_Helper_SRCDIR_NATIVE := $(shell cygpath -m $(SRCDIR))
gb_Helper_WORKDIR_NATIVE := $(shell cygpath -m $(WORKDIR))
gb_Helper_OUTDIR_NATIVE := $(shell cygpath -m $(OUTDIR))