about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-02-06T09·59+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-02-06T10·30+0100
commit4161fce472a8875427e73776d0e8665ca49c1835 (patch)
treef6f99a40ef0f4e5a742e29a41c8ba3bf3d298e15
parent0da82efa5d67ab1eb8b8cc066704d7f863451d5b (diff)
Create the target directory of libraries and programs
-rw-r--r--install.mk2
-rw-r--r--libraries.mk6
-rw-r--r--programs.mk4
-rw-r--r--tracing.mk1
4 files changed, 9 insertions, 4 deletions
diff --git a/install.mk b/install.mk
index e8543f6b6ab9..8211e43e7d49 100644
--- a/install.mk
+++ b/install.mk
@@ -4,7 +4,7 @@ define create-dir
   ifndef $(1)_SEEN
     $(1)_SEEN = 1
     $(1):
-	$$(trace-install) install -d $(1)
+	$$(trace-mkdir) install -d $(1)
   endif
 endef
 
diff --git a/libraries.mk b/libraries.mk
index 69dede9af418..e1c694cb38c5 100644
--- a/libraries.mk
+++ b/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,7 +66,7 @@ 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)))
@@ -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/programs.mk b/programs.mk
index 74f2982a5f1c..218fd37a3fa4 100644
--- a/programs.mk
+++ b/programs.mk
@@ -22,7 +22,9 @@ 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)
diff --git a/tracing.mk b/tracing.mk
index 08c4ec106656..13912d3c7821 100644
--- a/tracing.mk
+++ b/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  = @