summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-09-21 22:28:20 +0200
committerMichael Stahl <mstahl@redhat.com>2013-09-22 11:08:34 +0200
commitdab82360206549d7c4b8bee76ca55a909d390777 (patch)
tree1ea6c84d3f96cb0f7bf52d372d46f3d311acda4b /solenv
parent3f0ee22ed76d59451ed014adc48185653e59c6a6 (diff)
gbuild: add consistent directory dependencies for LinkTargets
- StaticLibrary and CppunitTest have all files in one directory - Executable may have the executable itself in a different one - Library may have files in up to 3 directories ... so create 2 directories (which may be the same) in gb_LinkTarget_LinkTarget and a 3rd one in gb_Library__Library_impl. This allows to get rid of the "mkdir LinkTarget/pdb/..." thing in the header target rule, which was always ugly since it did not get rebuilt when deleting it (or whole LinkTarget dir) from workdir. Oh and the pattern dependency causes trouble: $(WORKDIR)/LinkTarget/% : $(call gb_LinkTarget_get_headers_target,%) ... for files in ExtensionLibrary; it would be possible to put ExtensionLibrary somewhere else of course but actually this pattern dependency is unnecessary since we get the same thing whenever any object is added to a link target and there shouldn't be link targets without objects anyway. Furthermore directory dependencies must be on the headers_target because MSVC will write a PDB file when compiling objects. Change-Id: Icd92e8768d6aafb094a4144f90165aa5ff233647
Diffstat (limited to 'solenv')
-rw-r--r--solenv/gbuild/Executable.mk3
-rw-r--r--solenv/gbuild/Library.mk13
-rw-r--r--solenv/gbuild/LinkTarget.mk14
-rw-r--r--solenv/gbuild/StaticLibrary.mk2
4 files changed, 20 insertions, 12 deletions
diff --git a/solenv/gbuild/Executable.mk b/solenv/gbuild/Executable.mk
index 433ee0eeba1a..ef632dd33cc6 100644
--- a/solenv/gbuild/Executable.mk
+++ b/solenv/gbuild/Executable.mk
@@ -63,9 +63,6 @@ define gb_Executable__Executable_impl
$(call gb_LinkTarget_LinkTarget,$(2),Executable_$(1),$(call gb_Executable_get_layer,$(1)))
$(call gb_LinkTarget_set_targettype,$(2),Executable)
$(call gb_LinkTarget_add_libs,$(2),$(gb_STDLIBS))
-$(call gb_Executable_get_target,$(1)) : \
- | $(dir $(call gb_Executable_get_target,$(1))).dir \
- $(gb_Executable_BINDIR)/.dir
$(call gb_Executable_get_runtime_target,$(1)) :| $(dir $(call gb_Executable_get_runtime_target,$(1))).dir
$(call gb_Executable_get_runtime_target,$(1)) : $(call gb_Executable_get_target_for_build,$(1))
$(call gb_Executable_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2))
diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk
index a8f3cae8f36b..a09f48aac4b6 100644
--- a/solenv/gbuild/Library.mk
+++ b/solenv/gbuild/Library.mk
@@ -76,6 +76,13 @@ $(call gb_Package_add_file,Library_Copy_$(1),$(2),$(2))
$(OUTDIR)/lib/$(notdir $(2)) : $(gb_INSTROOT)/$(2)
endef
+# Note: there may be targets in 3 different directories: the library itself,
+# the exports target (and other misc. MSVC files) (always in
+# $(WORKDIR)/LinkTarget), and the import library, which may be in SDK;
+# the first 2 are always created by gb_LinkTarget_LinkTarget
+# Also: the directory dependencies must be on the headers_target because
+# MSVC will write a PDB file when compiling objects.
+#
# call gb_Library__Library_impl,library,linktarget
define gb_Library__Library_impl
$(call gb_LinkTarget_LinkTarget,$(2),Library_$(1),$(call gb_Library_get_layer,$(1)))
@@ -86,10 +93,8 @@ $(call gb_LinkTarget_add_defs,$(2),\
)
$(call gb_Library__get_final_target,$(1)) : $(call gb_Library_get_target,$(1))
$(call gb_Library_get_exports_target,$(1)) : $(call gb_Library_get_target,$(1))
-$(call gb_Library_get_target,$(1)) : \
- | $(dir $(call gb_Library_get_target,$(1))).dir \
- $(dir $(call gb_Library_get_ilib_target,$(1))).dir \
- $(gb_Library_DLLDIR)/.dir
+$(call gb_LinkTarget_get_headers_target,$(2)) : \
+ | $(dir $(call gb_Library_get_ilib_target,$(1))).dir
$(call gb_Library_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2))
$(call gb_Library_get_clean_target,$(1)) : AUXTARGETS :=
$(call gb_Library_Library_platform,$(1),$(2),$(call gb_Library_get_ilib_target,$(1)))
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index 277232558777..e05e62a306c9 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -448,7 +448,7 @@ $(WORKDIR)/LinkTarget/Library/%.exports :
# This recipe actually also builds the dep-target as a side-effect, which
# is an optimization to reduce incremental build time.
# (with exception for concat-dep executable itself which does not exist yet...)
-$(WORKDIR)/LinkTarget/% : $(call gb_LinkTarget_get_headers_target,%) $(gb_Helper_MISCDUMMY)
+$(WORKDIR)/LinkTarget/% : $(gb_Helper_MISCDUMMY)
$(call gb_LinkTarget__command_impl,$@,$*)
# call gb_LinkTarget__make_installed_rule,linktarget
@@ -494,11 +494,15 @@ define gb_LinkTarget__get_headers_check
ifneq ($$(SELF),$$*)
$$(eval $$(call gb_Output_info,LinkTarget $$* not defined: Assuming headers to be there!,ALL))
endif
-$$@ : COMMAND := $$(call gb_Helper_abbreviate_dirs, mkdir -p $$(dir $$@) && touch $$@ && mkdir -p $(WORKDIR)/LinkTarget/pdb/$$(dir $$*))
+$$@ : COMMAND := $$(call gb_Helper_abbreviate_dirs, touch $$@)
endef
-$(call gb_LinkTarget_get_headers_target,%) :
+$(WORKDIR)/Headers/%/.dir :
+ $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
+
+# sadly because of the subdirectories can't have pattern deps on .dir here
+$(WORKDIR)/Headers/% :
$(eval $(gb_LinkTarget__get_headers_check))
$(COMMAND)
@@ -542,6 +546,10 @@ define gb_LinkTarget_LinkTarget
$(call gb_LinkTarget_get_clean_target,$(1)) : LINKTARGET := $(1)
$(call gb_LinkTarget_get_clean_target,$(1)) : AUXTARGETS :=
$(call gb_LinkTarget_get_headers_target,$(1)) : SELF := $(call gb_LinkTarget__get_workdir_linktargetname,$(1))
+$(call gb_LinkTarget_get_headers_target,$(1)) : \
+ | $(dir $(call gb_LinkTarget_get_headers_target,$(1))).dir \
+ $(dir $(call gb_LinkTarget_get_target,$(1))).dir \
+ $(dir $(WORKDIR)/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1))).dir
$(call gb_LinkTarget_get_target,$(1)) : ILIBTARGET :=
$(call gb_LinkTarget_get_clean_target,$(1)) \
$(call gb_LinkTarget_get_target,$(1)) : COBJECTS :=
diff --git a/solenv/gbuild/StaticLibrary.mk b/solenv/gbuild/StaticLibrary.mk
index 2b3e6c7daaf5..388e6e283b85 100644
--- a/solenv/gbuild/StaticLibrary.mk
+++ b/solenv/gbuild/StaticLibrary.mk
@@ -42,8 +42,6 @@ endef
define gb_StaticLibrary__StaticLibrary_impl
$(call gb_LinkTarget_LinkTarget,$(2),StaticLibrary_$(1),NONE)
$(call gb_LinkTarget_set_targettype,$(2),StaticLibrary)
-$(call gb_StaticLibrary_get_target,$(1)) : \
- | $(dir $(call gb_StaticLibrary_get_target,$(1))).dir
$(call gb_StaticLibrary_get_clean_target,$(1)) : $(call gb_LinkTarget_get_clean_target,$(2))
$(call gb_StaticLibrary_get_clean_target,$(1)) : AUXTARGETS :=
$(call gb_StaticLibrary_StaticLibrary_platform,$(1),$(2))