8076123: 9-dev build fail: make/Init.gmk:142: *** multiple target patterns. Stop.
authorerikj
Fri, 27 Mar 2015 14:11:26 +0100
changeset 29663 74ff65003536
parent 29662 78c47f0002c3
child 29668 a15171ab2650
8076123: 9-dev build fail: make/Init.gmk:142: *** multiple target patterns. Stop. Reviewed-by: ihse
common/autoconf/basics.m4
common/autoconf/generated-configure.sh
common/autoconf/spec.gmk.in
make/Init.gmk
make/InitSupport.gmk
make/Main.gmk
--- a/common/autoconf/basics.m4	Thu Mar 26 16:17:30 2015 +0100
+++ b/common/autoconf/basics.m4	Fri Mar 27 14:11:26 2015 +0100
@@ -459,12 +459,21 @@
   AC_MSG_RESULT([$TOPDIR])
   AC_SUBST(TOPDIR)
 
+  # Save the original version of TOPDIR for string comparisons
+  ORIGINAL_TOPDIR="$TOPDIR"
+  AC_SUBST(ORIGINAL_TOPDIR)
+
   # We can only call BASIC_FIXUP_PATH after BASIC_CHECK_PATHS_WINDOWS.
   BASIC_FIXUP_PATH(CURDIR)
   BASIC_FIXUP_PATH(TOPDIR)
   # SRC_ROOT is a traditional alias for TOPDIR.
   SRC_ROOT=$TOPDIR
 
+  # Calculate a canonical version of TOPDIR for string comparisons
+  CANONICAL_TOPDIR=$TOPDIR
+  BASIC_REMOVE_SYMBOLIC_LINKS([CANONICAL_TOPDIR])
+  AC_SUBST(CANONICAL_TOPDIR)
+
   # Locate the directory of this script.
   AUTOCONF_DIR=$TOPDIR/common/autoconf
 ])
--- a/common/autoconf/generated-configure.sh	Thu Mar 26 16:17:30 2015 +0100
+++ b/common/autoconf/generated-configure.sh	Fri Mar 27 14:11:26 2015 +0100
@@ -907,6 +907,8 @@
 JVM_INTERPRETER
 JDK_VARIANT
 SET_OPENJDK
+CANONICAL_TOPDIR
+ORIGINAL_TOPDIR
 TOPDIR
 PATH_SEP
 ZERO_ARCHDEF
@@ -4363,7 +4365,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1427382753
+DATE_WHEN_GENERATED=1427461839
 
 ###############################################################################
 #
@@ -14135,6 +14137,10 @@
 $as_echo "$TOPDIR" >&6; }
 
 
+  # Save the original version of TOPDIR for string comparisons
+  ORIGINAL_TOPDIR="$TOPDIR"
+
+
   # We can only call BASIC_FIXUP_PATH after BASIC_CHECK_PATHS_WINDOWS.
 
   # Only process if variable expands to non-empty
@@ -14391,6 +14397,58 @@
   # SRC_ROOT is a traditional alias for TOPDIR.
   SRC_ROOT=$TOPDIR
 
+  # Calculate a canonical version of TOPDIR for string comparisons
+  CANONICAL_TOPDIR=$TOPDIR
+
+  if test "x$OPENJDK_BUILD_OS" != xwindows; then
+    # Follow a chain of symbolic links. Use readlink
+    # where it exists, else fall back to horribly
+    # complicated shell code.
+    if test "x$READLINK_TESTED" != yes; then
+      # On MacOSX there is a readlink tool with a different
+      # purpose than the GNU readlink tool. Check the found readlink.
+      ISGNU=`$READLINK --version 2>&1 | $GREP GNU`
+      if test "x$ISGNU" = x; then
+        # A readlink that we do not know how to use.
+        # Are there other non-GNU readlinks out there?
+        READLINK_TESTED=yes
+        READLINK=
+      fi
+    fi
+
+    if test "x$READLINK" != x; then
+      CANONICAL_TOPDIR=`$READLINK -f $CANONICAL_TOPDIR`
+    else
+      # Save the current directory for restoring afterwards
+      STARTDIR=$PWD
+      COUNTER=0
+      sym_link_dir=`$DIRNAME $CANONICAL_TOPDIR`
+      sym_link_file=`$BASENAME $CANONICAL_TOPDIR`
+      cd $sym_link_dir
+      # Use -P flag to resolve symlinks in directories.
+      cd `$THEPWDCMD -P`
+      sym_link_dir=`$THEPWDCMD -P`
+      # Resolve file symlinks
+      while test $COUNTER -lt 20; do
+        ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'`
+        if test "x$ISLINK" == x; then
+          # This is not a symbolic link! We are done!
+          break
+        fi
+        # Again resolve directory symlinks since the target of the just found
+        # link could be in a different directory
+        cd `$DIRNAME $ISLINK`
+        sym_link_dir=`$THEPWDCMD -P`
+        sym_link_file=`$BASENAME $ISLINK`
+        let COUNTER=COUNTER+1
+      done
+      cd $STARTDIR
+      CANONICAL_TOPDIR=$sym_link_dir/$sym_link_file
+    fi
+  fi
+
+
+
   # Locate the directory of this script.
   AUTOCONF_DIR=$TOPDIR/common/autoconf
 
--- a/common/autoconf/spec.gmk.in	Thu Mar 26 16:17:30 2015 +0100
+++ b/common/autoconf/spec.gmk.in	Fri Mar 27 14:11:26 2015 +0100
@@ -133,6 +133,9 @@
 
 # The top-level directory of the forest (SRC_ROOT is a traditional alias)
 TOPDIR:=@TOPDIR@
+# These two versions of TOPDIR are used in string comparisons
+ORIGINAL_TOPDIR:=@ORIGINAL_TOPDIR@
+CANONICAL_TOPDIR:=@CANONICAL_TOPDIR@
 SRC_ROOT:=@TOPDIR@
 
 OUTPUT_ROOT:=@OUTPUT_ROOT@
--- a/make/Init.gmk	Thu Mar 26 16:17:30 2015 +0100
+++ b/make/Init.gmk	Fri Mar 27 14:11:26 2015 +0100
@@ -52,7 +52,7 @@
 
 # Extract main targets from Main.gmk.
 ifneq ($(any_spec_file), )
-  ifeq ($(wildcard $(dir $(any_spec_file))/make-support),)
+  ifeq ($(wildcard $(dir $(any_spec_file))/make-support/module-deps.gmk),)
     # If make-support does not exist, we need to build the genmodules java tool first.
     $(info Creating data for first make execution in new configuration...)
     ignore_output := $(shell $(MAKE) -r -R -f $(topdir)/make/Main.gmk \
--- a/make/InitSupport.gmk	Thu Mar 26 16:17:30 2015 +0100
+++ b/make/InitSupport.gmk	Fri Mar 27 14:11:26 2015 +0100
@@ -264,8 +264,17 @@
   # Sanity check the spec file, so it matches this source code
   define CheckSpecSanity
     ifneq ($$(topdir), $$(TOPDIR))
-      $$(info Error: SPEC mismatch. $$$$(TOPDIR) does not match current directory.)
-      $$(error Cannot continue)
+      ifneq ($$(topdir), $$(ORIGINAL_TOPDIR))
+        ifneq ($$(topdir), $$(CANONICAL_TOPDIR))
+          $$(info Error: SPEC mismatch! Current working directory)
+          $$(info $$(topdir))
+          $$(info does not match either TOPDIR, ORIGINAL_TOPDIR or CANONICAL_TOPDIR)
+          $$(info $$(TOPDIR))
+          $$(info $$(ORIGINAL_TOPDIR))
+          $$(info $$(CANONICAL_TOPDIR))
+          $$(error Cannot continue)
+        endif
+      endif
     endif
   endef
 
--- a/make/Main.gmk	Thu Mar 26 16:17:30 2015 +0100
+++ b/make/Main.gmk	Fri Mar 27 14:11:26 2015 +0100
@@ -220,7 +220,8 @@
 BOOTCYCLE_TARGET := product-images
 bootcycle-images:
 	@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
-	+$(MAKE) $(MAKE_ARGS) -f Main.gmk SPEC=$(dir $(SPEC))bootcycle-spec.gmk $(BOOTCYCLE_TARGET)
+	+$(MAKE) $(MAKE_ARGS) -f $(SRC_ROOT)/make/Main.gmk \
+	    SPEC=$(dir $(SPEC))bootcycle-spec.gmk $(BOOTCYCLE_TARGET)
 
 zip-security:
 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk)