diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-02-07T15·27+0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-02-07T15·27+0100 |
commit | 764d90597a2ef9f5f5a5041993b728e020fb08b0 (patch) | |
tree | 1539f267f6c6368943cc8c19d5b66433ccd9fbd4 | |
parent | 2a469ad31da7cac5c4ecab6838c364956319821f (diff) | |
parent | a210c995cdd9279ed4137ec5d2e4cc928cb36097 (diff) |
Merge commit 'a210c995cdd9279ed4137ec5d2e4cc928cb36097'
-rw-r--r-- | mk/install.mk | 29 | ||||
-rw-r--r-- | mk/libraries.mk | 14 | ||||
-rw-r--r-- | mk/programs.mk | 12 | ||||
-rw-r--r-- | mk/tests.mk | 3 | ||||
-rw-r--r-- | mk/tracing.mk | 1 |
5 files changed, 33 insertions, 26 deletions
diff --git a/mk/install.mk b/mk/install.mk index e8543f6b6ab9..e4bc734e11fb 100644 --- a/mk/install.mk +++ b/mk/install.mk @@ -1,10 +1,11 @@ # Add a rule for creating $(1) as a directory. This template may be # called multiple times for the same directory. define create-dir - ifndef $(1)_SEEN - $(1)_SEEN = 1 - $(1): - $$(trace-install) install -d $(1) + _i := $(DESTDIR)$$(strip $(1)) + ifndef $$(_i)_SEEN + $$(_i)_SEEN = 1 + $$(_i): + $$(trace-mkdir) install -d "$$@" endif endef @@ -13,12 +14,14 @@ endef # The directory containing $(2) will be created automatically. define install-file-as - install: $(2) + _i := $(DESTDIR)$$(strip $(2)) - $$(eval $$(call create-dir,$$(dir $(2)))) + install: $$(_i) - $(2): $(1) | $$(dir $(2)) - $$(trace-install) install -m $(3) $(1) $(2) + $$(_i): $(1) | $$(dir $$(_i)) + $$(trace-install) install -m $(3) $(1) "$$@" + + $$(eval $$(call create-dir, $$(dir $(2)))) endef @@ -43,12 +46,14 @@ endef # Install a symlink from $(2) to $(1). Note that $(1) need not exist. define install-symlink - install: $(2) + _i := $(DESTDIR)$$(strip $(2)) + + install: $$(_i) - $$(eval $$(call create-dir,$$(dir $(2)))) + $$(_i): | $$(dir $$(_i)) + $$(trace-install) ln -sfn $(1) "$$@" - $(2): | $$(dir $(2)) - $$(trace-install) ln -sfn $(1) $(2) + $$(eval $$(call create-dir, $$(dir $(2)))) endef diff --git a/mk/libraries.mk b/mk/libraries.mk index 69dede9af418..c41694794b60 100644 --- a/mk/libraries.mk +++ b/mk/libraries.mk @@ -50,6 +50,8 @@ define build-library $(1)_LDFLAGS_USE := $(1)_LDFLAGS_USE_INSTALLED := + $$(eval $$(call create-dir, $$(_d))) + ifeq ($(BUILD_SHARED_LIBS), 1) ifdef $(1)_ALLOW_UNDEFINED @@ -64,21 +66,21 @@ define build-library $(1)_PATH := $$(_d)/$$($(1)_NAME).$(SO_EXT) - $$($(1)_PATH): $$($(1)_OBJS) $$(_libs) + $$($(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))) - $(1)_INSTALL_PATH := $$($(1)_INSTALL_DIR)/$$($(1)_NAME).$(SO_EXT) + $(1)_INSTALL_PATH := $(DESTDIR)$$($(1)_INSTALL_DIR)/$$($(1)_NAME).$(SO_EXT) _libs_final := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_INSTALL_PATH)) - $$(eval $$(call create-dir,$$($(1)_INSTALL_DIR))) + $$(eval $$(call create-dir, $$($(1)_INSTALL_DIR))) - $$($(1)_INSTALL_PATH): $$($(1)_OBJS) $$(_libs_final) | $$($(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$$($(1)_INSTALL_DIR) -Wl,-rpath,$$($(1)_INSTALL_DIR) -l$$(patsubst lib%,%,$$(strip $$($(1)_NAME))) + $(1)_LDFLAGS_USE_INSTALLED += -L$$(DESTDIR)$$($(1)_INSTALL_DIR) -Wl,-rpath,$$($(1)_INSTALL_DIR) -l$$(patsubst lib%,%,$$(strip $$($(1)_NAME))) ifdef $(1)_FORCE_INSTALL install: $$($(1)_INSTALL_PATH) @@ -88,7 +90,7 @@ define build-library $(1)_PATH := $$(_d)/$$($(1)_NAME).a - $$($(1)_PATH): $$($(1)_OBJS) + $$($(1)_PATH): $$($(1)_OBJS) | $$(_d) $(trace-ar) ar crs $$@ $$? $(1)_LDFLAGS_USE += $$($(1)_PATH) $$($(1)_LDFLAGS) diff --git a/mk/programs.mk b/mk/programs.mk index 74f2982a5f1c..ab04ff93e910 100644 --- a/mk/programs.mk +++ b/mk/programs.mk @@ -22,26 +22,28 @@ define build-program _libs := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_PATH)) $(1)_PATH := $$(_d)/$(1) - $$($(1)_PATH): $$($(1)_OBJS) $$(_libs) + $$(eval $$(call create-dir, $$(_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) $(1)_INSTALL_PATH := $$($(1)_INSTALL_DIR)/$(1) - $$(eval $$(call create-dir,$$($(1)_INSTALL_DIR))) + $$(eval $$(call create-dir, $$($(1)_INSTALL_DIR))) - install: $$($(1)_INSTALL_PATH) + install: $(DESTDIR)$$($(1)_INSTALL_PATH) ifeq ($(BUILD_SHARED_LIBS), 1) _libs_final := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_INSTALL_PATH)) - $$($(1)_INSTALL_PATH): $$($(1)_OBJS) $$(_libs_final) | $$($(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 - $$($(1)_INSTALL_PATH): $$($(1)_PATH) | $$($(1)_INSTALL_DIR) + $(DESTDIR)$$($(1)_INSTALL_PATH): $$($(1)_PATH) | $(DESTDIR)$$($(1)_INSTALL_DIR) install -t $$($(1)_INSTALL_DIR) $$< endif diff --git a/mk/tests.mk b/mk/tests.mk index 6bdb4e57739e..004a48028616 100644 --- a/mk/tests.mk +++ b/mk/tests.mk @@ -3,9 +3,6 @@ define run-install-test installcheck: $1 - # Run the test in its own directory to mimick Automake behaviour. - $1.run: $1 $(_PREV_TEST) - _installcheck-list += $1 endef diff --git a/mk/tracing.mk b/mk/tracing.mk index 08c4ec106656..13912d3c7821 100644 --- a/mk/tracing.mk +++ b/mk/tracing.mk @@ -10,6 +10,7 @@ ifeq ($(V), 0) trace-install = @echo " INST " $@; trace-javac = @echo " JAVAC " $@; trace-jar = @echo " JAR " $@; + trace-mkdir = @echo " MKDIR " $@; suppress = @ |