From 968c735aa7bcf8d03258e9cea931b9d776e4a890 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 28 Oct 2013 11:01:50 +0100 Subject: [PATCH] gbuild: refactor CliLibrary - stop copying the DLL to OUTDIR - since that was the main reason for the separation between CliLibrary and CliLibraryTarget, merge the targets; the newly inherited variables are not expected to cause problems - hardcode target to URE bin dir for now, no immediate need for multiple layers Change-Id: If0fea1337349c41f231c8cde122852c71d5080a7 --- cli_ure/Executable_climaker.mk | 2 +- cli_ure/Library_cli_cppuhelper_native.mk | 2 +- cli_ure/Library_cli_uno.mk | 2 +- cli_ure/Package_cli_basetypes_copy.mk | 4 +- solenv/gbuild/CliLibrary.mk | 129 ++++++----------------- solenv/gbuild/TargetLocations.mk | 6 +- 6 files changed, 41 insertions(+), 104 deletions(-) diff --git a/cli_ure/Executable_climaker.mk b/cli_ure/Executable_climaker.mk index f1aaf62914ae..2d99b1f6670e 100644 --- a/cli_ure/Executable_climaker.mk +++ b/cli_ure/Executable_climaker.mk @@ -14,7 +14,7 @@ $(eval $(call gb_Executable_use_package,climaker,\ )) $(eval $(call gb_Executable_add_cxxflags,climaker,\ - -AI $(gb_Helper_OUTDIRLIBDIR) \ + -AI $(INSTDIR)/$(LIBO_URE_LIB_FOLDER) \ -clr \ -LN \ -wd4339 \ diff --git a/cli_ure/Library_cli_cppuhelper_native.mk b/cli_ure/Library_cli_cppuhelper_native.mk index cc4e628a4751..39c13c8cfbc5 100644 --- a/cli_ure/Library_cli_cppuhelper_native.mk +++ b/cli_ure/Library_cli_cppuhelper_native.mk @@ -14,7 +14,7 @@ $(eval $(call gb_Library_Assembly,cli_cppuhelper)) # When compiling for CLR, disable "warning C4339: use of undefined type detected # in CLR meta-data - use of this type may lead to a runtime exception": $(eval $(call gb_Library_add_cxxflags,cli_cppuhelper,\ - -AI $(gb_Helper_OUTDIRLIBDIR) \ + -AI $(INSTDIR)/$(LIBO_URE_LIB_FOLDER) \ -clr \ -wd4339 \ )) diff --git a/cli_ure/Library_cli_uno.mk b/cli_ure/Library_cli_uno.mk index a215e9fc94be..58b2d4fe67d5 100644 --- a/cli_ure/Library_cli_uno.mk +++ b/cli_ure/Library_cli_uno.mk @@ -10,7 +10,7 @@ $(eval $(call gb_Library_Library,cli_uno)) $(eval $(call gb_Library_add_cxxflags,cli_uno,\ - -AI $(gb_Helper_OUTDIRLIBDIR) \ + -AI $(INSTDIR)/$(LIBO_URE_LIB_FOLDER) \ -clr \ -wd4339 \ )) diff --git a/cli_ure/Package_cli_basetypes_copy.mk b/cli_ure/Package_cli_basetypes_copy.mk index b0824e3bcb38..8cb20cecdb82 100644 --- a/cli_ure/Package_cli_basetypes_copy.mk +++ b/cli_ure/Package_cli_basetypes_copy.mk @@ -8,13 +8,13 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -$(eval $(call gb_Package_Package,cli_basetypes_copy,$(WORKDIR))) +$(eval $(call gb_Package_Package,cli_basetypes_copy,$(INSTROOT))) $(eval $(call gb_Package_set_outdir,cli_basetypes_copy,$(INSTDIR))) # duplicate copy to work around CLR DLL finding brain damage $(eval $(call gb_Package_add_files,cli_basetypes_copy,$(SDKDIRNAME)/bin,\ - CliLibraryTarget/cli_basetypes.dll \ + $(LIBO_URE_LIB_FOLDER)/cli_basetypes.dll \ )) # vim: set noet sw=4 ts=4: diff --git a/solenv/gbuild/CliLibrary.mk b/solenv/gbuild/CliLibrary.mk index 2513494b66e3..bdfdf543aa7d 100644 --- a/solenv/gbuild/CliLibrary.mk +++ b/solenv/gbuild/CliLibrary.mk @@ -7,37 +7,37 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -# CliLibraryTarget class +# CliLibrary class -gb_CliLibraryTarget_EXT := $(gb_CliAssembly_POLICYEXT) +gb_CliLibrary_EXT := $(gb_CliAssembly_POLICYEXT) -gb_CliLibraryTarget_CSCFLAGS := \ +gb_CliLibrary_CSCFLAGS := \ -noconfig \ -nologo \ -gb_CliLibraryTarget_CSCFLAGS_DEBUG := \ +gb_CliLibrary_CSCFLAGS_DEBUG := \ -checked+ \ -define:DEBUG \ -define:TRACE \ ifeq ($(strip $(debug)),) ifeq ($(strip $(ENABLE_DBGUTIL)),TRUE) -gb_CliLibraryTarget__get_csflags = $(gb_CliLibraryTarget_CSCFLAGS) $(gb_CliLibraryTarget_CSCFLAGS_DEBUG) +gb_CliLibrary__get_csflags = $(gb_CliLibrary_CSCFLAGS) $(gb_CliLibrary_CSCFLAGS_DEBUG) else -gb_CliLibraryTarget__get_csflags = $(gb_CliLibraryTarget_CSCFLAGS) -o +gb_CliLibrary__get_csflags = $(gb_CliLibrary_CSCFLAGS) -o endif else -gb_CliLibraryTarget__get_csflags = $(gb_CliLibraryTarget_CSCFLAGS) $(gb_CliLibraryTarget_CSCFLAGS_DEBUG) -debug+ +gb_CliLibrary__get_csflags = $(gb_CliLibrary_CSCFLAGS) $(gb_CliLibrary_CSCFLAGS_DEBUG) -debug+ endif -gb_CliLibraryTarget__get_source = $(SRCDIR)/$(1).cs -gb_CliLibraryTarget__get_generated_source = $(WORKDIR)/$(1).cs +gb_CliLibrary__get_source = $(SRCDIR)/$(1).cs +gb_CliLibrary__get_generated_source = $(WORKDIR)/$(1).cs -define gb_CliLibraryTarget__command +define gb_CliLibrary__command $(call gb_Output_announce,$(2),$(true),CSC,3) $(call gb_Helper_abbreviate_dirs,\ csc $(call gb_Helper_windows_path, \ - $(call gb_CliLibraryTarget__get_csflags) \ + $(call gb_CliLibrary__get_csflags) \ $(CLI_CSCFLAGS) \ -target:library \ -out:$(1) \ @@ -49,100 +49,36 @@ $(call gb_Helper_abbreviate_dirs,\ ) endef -$(dir $(call gb_CliLibraryTarget_get_target,%)).dir : - $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) - -$(dir $(call gb_CliLibraryTarget_get_target,%))%/.dir : - $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) - -$(call gb_CliLibraryTarget_get_target,%) : - $(call gb_CliLibraryTarget__command,$@,$*,$<,$?,$^) - -.PHONY : $(call gb_CliLibraryTarget_get_clean_target,%) -$(call gb_CliLibraryTarget_get_clean_target,%) : +.PHONY : $(call gb_CliLibrary_get_clean_target,%) +$(call gb_CliLibrary_get_clean_target,%) : $(call gb_Output_announce,$*,$(false),CSC,3) $(call gb_Helper_abbreviate_dirs,\ - rm -f $(call gb_CliLibraryTarget_get_target,$*) \ + rm -f $(call gb_CliLibrary_get_target,$*) \ ) -# Compiles one or more C# source files -# -# gb_CliLibraryTarget_CliLibraryTarget target -define gb_CliLibraryTarget_CliLibraryTarget -$(call gb_CliLibraryTarget_get_target,$(1)) : CLI_ASSEMBLIES := -$(call gb_CliLibraryTarget_get_target,$(1)) : CLI_SOURCES := -$(call gb_CliLibraryTarget_get_target,$(1)) : CLI_CSCFLAGS := -$(call gb_CliLibraryTarget_get_target,$(1)) : CLI_KEYFILE := - -$(call gb_CliLibraryTarget_get_target,$(1)) :| $(dir $(call gb_CliLibraryTarget_get_target,$(1))).dir - -endef - -define gb_CliLibraryTarget_use_assembly -$(call gb_CliLibraryTarget_get_target,$(1)) : CLI_ASSEMBLIES += $(call gb_CliLibrary_get_target,$(2)) -$(call gb_CliLibraryTarget_get_target,$(1)) : $(call gb_CliLibrary_get_target,$(2)) - -endef - -define gb_CliLibraryTarget_use_assemblies -$(foreach assembly,$(2),$(call gb_CliLibraryTarget_use_assembly,$(1),$(assembly))) - -endef - -# Add a source file to compile -define gb_CliLibraryTarget_add_csfile -$(call gb_CliLibraryTarget_get_target,$(1)) : CLI_SOURCES += $(call gb_CliLibraryTarget__get_source,$(2)) -$(call gb_CliLibraryTarget_get_target,$(1)) : $(call gb_CliLibraryTarget__get_source,$(2)) - -endef - -# Add source files to compile -define gb_CliLibraryTarget_add_csfiles -$(foreach csfile,$(2),$(call gb_CliLibraryTarget_add_csfile,$(1),$(csfile))) - -endef - -# Add a generated source file to compile -define gb_CliLibraryTarget_add_generated_csfile -$(call gb_CliLibraryTarget_get_target,$(1)) : CLI_SOURCES += $(call gb_CliLibraryTarget__get_generated_source,$(2)) -$(call gb_CliLibraryTarget_get_target,$(1)) : $(call gb_CliLibraryTarget__get_generated_source,$(2)) - -endef - -# Add generated source files to compile -define gb_CliLibraryTarget_add_generated_csfiles -$(foreach csfile,$(2),$(call gb_CliLibraryTarget_add_generated_csfile,$(1),$(csfile))) - -endef - -# Add flags used for compilation -define gb_CliLibraryTarget_add_csflags -$(call gb_CliLibraryTarget_get_target,$(1)) : CLI_CSCFLAGS += $(2) - -endef - -# CliLibrary class - -gb_CliLibrary_EXT := $(gb_CliLibraryTarget_EXT) # Compiles one or more C# source files # # gb_CliLibrary_CliLibrary target define gb_CliLibrary_CliLibrary -$(call gb_CliLibraryTarget_CliLibraryTarget,$(1)) $(call gb_CliAssembly_CliAssembly,$(1)) -$(call gb_CliLibrary_get_target,$(1)) : $(call gb_CliLibraryTarget_get_target,$(1)) +$(call gb_CliLibrary_get_target,$(1)) : CLI_ASSEMBLIES := +$(call gb_CliLibrary_get_target,$(1)) : CLI_SOURCES := +$(call gb_CliLibrary_get_target,$(1)) : CLI_CSCFLAGS := +$(call gb_CliLibrary_get_target,$(1)) : CLI_KEYFILE := + + $(call gb_CliLibrary_get_target,$(1)) :| $(call gb_CliAssembly_get_target,$(1)) $(call gb_CliLibrary_get_target,$(1)) :| $(dir $(call gb_CliLibrary_get_target,$(1))).dir -$(call gb_CliLibrary_get_clean_target,$(1)) : $(call gb_CliLibraryTarget_get_clean_target,$(1)) $(call gb_CliLibrary_get_clean_target,$(1)) : $(call gb_CliAssembly_get_clean_target,$(1)) -$(call gb_Deliver_add_deliverable,$(call gb_CliLibrary_get_target,$(1)),$(call gb_CliLibraryTarget_get_target,$(1)),$(1)) - $$(eval $$(call gb_Module_register_target,$(call gb_CliLibrary_get_target,$(1)),$(call gb_CliLibrary_get_clean_target,$(1)))) $(call gb_Helper_make_userfriendly_targets,$(1),CliLibrary) +$(call gb_CliLibrary_get_target,$(1)) : + $$(call gb_CliLibrary__command,$$@,$(1)) + endef define gb_CliLibrary_set_configfile @@ -151,7 +87,7 @@ $(call gb_CliAssembly_set_configfile,$(1),$(2)) endef define gb_CliLibrary_set_keyfile -$(call gb_CliLibraryTarget_get_target,$(1)) : CLI_KEYFILE := $(2) +$(call gb_CliLibrary_get_target,$(1)) : CLI_KEYFILE := $(2) $(call gb_CliAssembly_set_keyfile,$(1),$(2)) endef @@ -162,42 +98,45 @@ $(call gb_CliAssembly_set_policy,$(1),$(2),$(3)) endef define gb_CliLibrary_use_assembly -$(call gb_CliLibraryTarget_use_assembly,$(1),$(2)) +$(call gb_CliLibrary_get_target,$(1)) : CLI_ASSEMBLIES += $(call gb_CliLibrary_get_target,$(2)) +$(call gb_CliLibrary_get_target,$(1)) : $(call gb_CliLibrary_get_target,$(2)) endef define gb_CliLibrary_use_assemblies -$(call gb_CliLibraryTarget_use_assemblies,$(1),$(2)) +$(foreach assembly,$(2),$(call gb_CliLibrary_use_assembly,$(1),$(assembly))) endef # Add a source file to compile define gb_CliLibrary_add_csfile -$(call gb_CliLibraryTarget_add_csfile,$(1),$(2)) +$(call gb_CliLibrary_get_target,$(1)) : CLI_SOURCES += $(call gb_CliLibrary__get_source,$(2)) +$(call gb_CliLibrary_get_target,$(1)) : $(call gb_CliLibrary__get_source,$(2)) endef # Add source files to compile define gb_CliLibrary_add_csfiles -$(call gb_CliLibraryTarget_add_csfiles,$(1),$(2)) +$(foreach csfile,$(2),$(call gb_CliLibrary_add_csfile,$(1),$(csfile))) endef # Add a generated source file to compile define gb_CliLibrary_add_generated_csfile -$(call gb_CliLibraryTarget_add_generated_csfile,$(1),$(2)) +$(call gb_CliLibrary_get_target,$(1)) : CLI_SOURCES += $(call gb_CliLibrary__get_generated_source,$(2)) +$(call gb_CliLibrary_get_target,$(1)) : $(call gb_CliLibrary__get_generated_source,$(2)) endef # Add generated source files to compile define gb_CliLibrary_add_generated_csfiles -$(call gb_CliLibraryTarget_add_generated_csfiles,$(1),$(2)) +$(foreach csfile,$(2),$(call gb_CliLibrary_add_generated_csfile,$(1),$(csfile))) endef # Add flags used for compilation define gb_CliLibrary_add_csflags -$(call gb_CliLibraryTarget_add_csflags,$(1),$(2)) +$(call gb_CliLibrary_get_target,$(1)) : CLI_CSCFLAGS += $(2) endef diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk index dd6658f829fe..ce623304100b 100644 --- a/solenv/gbuild/TargetLocations.mk +++ b/solenv/gbuild/TargetLocations.mk @@ -20,7 +20,7 @@ # outdir target pattern # thoese are hard-coded to URE for now since there are so few of them... -gb_CliLibrary_get_target = $(gb_Helper_OUTDIRLIBDIR)/$(1)$(gb_CliLibrary_EXT) +gb_CliLibrary_get_target = $(INSTROOT)/$(LIBO_URE_LIB_FOLDER)/$(1)$(gb_CliLibrary_EXT) gb_CliNativeLibrary_get_target = $(INSTROOT)/$(LIBO_URE_LIB_FOLDER)/$(1)$(gb_CliNativeLibrary_EXT) gb_CliUnoApi_get_target = $(INSTROOT)/$(LIBO_URE_LIB_FOLDER)/$(1)$(gb_CliUnoApi_EXT) gb_PackagePart_get_destinations = \ @@ -69,7 +69,6 @@ gb_CliAssembly_get_target = $(WORKDIR)/CliAssembly/$(1).done gb_CliAssemblyTarget_get_target = $(WORKDIR)/CliAssemblyTarget/$(1).done gb_CliAssemblyTarget_get_assembly_target = $(WORKDIR)/CliAssemblyTarget/$(1)$(gb_CliAssemblyTarget_POLICYEXT) gb_CliConfigTarget_get_target = $(WORKDIR)/CliConfigTarget/$(1).config -gb_CliLibraryTarget_get_target = $(WORKDIR)/CliLibraryTarget/$(1)$(gb_CliLibraryTarget_EXT) gb_CliNativeLibrary_get_preparation_target = $(WORKDIR)/CliNativeLibraryTarget/$(1).prepare gb_ComponentTarget_get_target = $(WORKDIR)/ComponentTarget/$(1).component gb_ComponentTarget_get_target_for_build = $(WORKDIR_FOR_BUILD)/ComponentTarget/$(1).component @@ -251,7 +250,7 @@ $(eval $(call gb_Helper_make_clean_targets,\ CliAssembly \ CliAssemblyTarget \ CliConfigTarget \ - CliLibraryTarget \ + CliLibrary \ CliNativeLibrary \ CliUnoApi \ ComponentTarget \ @@ -326,7 +325,6 @@ $(eval $(call gb_Helper_make_clean_targets,\ )) $(eval $(call gb_Helper_make_outdir_clean_targets,\ - CliLibrary \ InstallScript \ ))