Author: arist Date: Thu Nov 15 00:07:50 2012 New Revision: 1409590 URL: http://svn.apache.org/viewvc?rev=1409590&view=rev Log: gnumake4_136_371ab623e90d.patch # HG changeset patch # User Michael Stahl <m...@openoffice.org> # Date 1302888427 0 # Node ID 371ab623e90dcd6a2493bc42d1e773cb577a0e9f # Parent 7bc9148e9497d03b14da2ccaeb255ea53303442b gnumake4: #i117845#: LinkTarget.mk: refactor dep-files: introduce dependency from object dep-file to object.
Modified: incubator/ooo/branches/gbuild/main/solenv/gbuild/LinkTarget.mk incubator/ooo/branches/gbuild/main/solenv/gbuild/platform/windows.mk Modified: incubator/ooo/branches/gbuild/main/solenv/gbuild/LinkTarget.mk URL: http://svn.apache.org/viewvc/incubator/ooo/branches/gbuild/main/solenv/gbuild/LinkTarget.mk?rev=1409590&r1=1409589&r2=1409590&view=diff ============================================================================== --- incubator/ooo/branches/gbuild/main/solenv/gbuild/LinkTarget.mk (original) +++ incubator/ooo/branches/gbuild/main/solenv/gbuild/LinkTarget.mk Thu Nov 15 00:07:50 2012 @@ -40,33 +40,41 @@ OBJCXXFLAGS ?= $(gb_COMPILEROPTFLAGS) endif -# CObject class - -gb_CObject_REPOS := $(gb_REPOS) - -gb_CObject_get_source = $(1)/$(2).c -# defined by platform -# gb_CObject__command +# For every object there is a dep file (if gb_FULLDEPS is active). +# The dep file depends on the object: the Object__command also updates the +# dep file as a side effect. +# In the dep file rule just touch it so it's newer than the object. -# this rule generates an "always rebuild" dep file, to have something to include. -# the dep file will be overridden on the fly, when the object is compiled +# The gb_Object__command_dep generates an "always rebuild" dep file; +# It is _only_ used in case the user deletes the object dep file. ifeq ($(gb_FULLDEPS),$(true)) -define gb_CObject__command_dep +define gb_Object__command_dep mkdir -p $(dir $(1)) && \ - echo '$(call gb_CObject_get_target,$(2)) : $$(gb_Helper_PHONY)' > $(1) + echo '$(2) : $$(gb_Helper_PHONY)' > $(1) endef else -gb_CObject__command_dep = +gb_Object__command_dep = \ + $(call gb_Output_error,gb_Object__command_dep is only for gb_FULLDEPS) endif + +# CObject class + +gb_CObject_REPOS := $(gb_REPOS) + +gb_CObject_get_source = $(1)/$(2).c +# defined by platform +# gb_CObject__command + define gb_CObject__rules $$(call gb_CObject_get_target,%) : $$(call gb_CObject_get_source,$(1),%) $$(call gb_CObject__command,$$@,$$*,$$<,$$(call gb_CObject_get_dep_target,$$*)) ifeq ($(gb_FULLDEPS),$(true)) -$$(call gb_CObject_get_dep_target,%) : $$(call gb_CObject_get_source,$(1),%) - $$(call gb_CObject__command_dep,$$@,$$*,$$<) +$$(call gb_CObject_get_dep_target,%) : $$(call gb_CObject_get_target,%) + $$(if $$(wildcard $$@),touch $$@,\ + $$(call gb_Object__command_dep,$$@,$$(call gb_CObject_get_target,$$*))) endif endef @@ -87,19 +95,6 @@ gb_CxxObject_get_source = $(1)/$(2).cxx # defined by platform # gb_CxxObject__command -# This rule generates an "always rebuild" dep file, to have something to -# include. The dep file will be overridden on the fly, when the object is -# compiled. -ifeq ($(gb_FULLDEPS),$(true)) -define gb_CxxObject__command_dep -mkdir -p $(dir $(1)) && \ - echo '$(call gb_CxxObject_get_target,$(2)) : $$(gb_Helper_PHONY)' > $(1) - -endef -else -gb_CxxObject__command_dep = -endif - # Only enable PCH if the PCH_CXXFLAGS and the PCH_DEFS (from the linktarget) # are the same as the T_CXXFLAGS and DEFS we want to use for this object. This # should usually be the case. The DEFS/T_CXXFLAGS would have too be manually @@ -134,9 +129,10 @@ $$(call gb_CxxObject_get_target,%) : $$( $$(call gb_CxxObject__command,$$@,$$*,$$<,$$(call gb_CxxObject_get_dep_target,$$*)) ifeq ($(gb_FULLDEPS),$(true)) -$$(call gb_CxxObject_get_dep_target,%) : $$(call gb_CxxObject_get_source,$(1),%) - $$(eval $$(gb_CxxObject__set_pchflags)) - $$(call gb_CxxObject__command_dep,$$@,$$*,$$<) +$$(call gb_CxxObject_get_dep_target,%) : $$(call gb_CxxObject_get_target,%) + $$(if $$(wildcard $$@),touch $$@,\ + $$(eval $$(gb_CxxObject__set_pchflags))\ + $$(call gb_Object__command_dep,$$@,$$(call gb_CxxObject_get_target,$$*))) endif endef @@ -158,27 +154,13 @@ gb_GenCxxObject_get_source = $(WORKDIR)/ # defined by platform # gb_CxxObject__command -# This rule generates an "always rebuild" dep file, to have something to -# include. The dep file will be overridden on the fly, when the object is -# compiled. -ifeq ($(gb_FULLDEPS),$(true)) -define gb_GenCxxObject__command_dep -mkdir -p $(dir $(1)) && \ - echo '$(call gb_GenCxxObject_get_target,$(2)) : $$(gb_Helper_PHONY)' > $(1) -endef -else -gb_GenCxxObject__command_dep = -endif - $(call gb_GenCxxObject_get_target,%) : $(call gb_GenCxxObject_get_source,%) $(call gb_CxxObject__command,$@,$*,$<,$(call gb_GenCxxObject_get_dep_target,$*)) ifeq ($(gb_FULLDEPS),$(true)) -$(call gb_GenCxxObject_get_dep_target,%) : $(call gb_GenCxxObject_get_source,%) - $(call gb_GenCxxObject__command_dep,$@,$*,$<) - -$(call gb_GenCxxObject_get_dep_target,%) : - $(eval $(call gb_Output_error,Unable to find generated C++ file $(call gb_GenCxxObject_get_source,$*) in WORKDIR.)) +$(call gb_GenCxxObject_get_dep_target,%) : $(call gb_GenCxxObject_get_target,%) + $(if $(wildcard $@),touch $@,\ + $(call gb_Object__command_dep,$@,$(call gb_GenCxxObject_get_target,$*))) endif gb_GenCxxObject_GenCxxObject = @@ -192,25 +174,14 @@ gb_ObjCxxObject_get_source = $(1)/$(2).m # defined by platform # gb_ObjCxxObject__command -# this rule generates an "always rebuild" dep file, to have something to include. -# the dep file will be overridden on the fly, when the object is compiled -ifeq ($(gb_FULLDEPS),$(true)) -define gb_ObjCxxObject__command_dep -mkdir -p $(dir $(1)) && \ - echo '$(call gb_ObjCxxObject_get_target,$(2)) : $$(gb_Helper_PHONY)' > $(1) - -endef -else -gb_ObjCxxObject__command_dep = -endif - define gb_ObjCxxObject__rules $$(call gb_ObjCxxObject_get_target,%) : $$(call gb_ObjCxxObject_get_source,$(1),%) $$(call gb_ObjCxxObject__command,$$@,$$*,$$<,$$(call gb_ObjCxxObject_get_dep_target,$$*)) ifeq ($(gb_FULLDEPS),$(true)) -$$(call gb_ObjCxxObject_get_dep_target,%) : $$(call gb_ObjCxxObject_get_source,$(1),%) - $$(call gb_ObjCxxObject__command_dep,$$@,$$*,$$<) +$$(call gb_ObjCxxObject_get_dep_target,%) : $$(call gb_ObjCxxObject_get_target,%) + $$(if $$(wildcard $$@),touch $$@,\ + $$(call gb_Object__command_dep,$$@,$$(call gb_ObjCxxObject_get_target,$$*))) endif endef @@ -262,7 +233,9 @@ define gb_LinkTarget__command_dep $(call gb_Output_announce,LNK:$(2),$(true),DEP,1) $(call gb_Helper_abbreviate_dirs,\ mkdir -p $(dir $(1)) && \ + echo '$$(info ************** THIS IS LIBTARGET.d *********)'> /tmp/hack && \ RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),200,\ + /tmp/hack \ $(foreach object,$(3),$(call gb_CObject_get_dep_target,$(object))) \ $(foreach object,$(4),$(call gb_CxxObject_get_dep_target,$(object))) \ $(foreach object,$(5),$(call gb_ObjCxxObject_get_dep_target,$(object)))\ @@ -385,11 +358,7 @@ $(call gb_LinkTarget_get_target,$(1)) : $(call gb_LinkTarget_get_target,$(1)) : NATIVERES := ifeq ($(gb_FULLDEPS),$(true)) -ifneq ($(wildcard $(call gb_LinkTarget_get_dep_target,$(1))),) -include $(call gb_LinkTarget_get_dep_target,$(1)) -else -$(firstword $(MAKEFILE_LIST)) : $(call gb_LinkTarget_get_dep_target,$(1)) -endif +-include $(call gb_LinkTarget_get_dep_target,$(1)) $(call gb_LinkTarget_get_dep_target,$(1)) : COBJECTS := $(call gb_LinkTarget_get_dep_target,$(1)) : CXXOBJECTS := $(call gb_LinkTarget_get_dep_target,$(1)) : OBJCXXOBJECTS := Modified: incubator/ooo/branches/gbuild/main/solenv/gbuild/platform/windows.mk URL: http://svn.apache.org/viewvc/incubator/ooo/branches/gbuild/main/solenv/gbuild/platform/windows.mk?rev=1409590&r1=1409589&r2=1409590&view=diff ============================================================================== --- incubator/ooo/branches/gbuild/main/solenv/gbuild/platform/windows.mk (original) +++ incubator/ooo/branches/gbuild/main/solenv/gbuild/platform/windows.mk Thu Nov 15 00:07:50 2012 @@ -275,7 +275,7 @@ endif define gb_CObject__command $(call gb_Output_announce,$(2),$(true),C ,3) $(call gb_Helper_abbreviate_dirs_native,\ - mkdir -p $(dir $(1)) && \ + mkdir -p $(dir $(1)) $(dir $(4)) && \ unset INCLUDE && \ $(gb_CC) \ $(DEFS) \ @@ -295,7 +295,7 @@ endef define gb_CxxObject__command $(call gb_Output_announce,$(2),$(true),CXX,3) $(call gb_Helper_abbreviate_dirs_native,\ - mkdir -p $(dir $(1)) && \ + mkdir -p $(dir $(1)) $(dir $(4)) && \ unset INCLUDE && \ $(gb_CXX) \ $(DEFS) \