make/Makefile

Mon, 20 Dec 2010 21:10:57 -0800

author
lana
date
Mon, 20 Dec 2010 21:10:57 -0800
changeset 796
a3b5b531542a
parent 588
0ba1f80b73a5
child 798
4868a36f6fd8
child 805
7c33098600b2
permissions
-rw-r--r--

Merge

duke@1 1 #
ohair@554 2 # Copyright (c) 2007, 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@554 7 # published by the Free Software Foundation. Oracle designates this
duke@1 8 # particular file as subject to the "Classpath" exception as provided
ohair@554 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@554 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@554 22 # or visit www.oracle.com if you need additional information or have any
ohair@554 23 # questions.
duke@1 24 #
duke@1 25
duke@1 26 # Makefile for langtools: wrapper around Ant build.xml file
duke@1 27
duke@1 28 #
jjg@582 29 # On Solaris, the standard 'make' utility will not work with these makefiles.
jjg@582 30 # This little rule is only understood by Solaris make, and is harmless
jjg@582 31 # when seen by the GNU make tool. If using Solaris 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 #
duke@1 37 # Minimal platform defs
duke@1 38 # Need FullPath because we can't rely on gnumake abspath, until we use v3.81
duke@1 39 #
duke@1 40
duke@1 41 SYSTEM_UNAME := $(shell uname)
duke@1 42
jjg@588 43 # Where is unwanted output to be delivered?
jjg@588 44 # On Windows, MKS uses the special file "NUL", cygwin uses the customary unix file.
duke@1 45 ifeq ($(SYSTEM_UNAME), Windows_NT)
duke@1 46 DEV_NULL = NUL
duke@1 47 else
jjg@588 48 DEV_NULL = /dev/null
jjg@588 49 endif
jjg@588 50
duke@1 51 ifneq (,$(findstring CYGWIN,$(SYSTEM_UNAME)))
duke@1 52 USING_CYGWIN = true
duke@1 53 endif
duke@1 54
duke@1 55 ifdef USING_CYGWIN
duke@1 56 define FullPath
duke@1 57 $(shell cygpath -a -s -m $1 2> $(DEV_NULL))
duke@1 58 endef
duke@1 59 else
duke@1 60 define FullPath
duke@1 61 $(shell cd $1 2> $(DEV_NULL) && pwd)
duke@1 62 endef
duke@1 63 endif
duke@1 64
duke@1 65 #
duke@1 66 # Makefile args
duke@1 67 #
duke@1 68
duke@1 69 ifdef QUIET
duke@1 70 ANT_OPTIONS += -quiet
duke@1 71 endif
duke@1 72
duke@1 73 ifdef VERBOSE
andrew@501 74 ANT_OPTIONS += -verbose -debug
duke@1 75 endif
duke@1 76
duke@1 77 ifdef JDK_VERSION
duke@1 78 ANT_OPTIONS += -Djdk.version=$(JDK_VERSION)
duke@1 79 endif
duke@1 80
duke@1 81 ifdef FULL_VERSION
duke@1 82 ANT_OPTIONS += -Dfull.version='$(FULL_VERSION)' # will contain spaces
duke@1 83 endif
duke@1 84
duke@1 85 ifdef MILESTONE
jjg@172 86 ifneq ($(MILESTONE),fcs)
duke@1 87 ANT_OPTIONS += -Dmilestone=$(MILESTONE)
jjg@172 88 else
jjg@172 89 ANT_OPTIONS += -Drelease=$(JDK_VERSION)
jjg@172 90 endif
duke@1 91 endif
duke@1 92
duke@1 93 ifdef BUILD_NUMBER
duke@1 94 ANT_OPTIONS += -Dbuild.number=$(BUILD_NUMBER)
duke@1 95 else
duke@1 96 ifdef JDK_BUILD_NUMBER
duke@1 97 ANT_OPTIONS += -Dbuild.number=$(JDK_BUILD_NUMBER)
duke@1 98 endif
duke@1 99 endif
duke@1 100
duke@1 101 ifeq ($(VARIANT), DBG)
duke@1 102 ANT_OPTIONS += -Djavac.debug=true
duke@1 103 else
duke@1 104 ifeq ($(VARIANT), OPT)
duke@1 105 ANT_OPTIONS += -Djavac.debug=false
duke@1 106 endif
duke@1 107 endif
duke@1 108
aph@271 109 ifeq ($(DEBUG_CLASSFILES), true)
aph@271 110 ANT_OPTIONS += -Djavac.debug=true
aph@273 111 ANT_OPTIONS += -Ddebug.classfiles=true
aph@271 112 endif
aph@271 113
duke@1 114 # Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
duke@1 115 # and the somewhat misnamed CLASS_VERSION (-target NN)
duke@1 116 ifdef TARGET_CLASS_VERSION
duke@1 117 ANT_OPTIONS += -Djavac.target=$(TARGET_CLASS_VERSION)
duke@1 118 else
duke@1 119 ifdef JAVAC_TARGET_ARG
duke@1 120 ANT_OPTIONS += -Djavac.target=$(JAVAC_TARGET_ARG)
duke@1 121 endif
duke@1 122 endif
duke@1 123
jjg@286 124 ifdef SOURCE_LANGUAGE_VERSION
jjg@286 125 ANT_OPTIONS += -Djavac.source=$(SOURCE_LANGUAGE_VERSION)
jjg@286 126 else
jjg@286 127 ifdef JAVAC_SOURCE_ARG
jjg@286 128 ANT_OPTIONS += -Djavac.source=$(JAVAC_SOURCE_ARG)
jjg@286 129 endif
jjg@286 130 endif
jjg@286 131
duke@1 132 ifdef ALT_BOOTDIR
duke@1 133 ANT_OPTIONS += -Dboot.java.home=$(ALT_BOOTDIR)
duke@1 134 ANT_JAVA_HOME = JAVA_HOME=$(ALT_BOOTDIR)
duke@1 135 endif
duke@1 136
jjg@441 137 # To facilitate bootstrapping, much of langtools can be compiled with (just)
jjg@441 138 # a boot JDK. However, some source files need to be compiled against
jjg@441 139 # new JDK API. In a bootstrap build, an import JDK may not be available,
jjg@441 140 # so build.xml can also build against the source files in a jdk repo,
jjg@441 141 # in which case it will automatically generate stub files for the new JDK API.
jjg@441 142 ifdef JDK_TOPDIR
jjg@441 143 ANT_OPTIONS += -Dimport.jdk=$(JDK_TOPDIR)
jjg@441 144 else
jjg@441 145 ifdef ALT_JDK_TOPDIR
jjg@441 146 ANT_OPTIONS += -Dimport.jdk=$(ALT_JDK_TOPDIR)
jjg@441 147 else
jjg@462 148 ifdef ALT_JDK_IMPORT_PATH
jjg@462 149 ANT_OPTIONS += -Dimport.jdk=$(ALT_JDK_IMPORT_PATH)
jjg@441 150 endif
jjg@441 151 endif
jjg@441 152 endif
jjg@441 153
duke@1 154 ifdef ALT_OUTPUTDIR
duke@1 155 OUTPUTDIR = $(ALT_OUTPUTDIR)
duke@1 156 ANT_OPTIONS += -Dbuild.dir=$(ALT_OUTPUTDIR)/build
duke@1 157 ANT_OPTIONS += -Ddist.dir=$(ALT_OUTPUTDIR)/dist
duke@1 158 else
duke@1 159 OUTPUTDIR = ..
duke@1 160 endif
duke@1 161 #ABS_OUTPUTDIR = $(abspath $(OUTPUTDIR))
duke@1 162 ABS_OUTPUTDIR = $(call FullPath,$(OUTPUTDIR))
duke@1 163
duke@1 164 ANT_TMPDIR = $(ABS_OUTPUTDIR)/build/ant-tmp
duke@1 165 ANT_OPTS = ANT_OPTS=-Djava.io.tmpdir='$(ANT_TMPDIR)'
duke@1 166
duke@1 167 ifdef FINDBUGS_HOME
duke@1 168 ANT_OPTIONS += -Dfindbugs.home=$(FINDBUGS_HOME)
duke@1 169 endif
duke@1 170
duke@1 171 ifdef ANT_HOME
duke@1 172 ANT = $(ANT_HOME)/bin/ant
duke@1 173 ifneq ($(shell test -x $(ANT) && echo OK), OK)
duke@1 174 $(error $(ANT) not found -- please update ANT_HOME)
duke@1 175 endif
duke@1 176 else
duke@1 177 ANT = ant
duke@1 178 ifneq ($(shell test -x "`which $(ANT)`" && echo OK), OK)
duke@1 179 $(error 'ant' not found -- please set ANT_HOME or put 'ant' on your PATH)
duke@1 180 endif
duke@1 181 endif
duke@1 182
duke@1 183 # Default target and expected 'do everything' target
duke@1 184 all: build
duke@1 185
duke@1 186 # Standard make clobber target
duke@1 187 clobber: clean
duke@1 188
duke@1 189 # All ant targets of interest
duke@1 190 ANT_TARGETS = build clean sanity post-sanity diagnostics # for now
duke@1 191
ohair@531 192 # Create diagnostics log (careful, ant 1.8.0 -diagnostics always does an exit 1)
ohair@531 193 $(OUTPUTDIR)/build/ant-diagnostics.log:
ohair@531 194 @mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR)
ohair@531 195 @$(RM) $@
ohair@531 196 $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -diagnostics > $@ ; \
ohair@531 197 $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) -version >> $@
ohair@531 198
duke@1 199 # Create a make target for each
ohair@531 200 $(ANT_TARGETS): $(OUTPUTDIR)/build/ant-diagnostics.log
duke@1 201 @ mkdir -p $(OUTPUTDIR)/build $(ANT_TMPDIR)
duke@1 202 $(ANT_JAVA_HOME) $(ANT_OPTS) $(ANT) $(ANT_OPTIONS) $@
duke@1 203
duke@1 204 #-------------------------------------------------------------------
duke@1 205 #
jjg@582 206 # Targets for Oracle's internal JPRT build system
duke@1 207
duke@1 208 CD = cd
duke@1 209 ZIP = zip
duke@1 210
duke@1 211 JPRT_ARCHIVE_BUNDLE=$(ABS_OUTPUTDIR)/$(JPRT_BUILD_FLAVOR)-bundle.zip
duke@1 212
duke@1 213 jprt_build_product jprt_build_debug jprt_build_fastdebug: all
duke@1 214 ( $(CD) $(OUTPUTDIR) && \
duke@1 215 $(ZIP) -q -r $(JPRT_ARCHIVE_BUNDLE) build dist )
duke@1 216
duke@1 217 #-------------------------------------------------------------------
duke@1 218
duke@1 219 # Declare these phony (not filenames)
duke@1 220 .PHONY: $(ANT_TARGETS) all clobber \
duke@1 221 jprt_build_product jprt_build_debug jprt_build_fastdebug

mercurial