make/common/NativeCompilation.gmk
changeset 50128 ea4e6d3dbf60
parent 49566 7c224ec572d0
child 51095 a8ee31fb99e1
child 56687 f0d5c39dfbc1
child 56723 d927981eeb64
child 56726 3a9b7a1f9197
--- a/make/common/NativeCompilation.gmk	Wed May 16 18:03:20 2018 +0200
+++ b/make/common/NativeCompilation.gmk	Wed May 16 09:37:00 2018 -0700
@@ -391,6 +391,13 @@
 #   STRIPFLAGS Optionally change the flags given to the strip command
 #   PRECOMPILED_HEADER Header file to use as precompiled header
 #   PRECOMPILED_HEADER_EXCLUDE List of source files that should not use PCH
+#
+# After being called, some variables are exported from this macro, all prefixed
+# with parameter 1 followed by a '_':
+#   TARGET The library or executable created by the macro
+#   TARGET_DEPS All prerequisites for the target calculated by the macro
+#   ALL_OBJS All object files
+#   IMPORT_LIBRARY The import library created for a shared library on Windows
 SetupNativeCompilation = $(NamedParamsMacroTemplate)
 define SetupNativeCompilationBody
 
@@ -874,7 +881,9 @@
       endif
     endif
 
-    $$($1_TARGET): $$($1_ALL_OBJS) $$($1_RES) $$($1_VARDEPS_FILE) $$(STATIC_MAPFILE_DEP)
+    $1_TARGET_DEPS := $$($1_ALL_OBJS) $$($1_RES) $$($1_VARDEPS_FILE) $$(STATIC_MAPFILE_DEP)
+
+    $$($1_TARGET): $$($1_TARGET_DEPS)
 	$$(call LogInfo, Building static library $$($1_BASENAME))
 	$$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link, \
 	    $$($1_AR) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_ALL_OBJS) \
@@ -964,8 +973,10 @@
       endif
     endif
 
-    $$($1_TARGET): $$($1_ALL_OBJS) $$($1_RES) $$($1_MANIFEST) \
+    $1_TARGET_DEPS := $$($1_ALL_OBJS) $$($1_RES) $$($1_MANIFEST) \
         $$($1_REAL_MAPFILE) $$($1_VARDEPS_FILE)
+
+    $$($1_TARGET): $$($1_TARGET_DEPS)
                 ifneq ($$($1_OBJ_FILE_LIST), )
                   ifeq ($$($1_LINK_OBJS_RELATIVE), true)
 		    $$(eval $$(call ListPathsSafely, $1_ALL_OBJS_RELATIVE, $$($1_OBJ_FILE_LIST)))