make/common/NativeCompilation.gmk
changeset 32807 20386e6d858f
parent 32720 7e0e586a6817
child 32812 7a2d9c874229
--- a/make/common/NativeCompilation.gmk	Mon Sep 28 09:52:19 2015 +0200
+++ b/make/common/NativeCompilation.gmk	Mon Sep 28 11:39:13 2015 +0200
@@ -211,23 +211,25 @@
 	    $(call LogFailures, $$($1_$2_OBJ).log, $$($1_SAFE_NAME)_$$(notdir $2), \
 	        $$($1_$2_COMP) $$($1_$2_FLAGS) $$($1_$2_DEP_FLAG) $$($1_$2_DEP) $(CC_OUT_OPTION)$$($1_$2_OBJ) $2)
           endif
+          # Create a dependency target file from the dependency file.
+          # Solution suggested by http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
+          ifneq ($$($1_$2_DEP),)
+	    $(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_$2_DEP) > $$($1_$2_DEP_TARGETS)
+          endif
         else
           # The Visual Studio compiler lacks a feature for generating make dependencies, but by
           # setting -showIncludes, all included files are printed. These are filtered out and
           # parsed into make dependences.
+          # Keep as much as possible on one execution line for best performance on Windows
 	  ($(call LogFailures, $$($1_$2_OBJ).log, $$($1_SAFE_NAME)_$$(notdir $2), \
 	      $$($1_$2_COMP) $$($1_$2_FLAGS) -showIncludes $$($1_$2_DEBUG_OUT_FLAGS) \
 	          $(CC_OUT_OPTION)$$($1_$2_OBJ) $2) ; echo $$$$? > $$($1_$2_DEP).exitvalue) \
 	      | $(TEE) $$($1_$2_DEP).raw | $(GREP) -v -e "^Note: including file:" \
 	          -e "^$(notdir $2)$$$$" || test "$$$$?" = "1" ; \
-	      exit `cat $$($1_$2_DEP).exitvalue`
-	  $(RM) $$($1_$2_DEP).exitvalue
-	  ($(ECHO) $$@: \\ \
-	  && $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_$2_DEP).raw) | $(SORT) -u > $$($1_$2_DEP)
-        endif
-        # Create a dependency target file from the dependency file.
-        # Solution suggested by http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
-        ifneq ($$($1_$2_DEP),)
+	      exit `cat $$($1_$2_DEP).exitvalue` ; \
+	  $(RM) $$($1_$2_DEP).exitvalue ; \\
+	  ($(ECHO) $$@: \\ ; \
+	  $(SED) $(WINDOWS_SHOWINCLUDE_SED_PATTERN) $$($1_$2_DEP).raw) | $(SORT) -u > $$($1_$2_DEP) ; \
 	  $(SED) $(DEPENDENCY_TARGET_SED_PATTERN) $$($1_$2_DEP) > $$($1_$2_DEP_TARGETS)
         endif
   endif
@@ -628,6 +630,10 @@
                 "-map:$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map"
             $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb \
                 $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map
+            # No separate command is needed for debuginfo on windows, instead
+            # touch target to make sure it has a later time stamp than the debug
+            # symbol files to avoid unnecessary relinking on rebuild.
+            $1_CREATE_DEBUGINFO_CMDS := $(TOUCH) $$($1_TARGET)
 
           else ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
             $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo
@@ -678,18 +684,13 @@
 
     $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE) \
         $$($1_VARDEPS_FILE)
-		$(ECHO) $(LOG_INFO) "Linking $$($1_BASENAME)"
+		$(ECHO) $(LOG_INFO) "Linking $$($1_BASENAME)" ; \
 		$(call LogFailures, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link.log, $$($1_SAFE_NAME)_link, \
 		    $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $$($1_SYSROOT_LDFLAGS) \
 		    $(LD_OUT_OPTION)$$@ \
 		    $$($1_EXPECTED_OBJS) $$($1_RES) \
-		    $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX))
+		    $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX)) ; \
 		$$($1_CREATE_DEBUGINFO_CMDS)
-                # Touch target to make sure it has a later time stamp than the debug
-                # symbol files to avoid unnecessary relinking on rebuild.
-                ifeq ($(OPENJDK_TARGET_OS), windows)
-		  $(TOUCH) $$@
-                endif
 
   endif
 
@@ -719,7 +720,7 @@
 
     $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_MANIFEST) \
         $$($1_VARDEPS_FILE)
-		$(ECHO) $(LOG_INFO) "Linking executable $$($1_BASENAME)"
+		$(ECHO) $(LOG_INFO) "Linking executable $$($1_BASENAME)" ; \
 		$(call LogFailures, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link.log, $$($1_SAFE_NAME)_link, \
 		    $$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $$($1_SYSROOT_LDFLAGS) \
 		        $(EXE_OUT_OPTION)$$($1_TARGET) \
@@ -738,11 +739,6 @@
                   endif
                 endif
 		$$($1_CREATE_DEBUGINFO_CMDS)
-                # Touch target to make sure it has a later time stamp than the debug
-                # symbol files to avoid unnecessary relinking on rebuild.
-                ifeq ($(OPENJDK_TARGET_OS), windows)
-		  $(TOUCH) $$@
-                endif
 
   endif
 endef