7012644: Regression: jdk/make/common/shared/Defs-windows.gmk has problems on cygwin
authorohair
Thu, 10 Feb 2011 20:45:13 -0800
changeset 8201 9e6915af34ba
parent 8052 7da3f5f30855
child 8202 0565a3bdff9d
child 8384 3804a97b58c0
7012644: Regression: jdk/make/common/shared/Defs-windows.gmk has problems on cygwin 7018835: Debug build issues in jdk makefiles Reviewed-by: ksrini
jdk/make/common/shared/Defs-windows.gmk
jdk/make/common/shared/Defs.gmk
jdk/make/common/shared/Platform.gmk
--- a/jdk/make/common/shared/Defs-windows.gmk	Wed Jul 05 17:33:49 2017 +0200
+++ b/jdk/make/common/shared/Defs-windows.gmk	Thu Feb 10 20:45:13 2011 -0800
@@ -86,17 +86,25 @@
 #
 
 ifdef USING_CYGWIN
+# Macro to effectively do a toupper without an exec
+define ToUpper
+$(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,\
+$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,\
+$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,\
+$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,\
+$(subst y,Y,$(subst z,Z,$1))))))))))))))))))))))))))
+endef
 # All possible drive letters
 drives=a b c d e f g h i j k l m n o p q r s t v u w x y z
 # Convert /cygdrive/ paths to the mixed style without an exec of cygpath
-#   Must be a path with no spaces.
+#   Must be a path with no spaces. /cygdrive/letter is always lowercase
+#   and letter:/ is always uppercase coming from cygpath.
 define MixedPath
-$(patsubst /%,c:/cygwin/%,$(sort $(filter-out /cygdrive/%,$(foreach drive,$(drives),$(patsubst /cygdrive/$(drive)/%,$(drive):/%,$1)))))
+$(patsubst /%,$(CYGWIN_HOME)/%,$(sort $(filter-out /cygdrive/%,$(foreach drive,$(drives),$(patsubst /cygdrive/$(drive)/%,$(call ToUpper,$(drive)):/%,$1)))))
 endef
 # Use FullPath to get C:/ style non-spaces path. Never ends with a /!
 # We assume cygpath is available in the search path
 #    NOTE: Use of 'pwd' with CYGWIN will not get you a mixed style path!
-CYGPATH_CMD=cygpath -a -s -m
 define FullPath
 $(if $(word 2,$1),$(shell $(CYGPATH_CMD) $1 2> $(DEV_NULL)),$(call MixedPath,$(realpath $(subst ",,$1))))
 endef
@@ -125,10 +133,15 @@
 
 # UNIXCOMMAND_PATH: path to where the most common Unix commands are.
 #  NOTE: Must end with / so that it could be empty, allowing PATH usage.
+#        With cygwin, just use this as is don't use FullPath on it.
 ifdef ALT_UNIXCOMMAND_PATH
-  xALT_UNIXCOMMAND_PATH  :="$(subst \,/,$(ALT_UNIXCOMMAND_PATH))"
-  fxALT_UNIXCOMMAND_PATH :=$(call FullPath,$(xALT_UNIXCOMMAND_PATH))
-  UNIXCOMMAND_PATH       :=$(call PrefixPath,$(fxALT_UNIXCOMMAND_PATH))
+  ifdef USING_CYGWIN
+    UNIXCOMMAND_PATH       :=$(call PrefixPath,$(ALT_UNIXCOMMAND_PATH))
+  else
+    xALT_UNIXCOMMAND_PATH  :="$(subst \,/,$(ALT_UNIXCOMMAND_PATH))"
+    fxALT_UNIXCOMMAND_PATH :=$(call FullPath,$(xALT_UNIXCOMMAND_PATH))
+    UNIXCOMMAND_PATH       :=$(call PrefixPath,$(fxALT_UNIXCOMMAND_PATH))
+  endif
 else
   ifdef USING_CYGWIN
     UNIXCOMMAND_PATH :=$(call PrefixPath,/usr/bin)
@@ -459,9 +472,11 @@
 endif
 
 # SLASH_JAVA: location of all network accessable files
+# NOTE: Do not use FullPath on this because it's often a drive letter and
+#       plain drive letters are ambiguous, so just use this 'as is'.
 ifdef ALT_SLASH_JAVA
   xALT_SLASH_JAVA :="$(subst \,/,$(ALT_SLASH_JAVA))"
-  SLASH_JAVA      :=$(call FullPath,$(xALT_SLASH_JAVA))
+  SLASH_JAVA      :=$(xALT_SLASH_JAVA)
 else
   ifdef ALT_JDK_JAVA_DRIVE
     SLASH_JAVA  =$(JDK_JAVA_DRIVE)
@@ -751,7 +766,11 @@
 #   we do not or cannot redistribute.
 
 # List of filenames we should NOT be dependent on
-BANNED_DLLS=msvcp100[.]dll|msvcr100d[.]dll|msvcrtd[.]dll
+ifeq ($(MFC_DEBUG),true)
+  BANNED_DLLS=msvcp100[.]dll
+else
+  BANNED_DLLS=msvcp100[.]dll|msvcr100d[.]dll|msvcrtd[.]dll
+endif
 
 # Macro to check it's input file for banned dependencies and verify the
 #   binary was built properly. Relies on process exit code.
@@ -771,7 +790,7 @@
   fi ; \
   $(ECHO) "Checking for banned dependencies in: $1" && \
   if [ "`$(DUMPBIN) /dependents $1 | $(EGREP) -i '$(BANNED_DLLS)'`" != "" ] ; then \
-    $(ECHO) "ERROR: Found us of $(BANNED_DLLS)"; \
+    $(ECHO) "ERROR: Found use of $(BANNED_DLLS)"; \
     $(DUMPBIN) /dependents $1 ; \
     exit 9 ; \
   fi ; \
--- a/jdk/make/common/shared/Defs.gmk	Wed Jul 05 17:33:49 2017 +0200
+++ b/jdk/make/common/shared/Defs.gmk	Thu Feb 10 20:45:13 2011 -0800
@@ -54,11 +54,12 @@
 # Assumes ARCH, PLATFORM, ARCH_VM_SUBDIR, JDK_TOPDIR, etc. have been defined.
 
 # Simple pwd path
+# NOTE: Just use the shell's cd and pwd here, more reliable at sanity time.
 define PwdPath
-$(shell $(CD) $1 2> $(DEV_NULL) && $(PWD))
+$(shell cd $1 2> $(DEV_NULL) && pwd)
 endef
 define AbsPwdPathCheck
-$(shell $(CD) .. 2> $(DEV_NULL) && $(CD) $1 2> $(DEV_NULL) && $(PWD))
+$(shell cd .. 2> $(DEV_NULL) && cd $1 2> $(DEV_NULL) && pwd)
 endef
 
 # Checks an ALT value for spaces (should be one word), 
--- a/jdk/make/common/shared/Platform.gmk	Wed Jul 05 17:33:49 2017 +0200
+++ b/jdk/make/common/shared/Platform.gmk	Thu Feb 10 20:45:13 2011 -0800
@@ -72,7 +72,11 @@
 #     USING_CYGWIN                windows only: true or false
 #     ISHIELD_TEMP_MIN            windows only: minimum disk space in temp area
 
-SYSTEM_UNAME := $(shell uname)
+# Only run uname once in this make session.
+ifndef SYSTEM_UNAME
+  SYSTEM_UNAME := $(shell uname)
+  export SYSTEM_UNAME
+endif
 
 #
 # Prune out all known SCM (Source Code Management) directories
@@ -222,6 +226,12 @@
   PLATFORM = windows
   USING_CYGWIN = true
   export USING_CYGWIN
+  CYGPATH_CMD=cygpath -a -s -m
+  # Only run "cygpath /" once in this make session.
+  ifndef CYGWIN_HOME
+    CYGWIN_HOME := $(shell $(CYGPATH_CMD) /)
+    export CYGWIN_HOME
+  endif
 endif
 
 # Platform settings specific to Windows
@@ -235,7 +245,12 @@
   #  And sometimes PROCESSOR_IDENTIFIER is not defined at all
   #  (in some restricted shells), so we use uname if we have to.
   ifeq ($(PROCESSOR_IDENTIFIER),)
-    PROC_ARCH:=$(shell uname -m)
+    # Only run uname -m once in this make session.
+    ifndef SYSTEM_UNAME_M
+      SYSTEM_UNAME_M := $(shell uname -m)
+      export SYSTEM_UNAME_M
+    endif
+    PROC_ARCH:=$(SYSTEM_UNAME_M)
   else
     PROC_ARCH:=$(word 1, $(PROCESSOR_IDENTIFIER))
   endif