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
This commit is contained in:
Michael Stahl 2013-10-28 11:01:50 +01:00
parent 6bd0f9ba9d
commit 968c735aa7
6 changed files with 41 additions and 104 deletions

View file

@ -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 \

View file

@ -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 \
))

View file

@ -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 \
))

View file

@ -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:

View file

@ -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

View file

@ -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 \
))