summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--solenv/gbuild/Helper.mk7
-rw-r--r--solenv/gbuild/platform/com_MSC_class.mk6
-rw-r--r--solenv/gbuild/platform/macosx.mk7
-rw-r--r--solenv/gbuild/platform/solaris.mk7
-rw-r--r--solenv/gbuild/platform/unxgcc.mk7
5 files changed, 14 insertions, 20 deletions
diff --git a/solenv/gbuild/Helper.mk b/solenv/gbuild/Helper.mk
index 0c0c3b2d613d..93ff03ef5737 100644
--- a/solenv/gbuild/Helper.mk
+++ b/solenv/gbuild/Helper.mk
@@ -197,6 +197,13 @@ gb_Package_MODULE_$(1) += $(2)
endef
+# call gb_Helper_replace_if_different_and_touch,source,target,optional-touch-reference-file
+define gb_Helper_replace_if_different_and_touch
+if cmp -s $(1) $(2); then rm $(1); \
+else mv $(1) $(2) $(if $(3),&& touch -r $(3) $(2)); \
+fi
+endef
+
define gb_Helper_define_if_set
$(foreach def,$(1),$(if $(filter TRUE YES,$($(def))),-D$(def)))
endef
diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk
index e0fa5b554f32..6a77d207f41b 100644
--- a/solenv/gbuild/platform/com_MSC_class.mk
+++ b/solenv/gbuild/platform/com_MSC_class.mk
@@ -189,11 +189,7 @@ $(call gb_Helper_abbreviate_dirs,\
$(if $(filter YES,$(LIBRARY_X64)),$(LINK_X64_BINARY),$(gb_LINK)) \
-dump -exports $(ILIBTARGET) \
>> $(WORKDIR)/LinkTarget/$(2).exports.tmp && \
- if cmp -s $(WORKDIR)/LinkTarget/$(2).exports.tmp $(WORKDIR)/LinkTarget/$(2).exports; \
- then rm $(WORKDIR)/LinkTarget/$(2).exports.tmp; \
- else mv $(WORKDIR)/LinkTarget/$(2).exports.tmp $(WORKDIR)/LinkTarget/$(2).exports && \
- touch -r $(1) $(WORKDIR)/LinkTarget/$(2).exports; \
- fi) \
+ $(call gb_Helper_replace_if_different_and_touch,$(WORKDIR)/LinkTarget/$(2).exports.tmp,$(WORKDIR)/LinkTarget/$(2).exports,$(1)) \
; exit $$RC)
endef
diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk
index 96624b8edb81..5eac8ba43114 100644
--- a/solenv/gbuild/platform/macosx.mk
+++ b/solenv/gbuild/platform/macosx.mk
@@ -158,11 +158,8 @@ $(call gb_Helper_abbreviate_dirs,\
> $(WORKDIR)/LinkTarget/$(2).exports.tmp && \
$(NM) -g -P $(1) | cut -d' ' -f1-2 | grep -v U$$ \
>> $(WORKDIR)/LinkTarget/$(2).exports.tmp && \
- if cmp -s $(WORKDIR)/LinkTarget/$(2).exports.tmp $(WORKDIR)/LinkTarget/$(2).exports; \
- then rm $(WORKDIR)/LinkTarget/$(2).exports.tmp; \
- else mv $(WORKDIR)/LinkTarget/$(2).exports.tmp $(WORKDIR)/LinkTarget/$(2).exports && \
- touch -r $(1) $(WORKDIR)/LinkTarget/$(2).exports; \
- fi &&) \
+ $(call gb_Helper_replace_if_different_and_touch,$(WORKDIR)/LinkTarget/$(2).exports.tmp, \
+ $(WORKDIR)/LinkTarget/$(2).exports,$(1)) &&) \
:)
endef
diff --git a/solenv/gbuild/platform/solaris.mk b/solenv/gbuild/platform/solaris.mk
index 7f1ce40018d5..61221906dc3b 100644
--- a/solenv/gbuild/platform/solaris.mk
+++ b/solenv/gbuild/platform/solaris.mk
@@ -186,11 +186,8 @@ $(call gb_Helper_abbreviate_dirs,\
$(NM) --dynamic --extern-only --defined-only --format=posix $(1) \
| cut -d' ' -f1-2 \
>> $(WORKDIR)/LinkTarget/$(2).exports.tmp && \
- if cmp -s $(WORKDIR)/LinkTarget/$(2).exports.tmp $(WORKDIR)/LinkTarget/$(2).exports; \
- then rm $(WORKDIR)/LinkTarget/$(2).exports.tmp; \
- else mv $(WORKDIR)/LinkTarget/$(2).exports.tmp $(WORKDIR)/LinkTarget/$(2).exports && \
- touch -r $(1) $(WORKDIR)/LinkTarget/$(2).exports; \
- fi))
+ $(call gb_Helper_replace_if_different_and_touch,$(WORKDIR)/LinkTarget/$(2).exports.tmp, \
+ $(WORKDIR)/LinkTarget/$(2).exports,$(1))))
endef
define gb_LinkTarget__command_staticlink
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index 86be4061ae7a..17a6a033c017 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -187,11 +187,8 @@ $(call gb_Helper_abbreviate_dirs,\
$(NM) --dynamic --extern-only --defined-only --format=posix $(1) \
| cut -d' ' -f1-2 \
>> $(WORKDIR)/LinkTarget/$(2).exports.tmp && \
- if cmp -s $(WORKDIR)/LinkTarget/$(2).exports.tmp $(WORKDIR)/LinkTarget/$(2).exports; \
- then rm $(WORKDIR)/LinkTarget/$(2).exports.tmp; \
- else mv $(WORKDIR)/LinkTarget/$(2).exports.tmp $(WORKDIR)/LinkTarget/$(2).exports && \
- touch -r $(1) $(WORKDIR)/LinkTarget/$(2).exports; \
- fi))
+ $(call gb_Helper_replace_if_different_and_touch,$(WORKDIR)/LinkTarget/$(2).exports.tmp, \
+ $(WORKDIR)/LinkTarget/$(2).exports,$(1))))
endef
define gb_LinkTarget__command_staticlink