common/makefiles/NativeCompilation.gmk
changeset 14111 2a82ecb35fc7
parent 13697 5262b00bc10c
child 14615 2616975e69d3
--- a/common/makefiles/NativeCompilation.gmk	Wed Jul 05 18:26:51 2017 +0200
+++ b/common/makefiles/NativeCompilation.gmk	Fri Oct 26 14:29:57 2012 -0700
@@ -32,10 +32,10 @@
 endif
 
 ifeq ($(COMPILER_TYPE),CC)
-    COMPILING_MSG=echo Compiling $1
-    LINKING_MSG=echo Linking $1
-    LINKING_EXE_MSG=echo Linking executable $1
-    ARCHIVING_MSG=echo Archiving $1
+    COMPILING_MSG=echo $(LOG_INFO) "Compiling $(notdir $1) (for $(notdir $2))"
+    LINKING_MSG=echo $(LOG_INFO) "Linking $1"
+    LINKING_EXE_MSG=echo $(LOG_INFO) "Linking executable $1"
+    ARCHIVING_MSG=echo $(LOG_INFO) "Archiving $1"
 else
     COMPILING_MSG=
     LINKING_MSG=
@@ -94,7 +94,7 @@
 
         $$($1_$2_OBJ) : $2
         ifeq ($(COMPILER_TYPE),CC)
-		$$(call COMPILING_MSG,$$(notdir $2))
+		$$(call COMPILING_MSG,$2,$$($1_TARGET))
 		$$($1_$2_COMP) $$($1_$2_FLAGS) $$($1_$2_DEP_FLAG) $$($1_$2_DEP) $(CC_OUT_OPTION)$$($1_$2_OBJ) $2
         endif
         ifeq ($(COMPILER_TYPE),CL)
@@ -129,30 +129,8 @@
     #    CC the compiler to use, default is $(CC)
     #    LDEXE the linker to use for linking executables, default is $(LDEXE)
     #    OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST
-    $(if $2,$1_$(strip $2))
-    $(if $3,$1_$(strip $3))
-    $(if $4,$1_$(strip $4))
-    $(if $5,$1_$(strip $5))
-    $(if $6,$1_$(strip $6))
-    $(if $7,$1_$(strip $7))
-    $(if $8,$1_$(strip $8))
-    $(if $9,$1_$(strip $9))
-    $(if $(10),$1_$(strip $(10)))
-    $(if $(11),$1_$(strip $(11)))
-    $(if $(12),$1_$(strip $(12)))
-    $(if $(13),$1_$(strip $(13)))
-    $(if $(14),$1_$(strip $(14)))
-    $(if $(15),$1_$(strip $(15)))
-    $(if $(16),$1_$(strip $(16)))
-    $(if $(17),$1_$(strip $(17)))
-    $(if $(18),$1_$(strip $(18)))
-    $(if $(19),$1_$(strip $(19)))
-    $(if $(20),$1_$(strip $(20)))
-    $(if $(21),$1_$(strip $(21)))
-    $(if $(22),$1_$(strip $(22)))
-    $(if $(23),$1_$(strip $(23)))
-    $(if $(24),$1_$(strip $(24)))
-    $(if $(25),$1_$(strip $(25)))
+    $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
+    $(call LogSetupMacroEntry,SetupNativeCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15),$(16),$(17),$(18),$(19),$(20),$(21),$(22),$(23),$(24),$(25))
     $(if $(26),$(error Internal makefile error: Too many arguments to SetupNativeCompilation, please update NativeCompilation.gmk))
 
     ifneq (,$$($1_BIN))
@@ -236,9 +214,9 @@
         $$(error You have to specify LANG for native compilation $1)
     endif
     ifeq (C,$$($1_LANG))
-    ifeq ($$($1_LDEXE),)
+        ifeq ($$($1_LDEXE),)
 	    $1_LDEXE:=$(LDEXE)
-    endif
+        endif
 	$1_LD:=$(LD)
     else
        ifeq (C++,$$($1_LANG))
@@ -254,9 +232,11 @@
     endif
 
     # Make sure the dirs exist.
-    $$(shell $(MKDIR) -p $$($1_SRC) $$($1_OBJECT_DIR) $$($1_OUTPUT_DIR))
+    $$(eval $$(call MakeDir,$$($1_OBJECT_DIR) $$($1_OUTPUT_DIR)))
+    $$(foreach d,$$($1_SRC), $$(if $$(wildcard $$d),,$$(error SRC specified to SetupNativeCompilation $1 contains missing directory $$d)))
+
     # Find all files in the source trees. Sort to remove duplicates.
-    $1_ALL_SRCS := $$(sort $$(foreach i,$$($1_SRC), $$(shell $(FIND) $$i -type f)))
+    $1_ALL_SRCS := $$(sort $$(shell $(FIND) $$($1_SRC) -type f))
     # Extract the C/C++ files.
     $1_EXCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_EXCLUDE_FILES)))
     $1_INCLUDE_FILES:=$$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_INCLUDE_FILES)))
@@ -291,7 +271,9 @@
     # Are there too many object files on disk? Perhaps because some source file was removed?
     $1_SUPERFLOUS_OBJS:=$$(sort $$(filter-out $$($1_EXPECTED_OBJS),$$($1_BINS)))
     # Clean out the superfluous object files.
-    $$(shell $(RM) -f $$($1_SUPERFLUOUS_OBJS))
+    ifneq ($$($1_SUPERFLUOUS_OBJS),)
+        $$(shell $(RM) -f $$($1_SUPERFLUOUS_OBJS))
+    endif
 
     # Pickup extra OPENJDK_TARGET_OS_API and/or OPENJDK_TARGET_OS dependent variables for CFLAGS.
     $1_EXTRA_CFLAGS:=$$($1_CFLAGS_$(OPENJDK_TARGET_OS_API)) $$($1_CFLAGS_$(OPENJDK_TARGET_OS))
@@ -358,11 +340,6 @@
         $$(error Unknown value for OPTIMIZATION: $$($1_OPTIMIZATION))
     endif
 
-    # Now create a list of the packages that are about to compile. Used when sending source
-    # in a batch to the compiler.
-    $$(shell $(RM) $$($1_OBJECT_DIR)/_the.list_of_sources)
-    $$(eval $$(call ListPathsSafelyNow,$1_SRCS,\n, >> $$($1_OBJECT_DIR)/_the.list_of_sources))
-
     # Now call add_native_source for each source file we are going to compile.
     $$(foreach p,$$($1_SRCS),\
         $$(eval $$(call add_native_source,$1,$$p,$$($1_OBJECT_DIR),\
@@ -385,8 +362,6 @@
     endif
 
     # mapfile doesnt seem to be implemented on macosx (yet??)
-    ifneq ($(OPENJDK_TARGET_CPU),ppc)
-    ifneq ($(OPENJDK_TARGET_CPU),arm)
     ifneq ($(OPENJDK_TARGET_OS),macosx)
     ifneq ($(OPENJDK_TARGET_OS),windows)
         $1_REAL_MAPFILE:=$$($1_MAPFILE)
@@ -401,8 +376,6 @@
         endif
     endif
     endif
-    endif
-    endif
 
     # Pickup extra OPENJDK_TARGET_OS_API and/or OPENJDK_TARGET_OS dependent variables
     # for LDFLAGS and LDFLAGS_SUFFIX
@@ -445,9 +418,9 @@
                     $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET) \
 					$(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
 			$(RM) $$@
-			$(FIX_EMPTY_SEC_HDR_FLAGS) $$<
+			$(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
 			$(OBJCOPY) --only-keep-debug $$< $$@
-			$(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $$(@F) $$<
+			$(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
                 else # not solaris
                     $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET)
 			$(RM) $$@
@@ -523,9 +496,9 @@
                     $$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET) \
 					$(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
 			$(RM) $$@
-			$(FIX_EMPTY_SEC_HDR_FLAGS) $$<
+			$(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
 			$(OBJCOPY) --only-keep-debug $$< $$@
-			$(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $$(@F) $$<
+			$(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
                 else # not solaris
                     $$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET)
 			$(RM) $$@
@@ -564,7 +537,7 @@
 			$$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
 			$$($1_EXTRA_LDFLAGS_SUFFIX)
         ifneq (,$$($1_GEN_MANIFEST))
-		$(MT) -nologo /manifest $$($1_GEN_MANIFEST) /outputresource:$$@;#1
+		$(MT) -nologo -manifest $$($1_GEN_MANIFEST) -outputresource:$$@;#1
         endif
 
     endif