make/common/Execute.gmk
branchihse-setupexecute-branch
changeset 57158 003703d03633
parent 57155 ba61956ea598
child 57159 0258a6f7d03f
--- a/make/common/Execute.gmk	Wed Feb 06 21:31:36 2019 +0100
+++ b/make/common/Execute.gmk	Thu Feb 07 13:04:38 2019 +0100
@@ -56,27 +56,29 @@
     $$(error COMMAND is missing in SetupExecute $1)
   endif
 
+  ifneq ($$($1_OUTPUT_FILE), )
+    ifneq ($$($1_OUTPUT_DIR), )
+      $$(error Cannot specify both OUTPUT_DIR and OUTPUT_FILE in SetupExecute $1)
+    endif
+    $1_OUTPUT_DIR := $$(patsubst %/,%, $$(dir $$($1_OUTPUT_FILE)))
+  else ifeq ($$($1_OUTPUT_DIR), )
+    $$(error OUTPUT_DIR or OUTPUT_FILE is required in SetupExecute $1)
+  endif
+
   $1_BASE := $$($1_OUTPUT_DIR)/_$1
   $1_MARKER := $$($1_BASE).marker
 
-  ifeq ($$($1_INFO), )
-    $1_INFO := Running commands for $1
-  endif
-
-  ifeq ($$($1_OUTPUT_DIR)$$($1_OUTPUT_FILE), )
-    $$(error OUTPUT_DIR or OUTPUT_FILE is required in SetupExecute $1)
-  endif
-
-  ifneq ($$($1_OUTPUT_DIR), )
-    ifneq ($$($1_OUTPUT_FILE), )
-      $$(error Cannot specify both OUTPUT_DIR and OUTPUT_FILE in SetupExecute $1)
-    endif
+  ifeq ($$($1_OUTPUT_FILE), )
     $1_RESULT := $$($1_MARKER)
   else
     # If we have a single output file, we don't need a separate marker
     $1_RESULT := $$($1_OUTPUT_FILE)
   endif
 
+  ifeq ($$($1_INFO), )
+    $1_INFO := Running commands for $1
+  endif
+
   $$($1_RESULT): $$($1_DEPS)
 	$$(call LogInfo, $$($1_INFO))
 	$$(call MakeDir, $$(@D))