annotate make/Makefile @ 48:49efd83dd6b5

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