make/Makefile

Tue, 28 Dec 2010 15:53:15 -0800

author
ohair
date
Tue, 28 Dec 2010 15:53:15 -0800
changeset 170
86f60e5b3975
parent 124
48872561d4b1
child 188
ba12732b1453
permissions
-rw-r--r--

6962318: Update copyright year
Reviewed-by: xdono

duke@1 1 #
ohair@170 2 # Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
duke@1 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 #
duke@1 5 # This code is free software; you can redistribute it and/or modify it
duke@1 6 # under the terms of the GNU General Public License version 2 only, as
ohair@116 7 # published by the Free Software Foundation. Oracle designates this
duke@1 8 # particular file as subject to the "Classpath" exception as provided
ohair@116 9 # by Oracle in the LICENSE file that accompanied this code.
duke@1 10 #
duke@1 11 # This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 # version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 # accompanied this code).
duke@1 16 #
duke@1 17 # You should have received a copy of the GNU General Public License version
duke@1 18 # 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 #
ohair@116 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@116 22 # or visit www.oracle.com if you need additional information or have any
ohair@116 23 # questions.
duke@1 24 #
duke@1 25
ohair@85 26 # Makefile wrapper around Ant build.xml file
duke@1 27
duke@1 28 #
duke@1 29 # On Solaris, the 'make' utility from Sun will not work with these makefiles.
duke@1 30 # This little rule is only understood by Sun's make, and is harmless
duke@1 31 # when seen by the GNU make tool. If using Sun's make, this causes the
duke@1 32 # make command to fail.
duke@1 33 #
duke@1 34 SUN_MAKE_TEST:sh = @echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33
duke@1 35
duke@1 36 ifdef QUIET
duke@1 37 ANT_OPTIONS += -quiet
duke@1 38 endif
duke@1 39
duke@1 40 ifdef VERBOSE
duke@1 41 ANT_OPTIONS += -verbose
duke@1 42 endif
duke@1 43
ohair@85 44 ifeq ($(VARIANT), OPT)
ohair@85 45 ifneq ($(DEBUG_CLASSFILES), true)
duke@1 46 ANT_OPTIONS += -Djavac.debug=false
duke@1 47 endif
duke@1 48 endif
duke@1 49
ohair@4 50 # Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
duke@1 51 # and the somewhat misnamed CLASS_VERSION (-target NN)
duke@1 52 ifdef TARGET_CLASS_VERSION
duke@1 53 ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION)
duke@1 54 else
duke@1 55 ifdef JAVAC_TARGET_ARG
duke@1 56 ANT_OPTIONS += -Djavac.target=$(JAVAC_TARGET_ARG)
duke@1 57 endif
duke@1 58 endif
duke@1 59
jjg@63 60 ifdef SOURCE_LANGUAGE_VERSION
jjg@63 61 ANT_OPTIONS += -Djavac.source=$(SOURCE_LANGUAGE_VERSION)
jjg@63 62 else
jjg@63 63 ifdef JAVAC_SOURCE_ARG
jjg@63 64 ANT_OPTIONS += -Djavac.source=$(JAVAC_SOURCE_ARG)
jjg@63 65 endif
jjg@63 66 endif
jjg@63 67
ohair@124 68 # If downloads are allowed
ohair@124 69 ifeq ($(ALLOW_DOWNLOADS),true)
ohair@124 70 ANT_OPTIONS += -Dallow.downloads=true
ohair@124 71 endif
ohair@124 72
ohair@85 73 # Figure out the platform we are using
ohair@85 74 _SYSTEM_UNAME := $(shell uname)
ohair@85 75 _PLATFORM_KIND = unix
ohair@85 76 ifeq ($(_SYSTEM_UNAME), Windows_NT)
ohair@85 77 _PLATFORM_KIND = windows
duke@1 78 endif
ohair@85 79 ifneq (,$(findstring CYGWIN,$(_SYSTEM_UNAME)))
ohair@85 80 _PLATFORM_KIND = windows
ohair@85 81 endif
ohair@85 82
ohair@85 83 # Where is /java in case we need it
ohair@85 84 ifdef ALT_SLASH_JAVA
ohair@85 85 _SLASHJAVA = $(ALT_SLASH_JAVA)
ohair@85 86 else
ohair@85 87 ifeq ($(_PLATFORM_KIND), windows)
ohair@85 88 _SLASHJAVA=J:/
ohair@85 89 else
ohair@85 90 _SLASHJAVA=/java
ohair@85 91 endif
ohair@85 92 endif
ohair@85 93
andrew@92 94 # Do we have the drops already downloaded?
andrew@92 95 # Check ALT_DROPS_DIR for a full path first,
andrew@92 96 # before trying to use the devtools path,
andrew@92 97 # either via ALT_JDK_DEVTOOLS_DIR or /java/devtools.
andrew@92 98 ifdef ALT_DROPS_DIR
andrew@92 99 DROPS_DIR = $(ALT_DROPS_DIR)
ohair@85 100 else
andrew@92 101 ifdef ALT_JDK_DEVTOOLS_DIR
andrew@92 102 DROPS_DIR = $(ALT_JDK_DEVTOOLS_DIR)/share/jdk7-drops
andrew@92 103 else
andrew@92 104 DROPS_DIR = $(_SLASHJAVA)/devtools/share/jdk7-drops
andrew@92 105 endif
ohair@85 106 endif
ohair@85 107
andrew@92 108 # Add in path to drops already downloaded
andrew@92 109 ANT_OPTIONS += -Ddrops.dir=$(DROPS_DIR)
duke@1 110
duke@1 111 ifdef ALT_OUTPUTDIR
duke@1 112 OUTPUTDIR = $(ALT_OUTPUTDIR)
ohair@85 113 ANT_OPTIONS += -Doutput.dir=$(ALT_OUTPUTDIR)
duke@1 114 else
duke@1 115 OUTPUTDIR = ..
duke@1 116 endif
duke@1 117
duke@1 118 ifdef ALT_LANGTOOLS_DIST
ohair@85 119 ifdef ALT_BOOTDIR
ohair@85 120 ANT_JAVA_HOME = JAVA_HOME=$(ALT_BOOTDIR)
ohair@95 121 ANT_OPTIONS += -Djdk.home=$(ALT_BOOTDIR)
ohair@85 122 endif
duke@1 123 ANT_OPTIONS += -Dbootstrap.dir=$(ALT_LANGTOOLS_DIST)/bootstrap
ohair@85 124 else
ohair@85 125 ifdef ALT_JDK_IMPORT_PATH
ohair@85 126 ANT_JAVA_HOME = JAVA_HOME=$(ALT_JDK_IMPORT_PATH)
ohair@95 127 ANT_OPTIONS += -Djdk.home=$(ALT_JDK_IMPORT_PATH)
ohair@85 128 endif
duke@1 129 endif
duke@1 130
duke@1 131 ifdef ANT_HOME
duke@1 132 ANT = $(ANT_HOME)/bin/ant
duke@1 133 ifneq ($(shell test -x $(ANT); echo $$?), 0)
duke@1 134 $(error "$(ANT) not found; please update ANT_HOME")
duke@1 135 endif
duke@1 136 else
duke@1 137 ANT = ant
duke@1 138 ifneq ($(shell which $(ANT) > /dev/null; echo $$?), 0)
duke@1 139 $(error "\"ant\" not found; please set ANT_HOME or put \"ant\" on your PATH")
duke@1 140 endif
duke@1 141 endif
duke@1 142
duke@1 143 # Default target and expected 'do everything' target
ohair@85 144 default: all
duke@1 145
duke@1 146 # All ant targets of interest
ohair@91 147 ANT_TARGETS = all source drop_included build dist clobber clean sanity
duke@1 148
duke@1 149 # Create a make target for each
duke@1 150 $(ANT_TARGETS):
ohair@95 151 cd .. && $(ANT_JAVA_HOME) $(ANT) $(ANT_OPTIONS) -version
ohair@85 152 cd .. && $(ANT_JAVA_HOME) $(ANT) $(ANT_OPTIONS) $@
ohair@85 153
ohair@85 154 # Help target
ohair@85 155 define helpenvline
ohair@85 156 @echo " $1";echo " $2"
ohair@85 157 endef
ohair@85 158 help:
ohair@85 159 @echo "----------------------------------------------------------"
ohair@85 160 @echo " "
ohair@85 161 @echo "Help information for this Makefile:"
ohair@85 162 @echo " "
ohair@85 163 @echo " Targets (see ant project information for descriptions):"
ohair@85 164 @echo " $(ANT_TARGETS)"
ohair@85 165 @echo " "
ohair@85 166 @echo " Environment or command line variables (all optional):"
ohair@124 167 $(call helpenvline, ALT_DROPS_DIR,\
ohair@124 168 "Directory that contains the drop source bundles i.e. drops.dir")
ohair@85 169 $(call helpenvline, ALT_BOOTDIR,\
ohair@85 170 "JAVA_HOME to use when running ant")
ohair@85 171 $(call helpenvline, ALT_LANGTOOLS_DIST,\
ohair@85 172 "path to langtools repository dist directory")
ohair@85 173 $(call helpenvline, ALT_OUTPUTDIR,\
ohair@85 174 "path to root of output")
ohair@85 175 $(call helpenvline, DEBUG_CLASSFILES,\
ohair@85 176 "if set makes sure ant property javac.debug is true")
ohair@85 177 $(call helpenvline, JAVAC_SOURCE_ARG,\
ohair@85 178 "if SOURCE_LANGUAGE_VERSION not set uses this to set ant property javac.source")
ohair@85 179 $(call helpenvline, JAVAC_TARGET_ARG,\
ohair@85 180 "if TARGET_CLASS_VERSION not set uses this to set ant property javac.target")
ohair@85 181 $(call helpenvline, SOURCE_LANGUAGE_VERSION,\
ohair@85 182 "if set uses this to set ant property javac.source")
ohair@85 183 $(call helpenvline, QUIET,\
ohair@85 184 "if set will pass -quiet to ant")
ohair@85 185 $(call helpenvline, TARGET_CLASS_VERSION,\
ohair@85 186 "JAVA_HOME to use when running ant")
ohair@85 187 $(call helpenvline, VARIANT,\
ohair@85 188 "if set to OPT means optimized build will set javac.debug to false")
ohair@85 189 $(call helpenvline, VERBOSE,\
ohair@85 190 "if set will pass -verbose to ant")
ohair@85 191 @echo " "
ohair@85 192 @echo "----------------------------------------------------------"
ohair@85 193 @echo " "
ohair@85 194 @echo "Ant project file help information:"
ohair@85 195 @echo " "
ohair@85 196 @$(ANT_JAVA_HOME) cd .. && $(ANT) $(ANT_OPTIONS) -p
ohair@85 197 @echo " "
ohair@85 198 @echo "----------------------------------------------------------"
duke@1 199
duke@1 200 # Targets for Sun's internal JPRT build system
ohair@4 201 JPRT_ARCHIVE_BUNDLE=$(OUTPUTDIR)/jprt.zip
duke@1 202 jprt_build_product jprt_build_debug jprt_build_fastdebug: all
ohair@4 203 $(RM) $(JPRT_ARCHIVE_BUNDLE)
ohair@4 204 ( cd $(OUTPUTDIR)/dist && \
ohair@4 205 zip -q -r $(JPRT_ARCHIVE_BUNDLE) . )
duke@1 206
duke@1 207 # Declare these phony (not filenames)
ohair@85 208 .PHONY: $(ANT_TARGETS) \
duke@1 209 jprt_build_product jprt_build_debug jprt_build_fastdebug

mercurial