From 7bef965d6f191efb9c671f49fd187f4214db6120 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 18 Feb 2014 13:35:35 +0100 Subject: [PATCH] Make it work on GNU Make > 3.81 again --- functions.mk | 2 +- install.mk | 2 +- libraries.mk | 6 +++--- programs.mk | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/functions.mk b/functions.mk index c92cdbc54e..45d9173993 100644 --- a/functions.mk +++ b/functions.mk @@ -11,4 +11,4 @@ filename-to-dep = $(dir $1).$(notdir $1).dep find-program = $(shell for i in $$(IFS=: ; echo $$PATH); do p=$$i/$(strip $1); if [ -e $$p ]; then echo $$p; break; fi; done) # Remove trailing slash. -remove-trailing-slash = $(patsubst %/,%,$(1)) +add-trailing-slash = $(patsubst %/,%,$(1))/ diff --git a/install.mk b/install.mk index 0fe4cf938d..dad0fd8533 100644 --- a/install.mk +++ b/install.mk @@ -1,7 +1,7 @@ # Add a rule for creating $(1) as a directory. This template may be # called multiple times for the same directory. define create-dir - _i := $$(call remove-trailing-slash, $(DESTDIR)$$(strip $(1))) + _i := $$(call add-trailing-slash, $(DESTDIR)$$(strip $(1))) ifndef $$(_i)_SEEN $$(_i)_SEEN = 1 $$(_i): diff --git a/libraries.mk b/libraries.mk index 35ce4983a1..21718c496a 100644 --- a/libraries.mk +++ b/libraries.mk @@ -68,7 +68,7 @@ define build-library $(1)_PATH := $$(_d)/$$($(1)_NAME).$(SO_EXT) - $$($(1)_PATH): $$($(1)_OBJS) $$(_libs) | $$(_d) + $$($(1)_PATH): $$($(1)_OBJS) $$(_libs) | $$(_d)/ $$(trace-ld) $(CXX) -o $$@ -shared $(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE)) $(1)_LDFLAGS_USE += -L$$(_d) -Wl,-rpath,$$(abspath $$(_d)) -l$$(patsubst lib%,%,$$(strip $$($(1)_NAME))) @@ -79,7 +79,7 @@ define build-library $$(eval $$(call create-dir, $$($(1)_INSTALL_DIR))) - $$($(1)_INSTALL_PATH): $$($(1)_OBJS) $$(_libs_final) | $(DESTDIR)$$($(1)_INSTALL_DIR) + $$($(1)_INSTALL_PATH): $$($(1)_OBJS) $$(_libs_final) | $(DESTDIR)$$($(1)_INSTALL_DIR)/ $$(trace-ld) $(CXX) -o $$@ -shared $(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED)) $(1)_LDFLAGS_USE_INSTALLED += -L$$(DESTDIR)$$($(1)_INSTALL_DIR) -Wl,-rpath,$$($(1)_INSTALL_DIR) -l$$(patsubst lib%,%,$$(strip $$($(1)_NAME))) @@ -92,7 +92,7 @@ define build-library $(1)_PATH := $$(_d)/$$($(1)_NAME).a - $$($(1)_PATH): $$($(1)_OBJS) | $$(_d) + $$($(1)_PATH): $$($(1)_OBJS) | $$(_d)/ $(trace-ar) ar crs $$@ $$? $(1)_LDFLAGS_USE += $$($(1)_PATH) $$($(1)_LDFLAGS) diff --git a/programs.mk b/programs.mk index 5e27a7d62f..04ba282b2c 100644 --- a/programs.mk +++ b/programs.mk @@ -28,7 +28,7 @@ define build-program $$(eval $$(call create-dir, $$(_d))) - $$($(1)_PATH): $$($(1)_OBJS) $$(_libs) | $$(_d) + $$($(1)_PATH): $$($(1)_OBJS) $$(_libs) | $$(_d)/ $$(trace-ld) $(CXX) -o $$@ $(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE)) $(1)_INSTALL_DIR ?= $$(bindir) @@ -42,12 +42,12 @@ define build-program _libs_final := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_INSTALL_PATH)) - $(DESTDIR)$$($(1)_INSTALL_PATH): $$($(1)_OBJS) $$(_libs_final) | $(DESTDIR)$$($(1)_INSTALL_DIR) + $(DESTDIR)$$($(1)_INSTALL_PATH): $$($(1)_OBJS) $$(_libs_final) | $(DESTDIR)$$($(1)_INSTALL_DIR)/ $$(trace-ld) $(CXX) -o $$@ $(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED)) else - $(DESTDIR)$$($(1)_INSTALL_PATH): $$($(1)_PATH) | $(DESTDIR)$$($(1)_INSTALL_DIR) + $(DESTDIR)$$($(1)_INSTALL_PATH): $$($(1)_PATH) | $(DESTDIR)$$($(1)_INSTALL_DIR)/ install -t $$($(1)_INSTALL_DIR) $$< endif