Wed, 22 Feb 2012 09:24:35 +0100
7141244: build-infra merge: Include $(SPEC) in makefiles and make variables overridable
Reviewed-by: dholmes, ohrstrom, ohair, jcoomes
1.1 --- a/make/bsd/makefiles/buildtree.make Wed Feb 22 10:32:29 2012 -0800 1.2 +++ b/make/bsd/makefiles/buildtree.make Wed Feb 22 09:24:35 2012 +0100 1.3 @@ -58,6 +58,7 @@ 1.4 # needs to be set here since this Makefile doesn't include defs.make 1.5 OS_VENDOR:=$(shell uname -s) 1.6 1.7 +-include $(SPEC) 1.8 include $(GAMMADIR)/make/scm.make 1.9 include $(GAMMADIR)/make/altsrc.make 1.10 1.11 @@ -247,6 +248,8 @@ 1.12 echo "HOTSPOT_EXTRA_SYSDEFS\$$(HOTSPOT_EXTRA_SYSDEFS) = $(HOTSPOT_EXTRA_SYSDEFS)" && \ 1.13 echo "SYSDEFS += \$$(HOTSPOT_EXTRA_SYSDEFS)"; \ 1.14 echo; \ 1.15 + [ -n "$(SPEC)" ] && \ 1.16 + echo "include $(SPEC)"; \ 1.17 echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(VARIANT).make"; \ 1.18 echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(COMPILER).make"; \ 1.19 ) > $@
2.1 --- a/make/bsd/makefiles/gcc.make Wed Feb 22 10:32:29 2012 -0800 2.2 +++ b/make/bsd/makefiles/gcc.make Wed Feb 22 09:24:35 2012 +0100 2.3 @@ -27,53 +27,57 @@ 2.4 #------------------------------------------------------------------------ 2.5 # CC, CXX & AS 2.6 2.7 -# When cross-compiling the ALT_COMPILER_PATH points 2.8 -# to the cross-compilation toolset 2.9 -ifdef CROSS_COMPILE_ARCH 2.10 - CXX = $(ALT_COMPILER_PATH)/g++ 2.11 - CC = $(ALT_COMPILER_PATH)/gcc 2.12 - HOSTCXX = g++ 2.13 - HOSTCC = gcc 2.14 -else ifneq ($(OS_VENDOR), Darwin) 2.15 - CXX = g++ 2.16 - CC = gcc 2.17 - HOSTCXX = $(CXX) 2.18 - HOSTCC = $(CC) 2.19 +# If a SPEC is not set already, then use these defaults. 2.20 +ifeq ($(SPEC),) 2.21 + # When cross-compiling the ALT_COMPILER_PATH points 2.22 + # to the cross-compilation toolset 2.23 + ifdef CROSS_COMPILE_ARCH 2.24 + CXX = $(ALT_COMPILER_PATH)/g++ 2.25 + CC = $(ALT_COMPILER_PATH)/gcc 2.26 + HOSTCXX = g++ 2.27 + HOSTCC = gcc 2.28 + else ifneq ($(OS_VENDOR), Darwin) 2.29 + CXX = g++ 2.30 + CC = gcc 2.31 + HOSTCXX = $(CXX) 2.32 + HOSTCC = $(CC) 2.33 + endif 2.34 + 2.35 + # i486 hotspot requires -mstackrealign on Darwin. 2.36 + # llvm-gcc supports this in Xcode 3.2.6 and 4.0. 2.37 + # gcc-4.0 supports this on earlier versions. 2.38 + # Prefer llvm-gcc where available. 2.39 + ifeq ($(OS_VENDOR), Darwin) 2.40 + ifeq ($(origin CXX), default) 2.41 + CXX = llvm-g++ 2.42 + endif 2.43 + ifeq ($(origin CC), default) 2.44 + CC = llvm-gcc 2.45 + endif 2.46 + 2.47 + ifeq ($(ARCH), i486) 2.48 + LLVM_SUPPORTS_STACKREALIGN := $(shell \ 2.49 + [ "0"`llvm-gcc -v 2>&1 | grep LLVM | sed -E "s/.*LLVM build ([0-9]+).*/\1/"` -gt "2333" ] \ 2.50 + && echo true || echo false) 2.51 + 2.52 + ifeq ($(LLVM_SUPPORTS_STACKREALIGN), true) 2.53 + CXX32 ?= llvm-g++ 2.54 + CC32 ?= llvm-gcc 2.55 + else 2.56 + CXX32 ?= g++-4.0 2.57 + CC32 ?= gcc-4.0 2.58 + endif 2.59 + CXX = $(CXX32) 2.60 + CC = $(CC32) 2.61 + endif 2.62 + 2.63 + HOSTCXX = $(CXX) 2.64 + HOSTCC = $(CC) 2.65 + endif 2.66 + 2.67 + AS = $(CC) -c -x assembler-with-cpp 2.68 endif 2.69 2.70 -# i486 hotspot requires -mstackrealign on Darwin. 2.71 -# llvm-gcc supports this in Xcode 3.2.6 and 4.0. 2.72 -# gcc-4.0 supports this on earlier versions. 2.73 -# Prefer llvm-gcc where available. 2.74 -ifeq ($(OS_VENDOR), Darwin) 2.75 - ifeq ($(origin CXX), default) 2.76 - CXX = llvm-g++ 2.77 - endif 2.78 - ifeq ($(origin CC), default) 2.79 - CC = llvm-gcc 2.80 - endif 2.81 - 2.82 - ifeq ($(ARCH), i486) 2.83 - LLVM_SUPPORTS_STACKREALIGN := $(shell \ 2.84 - [ "0"`llvm-gcc -v 2>&1 | grep LLVM | sed -E "s/.*LLVM build ([0-9]+).*/\1/"` -gt "2333" ] \ 2.85 - && echo true || echo false) 2.86 - 2.87 - ifeq ($(LLVM_SUPPORTS_STACKREALIGN), true) 2.88 - CXX32 ?= llvm-g++ 2.89 - CC32 ?= llvm-gcc 2.90 - else 2.91 - CXX32 ?= g++-4.0 2.92 - CC32 ?= gcc-4.0 2.93 - endif 2.94 - CXX = $(CXX32) 2.95 - CC = $(CC32) 2.96 - endif 2.97 - 2.98 - HOSTCXX = $(CXX) 2.99 - HOSTCC = $(CC) 2.100 -endif 2.101 - 2.102 -AS = $(CC) -c -x assembler-with-cpp 2.103 2.104 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only 2.105 # prints the numbers (e.g. "2.95", "3.2.1")
3.1 --- a/make/bsd/makefiles/sparcWorks.make Wed Feb 22 10:32:29 2012 -0800 3.2 +++ b/make/bsd/makefiles/sparcWorks.make Wed Feb 22 09:24:35 2012 +0100 3.3 @@ -25,12 +25,15 @@ 3.4 #------------------------------------------------------------------------ 3.5 # CC, CXX & AS 3.6 3.7 -CXX = CC 3.8 -CC = cc 3.9 -AS = $(CC) -c 3.10 +# If a SPEC is not set already, then use these defaults. 3.11 +ifeq ($(SPEC),) 3.12 + CXX = CC 3.13 + CC = cc 3.14 + AS = $(CC) -c 3.15 3.16 -HOSTCXX = $(CXX) 3.17 -HOSTCC = $(CC) 3.18 + HOSTCXX = $(CXX) 3.19 + HOSTCC = $(CC) 3.20 +endif 3.21 3.22 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) 3.23 ARCHFLAG/i486 = -m32
4.1 --- a/make/defs.make Wed Feb 22 10:32:29 2012 -0800 4.2 +++ b/make/defs.make Wed Feb 22 09:24:35 2012 +0100 4.3 @@ -24,6 +24,11 @@ 4.4 4.5 # The common definitions for hotspot builds. 4.6 4.7 +# Optionally include SPEC file generated by configure. 4.8 +ifneq ($(SPEC),) 4.9 + include $(SPEC) 4.10 +endif 4.11 + 4.12 # Default to verbose build logs (show all compile lines): 4.13 MAKE_VERBOSE=y 4.14
5.1 --- a/make/linux/makefiles/buildtree.make Wed Feb 22 10:32:29 2012 -0800 5.2 +++ b/make/linux/makefiles/buildtree.make Wed Feb 22 09:24:35 2012 +0100 5.3 @@ -55,6 +55,7 @@ 5.4 # The makefiles are split this way so that "make foo" will run faster by not 5.5 # having to read the dependency files for the vm. 5.6 5.7 +-include $(SPEC) 5.8 include $(GAMMADIR)/make/scm.make 5.9 include $(GAMMADIR)/make/altsrc.make 5.10 5.11 @@ -244,6 +245,8 @@ 5.12 echo "HOTSPOT_EXTRA_SYSDEFS\$$(HOTSPOT_EXTRA_SYSDEFS) = $(HOTSPOT_EXTRA_SYSDEFS)" && \ 5.13 echo "SYSDEFS += \$$(HOTSPOT_EXTRA_SYSDEFS)"; \ 5.14 echo; \ 5.15 + [ -n "$(SPEC)" ] && \ 5.16 + echo "include $(SPEC)"; \ 5.17 echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(VARIANT).make"; \ 5.18 echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(COMPILER).make"; \ 5.19 ) > $@
6.1 --- a/make/linux/makefiles/gcc.make Wed Feb 22 10:32:29 2012 -0800 6.2 +++ b/make/linux/makefiles/gcc.make Wed Feb 22 09:24:35 2012 +0100 6.3 @@ -25,21 +25,26 @@ 6.4 #------------------------------------------------------------------------ 6.5 # CC, CXX & AS 6.6 6.7 -# When cross-compiling the ALT_COMPILER_PATH points 6.8 -# to the cross-compilation toolset 6.9 -ifdef CROSS_COMPILE_ARCH 6.10 -CXX = $(ALT_COMPILER_PATH)/g++ 6.11 -CC = $(ALT_COMPILER_PATH)/gcc 6.12 -HOSTCXX = g++ 6.13 -HOSTCC = gcc 6.14 -else 6.15 -CXX = g++ 6.16 -CC = gcc 6.17 -HOSTCXX = $(CXX) 6.18 -HOSTCC = $(CC) 6.19 +# If a SPEC is not set already, then use these defaults. 6.20 +ifeq ($(SPEC),) 6.21 + # When cross-compiling the ALT_COMPILER_PATH points 6.22 + # to the cross-compilation toolset 6.23 + ifdef CROSS_COMPILE_ARCH 6.24 + CXX = $(ALT_COMPILER_PATH)/g++ 6.25 + CC = $(ALT_COMPILER_PATH)/gcc 6.26 + HOSTCXX = g++ 6.27 + HOSTCC = gcc 6.28 + STRIP = $(ALT_COMPILER_PATH)/strip 6.29 + else 6.30 + CXX = g++ 6.31 + CC = gcc 6.32 + HOSTCXX = $(CXX) 6.33 + HOSTCC = $(CC) 6.34 + STRIP = strip 6.35 + endif 6.36 + AS = $(CC) -c 6.37 endif 6.38 6.39 -AS = $(CC) -c 6.40 6.41 # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only 6.42 # prints the numbers (e.g. "2.95", "3.2.1") 6.43 @@ -261,9 +266,3 @@ 6.44 ifdef MINIMIZE_RAM_USAGE 6.45 CFLAGS += -DMINIMIZE_RAM_USAGE 6.46 endif 6.47 - 6.48 -ifdef CROSS_COMPILE_ARCH 6.49 - STRIP = $(ALT_COMPILER_PATH)/strip 6.50 -else 6.51 - STRIP = strip 6.52 -endif
7.1 --- a/make/linux/makefiles/sparcWorks.make Wed Feb 22 10:32:29 2012 -0800 7.2 +++ b/make/linux/makefiles/sparcWorks.make Wed Feb 22 09:24:35 2012 +0100 7.3 @@ -25,12 +25,15 @@ 7.4 #------------------------------------------------------------------------ 7.5 # CC, CXX & AS 7.6 7.7 -CXX = CC 7.8 -CC = cc 7.9 -AS = $(CC) -c 7.10 +# If a SPEC is not set already, then use these defaults. 7.11 +ifeq ($(SPEC),) 7.12 + CXX = CC 7.13 + CC = cc 7.14 + AS = $(CC) -c 7.15 7.16 -HOSTCXX = $(CXX) 7.17 -HOSTCC = $(CC) 7.18 + HOSTCXX = $(CXX) 7.19 + HOSTCC = $(CC) 7.20 +endif 7.21 7.22 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) 7.23 ARCHFLAG/i486 = -m32
8.1 --- a/make/solaris/makefiles/buildtree.make Wed Feb 22 10:32:29 2012 -0800 8.2 +++ b/make/solaris/makefiles/buildtree.make Wed Feb 22 09:24:35 2012 +0100 8.3 @@ -55,6 +55,7 @@ 8.4 # The makefiles are split this way so that "make foo" will run faster by not 8.5 # having to read the dependency files for the vm. 8.6 8.7 +-include $(SPEC) 8.8 include $(GAMMADIR)/make/scm.make 8.9 include $(GAMMADIR)/make/altsrc.make 8.10 8.11 @@ -237,6 +238,8 @@ 8.12 echo "HOTSPOT_EXTRA_SYSDEFS\$$(HOTSPOT_EXTRA_SYSDEFS) = $(HOTSPOT_EXTRA_SYSDEFS)" && \ 8.13 echo "SYSDEFS += \$$(HOTSPOT_EXTRA_SYSDEFS)"; \ 8.14 echo; \ 8.15 + [ -n "$(SPEC)" ] && \ 8.16 + echo "include $(SPEC)"; \ 8.17 echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(VARIANT).make"; \ 8.18 echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(COMPILER).make"; \ 8.19 ) > $@
9.1 --- a/make/solaris/makefiles/gcc.make Wed Feb 22 10:32:29 2012 -0800 9.2 +++ b/make/solaris/makefiles/gcc.make Wed Feb 22 09:24:35 2012 +0100 9.3 @@ -25,9 +25,13 @@ 9.4 #------------------------------------------------------------------------ 9.5 # CC, CXX & AS 9.6 9.7 -CXX = g++ 9.8 -CC = gcc 9.9 -AS = $(CC) -c 9.10 +# If a SPEC is not set already, then use these defaults. 9.11 +ifeq ($(SPEC),) 9.12 + CXX = g++ 9.13 + CC = gcc 9.14 + AS = $(CC) -c 9.15 + MCS = /usr/ccs/bin/mcs 9.16 +endif 9.17 9.18 Compiler = gcc 9.19 9.20 @@ -193,5 +197,3 @@ 9.21 ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),) 9.22 DEBUG_CFLAGS += -gstabs 9.23 endif 9.24 - 9.25 -MCS = /usr/ccs/bin/mcs
10.1 --- a/make/solaris/makefiles/sparcWorks.make Wed Feb 22 10:32:29 2012 -0800 10.2 +++ b/make/solaris/makefiles/sparcWorks.make Wed Feb 22 09:24:35 2012 +0100 10.3 @@ -22,18 +22,22 @@ 10.4 # 10.5 # 10.6 10.7 -# Compiler-specific flags for sparcworks. 10.8 +# If a SPEC is not set already, then use these defaults. 10.9 +ifeq ($(SPEC),) 10.10 + # Compiler-specific flags for sparcworks. 10.11 + CC = cc 10.12 + CXX = CC 10.13 10.14 -# tell make which C and C++ compilers to use 10.15 -CC = cc 10.16 -CXX = CC 10.17 + # Note that this 'as' is an older version of the Sun Studio 'fbe', and will 10.18 + # use the older style options. The 'fbe' options will match 'cc' and 'CC'. 10.19 + AS = /usr/ccs/bin/as 10.20 10.21 -# Note that this 'as' is an older version of the Sun Studio 'fbe', and will 10.22 -# use the older style options. The 'fbe' options will match 'cc' and 'CC'. 10.23 -AS = /usr/ccs/bin/as 10.24 + NM = /usr/ccs/bin/nm 10.25 + NAWK = /bin/nawk 10.26 10.27 -NM = /usr/ccs/bin/nm 10.28 -NAWK = /bin/nawk 10.29 + MCS = /usr/ccs/bin/mcs 10.30 + STRIP = /usr/ccs/bin/strip 10.31 +endif 10.32 10.33 REORDER_FLAG = -xF 10.34 10.35 @@ -557,9 +561,6 @@ 10.36 #LINK_INTO = LIBJVM 10.37 endif 10.38 10.39 -MCS = /usr/ccs/bin/mcs 10.40 -STRIP = /usr/ccs/bin/strip 10.41 - 10.42 # Solaris platforms collect lots of redundant file-ident lines, 10.43 # to the point of wasting a significant percentage of file space. 10.44 # (The text is stored in ELF .comment sections, contributed by
11.1 --- a/make/windows/build.make Wed Feb 22 10:32:29 2012 -0800 11.2 +++ b/make/windows/build.make Wed Feb 22 09:24:35 2012 +0100 11.3 @@ -297,6 +297,10 @@ 11.4 @ echo BUILDARCH=$(BUILDARCH) >> $@ 11.5 @ echo Platform_arch=$(Platform_arch) >> $@ 11.6 @ echo Platform_arch_model=$(Platform_arch_model) >> $@ 11.7 + @ echo CXX=$(CXX) >> $@ 11.8 + @ echo LD=$(LD) >> $@ 11.9 + @ echo MT=$(MT) >> $@ 11.10 + @ echo RC=$(RC) >> $@ 11.11 @ sh $(WorkSpace)/make/windows/get_msc_ver.sh >> $@ 11.12 11.13 checks: checkVariant checkWorkSpace checkSA
12.1 --- a/make/windows/makefiles/compile.make Wed Feb 22 10:32:29 2012 -0800 12.2 +++ b/make/windows/makefiles/compile.make Wed Feb 22 09:24:35 2012 +0100 12.3 @@ -23,7 +23,9 @@ 12.4 # 12.5 12.6 # Generic compiler settings 12.7 +!if "x$(CXX)" == "x" 12.8 CXX=cl.exe 12.9 +!endif 12.10 12.11 # CXX Flags: (these vary slightly from VC6->VS2003->VS2005 compilers) 12.12 # /nologo Supress copyright message at every cl.exe startup 12.13 @@ -183,8 +185,10 @@ 12.14 LD_FLAGS = /manifest $(LD_FLAGS) $(BUFFEROVERFLOWLIB) 12.15 # Manifest Tool - used in VS2005 and later to adjust manifests stored 12.16 # as resources inside build artifacts. 12.17 +!if "x$(MT)" == "x" 12.18 MT=mt.exe 12.19 !endif 12.20 +!endif 12.21 12.22 !if "$(COMPILER_NAME)" == "VS2008" 12.23 PRODUCT_OPT_OPTION = /O2 /Oy- 12.24 @@ -194,8 +198,10 @@ 12.25 LD_FLAGS = /manifest $(LD_FLAGS) 12.26 # Manifest Tool - used in VS2005 and later to adjust manifests stored 12.27 # as resources inside build artifacts. 12.28 +!if "x$(MT)" == "x" 12.29 MT=mt.exe 12.30 !endif 12.31 +!endif 12.32 12.33 !if "$(COMPILER_NAME)" == "VS2010" 12.34 PRODUCT_OPT_OPTION = /O2 /Oy- 12.35 @@ -205,7 +211,9 @@ 12.36 LD_FLAGS = /manifest $(LD_FLAGS) 12.37 # Manifest Tool - used in VS2005 and later to adjust manifests stored 12.38 # as resources inside build artifacts. 12.39 +!if "x$(MT)" == "x" 12.40 MT=mt.exe 12.41 +!endif 12.42 !if "$(BUILDARCH)" == "i486" 12.43 LD_FLAGS = /SAFESEH $(LD_FLAGS) 12.44 !endif 12.45 @@ -225,7 +233,9 @@ 12.46 !endif 12.47 12.48 # Generic linker settings 12.49 +!if "x$(LD)" == "x" 12.50 LD=link.exe 12.51 +!endif 12.52 LD_FLAGS= $(LD_FLAGS) kernel32.lib user32.lib gdi32.lib winspool.lib \ 12.53 comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \ 12.54 uuid.lib Wsock32.lib winmm.lib /nologo /machine:$(MACHINE) /opt:REF \ 12.55 @@ -237,7 +247,9 @@ 12.56 !endif 12.57 12.58 # Resource compiler settings 12.59 +!if "x$(RC)" == "x" 12.60 RC=rc.exe 12.61 +!endif 12.62 RC_FLAGS=/D "HS_VER=$(HS_VER)" \ 12.63 /D "HS_DOTVER=$(HS_DOTVER)" \ 12.64 /D "HS_BUILD_ID=$(HS_BUILD_ID)" \
13.1 --- a/make/windows/makefiles/defs.make Wed Feb 22 10:32:29 2012 -0800 13.2 +++ b/make/windows/makefiles/defs.make Wed Feb 22 09:24:35 2012 +0100 13.3 @@ -202,3 +202,19 @@ 13.4 # Must pass this down to nmake. 13.5 MAKE_ARGS += BUILD_WIN_SA=1 13.6 endif 13.7 + 13.8 +# Propagate compiler and tools paths from configure to nmake. 13.9 +# Need to make sure they contain \\ and not /. 13.10 +ifneq ($(SPEC),) 13.11 + ifeq ($(USING_CYGWIN), true) 13.12 + MAKE_ARGS += CXX="$(subst /,\\,$(shell /bin/cygpath -s -m -a $(CXX)))" 13.13 + MAKE_ARGS += LD="$(subst /,\\,$(shell /bin/cygpath -s -m -a $(LD)))" 13.14 + MAKE_ARGS += RC="$(subst /,\\,$(shell /bin/cygpath -s -m -a $(RC)))" 13.15 + MAKE_ARGS += MT="$(subst /,\\,$(shell /bin/cygpath -s -m -a $(MT)))" 13.16 + else 13.17 + MAKE_ARGS += CXX="$(subst /,\\,$(CXX))" 13.18 + MAKE_ARGS += LD="$(subst /,\\,$(LD))" 13.19 + MAKE_ARGS += RC="$(subst /,\\,$(RC))" 13.20 + MAKE_ARGS += MT="$(subst /,\\,$(MT))" 13.21 + endif 13.22 +endif