| 1 | # | 
|---|
| 2 | # Copyright 1995-2007 Sun Microsystems, Inc.  All Rights Reserved. | 
|---|
| 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 
|---|
| 4 | # | 
|---|
| 5 | # This code is free software; you can redistribute it and/or modify it | 
|---|
| 6 | # under the terms of the GNU General Public License version 2 only, as | 
|---|
| 7 | # published by the Free Software Foundation.  Sun designates this | 
|---|
| 8 | # particular file as subject to the "Classpath" exception as provided | 
|---|
| 9 | # by Sun in the LICENSE file that accompanied this code. | 
|---|
| 10 | # | 
|---|
| 11 | # This code is distributed in the hope that it will be useful, but WITHOUT | 
|---|
| 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 
|---|
| 13 | # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License | 
|---|
| 14 | # version 2 for more details (a copy is included in the LICENSE file that | 
|---|
| 15 | # accompanied this code). | 
|---|
| 16 | # | 
|---|
| 17 | # You should have received a copy of the GNU General Public License version | 
|---|
| 18 | # 2 along with this work; if not, write to the Free Software Foundation, | 
|---|
| 19 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | 
|---|
| 20 | # | 
|---|
| 21 | # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | 
|---|
| 22 | # CA 95054 USA or visit www.sun.com if you need additional information or | 
|---|
| 23 | # have any questions. | 
|---|
| 24 | # | 
|---|
| 25 |  | 
|---|
| 26 | # | 
|---|
| 27 | # Makefile for building and packaging all of the JDK and the JRE. See | 
|---|
| 28 | # also included files. | 
|---|
| 29 | # | 
|---|
| 30 |  | 
|---|
| 31 | BUILDDIR=. | 
|---|
| 32 | include $(BUILDDIR)/common/Defs.gmk | 
|---|
| 33 |  | 
|---|
| 34 | # | 
|---|
| 35 | # Make sure we are clear what the default target is | 
|---|
| 36 | # | 
|---|
| 37 | default_target: all | 
|---|
| 38 |  | 
|---|
| 39 | # | 
|---|
| 40 | # Check target | 
|---|
| 41 | # | 
|---|
| 42 |  | 
|---|
| 43 | check: variable_check | 
|---|
| 44 |  | 
|---|
| 45 | # | 
|---|
| 46 | # Help target | 
|---|
| 47 | # | 
|---|
| 48 | help: intro_help target_help variable_help notes_help examples_help | 
|---|
| 49 |  | 
|---|
| 50 | # Intro help message | 
|---|
| 51 | intro_help: | 
|---|
| 52 | @$(ECHO) "\ | 
|---|
| 53 | Makefile for the main JDK workspace. \n\ | 
|---|
| 54 | Default behavior is to use the BOOTDIR javac to bootstrap the build and \n\ | 
|---|
| 55 | import in pre-built components like the VM from the JDK_IMPORT_PATH. \n\ | 
|---|
| 56 | " | 
|---|
| 57 |  | 
|---|
| 58 | # Target help | 
|---|
| 59 | target_help: | 
|---|
| 60 | @$(ECHO) "\ | 
|---|
| 61 | --- Common Targets ---  \n\ | 
|---|
| 62 | all               -- build the core JDK (default target) \n\ | 
|---|
| 63 | help              -- Print out help information \n\ | 
|---|
| 64 | check             -- Check make variable values for correctness \n\ | 
|---|
| 65 | sanity            -- Perform detailed sanity checks on system and settings \n\ | 
|---|
| 66 | openjdk           -- synonym for 'OPENJDK=true all' \n\ | 
|---|
| 67 | fastdebug         -- build the core JDK in 'fastdebug' mode (-g -O) \n\ | 
|---|
| 68 | debug             -- build the core JDK in 'debug' mode (-g) \n\ | 
|---|
| 69 | clean             -- remove all built and imported files \n\ | 
|---|
| 70 | clobber           -- same as clean \n\ | 
|---|
| 71 | docs              -- run javadoc to generate the JDK documentation \n\ | 
|---|
| 72 | images            -- build the jdk and jre image directories \n\ | 
|---|
| 73 | import            -- copy in the pre-built components (e.g. VM) \n\ | 
|---|
| 74 | import_product    -- copy in the product components \n\ | 
|---|
| 75 | import_fastdebug  -- copy in the fastdebug components \n\ | 
|---|
| 76 | import_debug      -- copy in the debug components \n\ | 
|---|
| 77 | sccs_get          -- make sure all SCCS files are up-to-date (need SCCS) \n\ | 
|---|
| 78 | create_links      -- create softlinks in Solaris 32bit build to 64bit dirs \n\ | 
|---|
| 79 | " | 
|---|
| 80 |  | 
|---|
| 81 | # Variable help (only common ones used by this workspace) | 
|---|
| 82 | variable_help: variable_help_intro variable_list variable_help_end | 
|---|
| 83 | variable_help_intro: | 
|---|
| 84 | @$(ECHO) "--- Common Variables ---" | 
|---|
| 85 | variable_help_end: | 
|---|
| 86 | @$(ECHO) " " | 
|---|
| 87 |  | 
|---|
| 88 | # One line descriptions for the variables | 
|---|
| 89 | OUTPUTDIR.desc             = Output directory | 
|---|
| 90 | PARALLEL_COMPILE_JOBS.desc = Solaris/Linux parallel compile run count | 
|---|
| 91 | SLASH_JAVA.desc            = Root of all build tools, e.g. /java or J: | 
|---|
| 92 | BOOTDIR.desc               = JDK used to boot the build | 
|---|
| 93 | LANGTOOLS_DIST.desc        = langtools dist area used to build | 
|---|
| 94 | CORBA_DIST.desc            = corba dist area | 
|---|
| 95 | JAXP_DIST.desc             = jaxp dist area | 
|---|
| 96 | JAXWS_DIST.desc            = jaxws dist area | 
|---|
| 97 | JDK_IMPORT_PATH.desc       = JDK used to import components of the build | 
|---|
| 98 | COMPILER_PATH.desc         = Compiler install directory | 
|---|
| 99 | CACERTS_FILE.desc          = Location of certificates file | 
|---|
| 100 | DEVTOOLS_PATH.desc         = Directory containing zip and unzip | 
|---|
| 101 | MOTIF_DIR.desc             = Root directory for motif directories | 
|---|
| 102 | CUPS_HEADERS_PATH.desc     = Include directory location for CUPS header files | 
|---|
| 103 | DXSDK_PATH.desc            = Root directory of DirectX SDK | 
|---|
| 104 | MSDEVTOOLS_PATH.desc       = Root directory of VC++ tools (e.g. rc.exe) | 
|---|
| 105 | MSVCRT_DLL_PATH.desc       = Directory containing mscvrt.dll | 
|---|
| 106 | UNICOWS_DLL_PATH.desc      = Directory containing unicows.dll | 
|---|
| 107 | UNICOWS_LIB_PATH.desc      = Directory containing unicows.lib | 
|---|
| 108 | ODINSDK_PATH.desc          = Root directory of Odin32 SDK (OS/2) | 
|---|
| 109 |  | 
|---|
| 110 | # Make variables to print out (description and value) | 
|---|
| 111 | VARIABLE_PRINTVAL_LIST +=       \ | 
|---|
| 112 | OUTPUTDIR                   \ | 
|---|
| 113 | PARALLEL_COMPILE_JOBS       \ | 
|---|
| 114 | SLASH_JAVA                  \ | 
|---|
| 115 | BOOTDIR                     \ | 
|---|
| 116 | LANGTOOLS_DIST              \ | 
|---|
| 117 | JAXWS_DIST                  \ | 
|---|
| 118 | CORBA_DIST                  \ | 
|---|
| 119 | JAXP_DIST                   \ | 
|---|
| 120 | JDK_IMPORT_PATH             \ | 
|---|
| 121 | COMPILER_PATH               \ | 
|---|
| 122 | CACERTS_FILE                \ | 
|---|
| 123 | DEVTOOLS_PATH               \ | 
|---|
| 124 | MOTIF_DIR | 
|---|
| 125 |  | 
|---|
| 126 | # Make variables that should refer to directories that exist | 
|---|
| 127 | VARIABLE_CHECKDIR_LIST +=       \ | 
|---|
| 128 | SLASH_JAVA                  \ | 
|---|
| 129 | BOOTDIR                     \ | 
|---|
| 130 | JDK_IMPORT_PATH             \ | 
|---|
| 131 | COMPILER_PATH               \ | 
|---|
| 132 | DEVTOOLS_PATH | 
|---|
| 133 |  | 
|---|
| 134 | # Make variables that should refer to files that exist | 
|---|
| 135 | VARIABLE_CHECKFIL_LIST +=       \ | 
|---|
| 136 | CACERTS_FILE | 
|---|
| 137 |  | 
|---|
| 138 | # Some are windows specific | 
|---|
| 139 | ifeq ($(PLATFORM), windows) | 
|---|
| 140 |  | 
|---|
| 141 | VARIABLE_PRINTVAL_LIST +=       \ | 
|---|
| 142 | DXSDK_PATH                  \ | 
|---|
| 143 | MSDEVTOOLS_PATH             \ | 
|---|
| 144 | MSVCRT_DLL_PATH             \ | 
|---|
| 145 | UNICOWS_DLL_PATH            \ | 
|---|
| 146 | UNICOWS_LIB_PATH | 
|---|
| 147 |  | 
|---|
| 148 | VARIABLE_CHECKDIR_LIST +=       \ | 
|---|
| 149 | DXSDK_PATH                  \ | 
|---|
| 150 | MSDEVTOOLS_PATH             \ | 
|---|
| 151 | MSVCRT_DLL_PATH             \ | 
|---|
| 152 | UNICOWS_DLL_PATH            \ | 
|---|
| 153 | UNICOWS_LIB_PATH | 
|---|
| 154 |  | 
|---|
| 155 | endif | 
|---|
| 156 |  | 
|---|
| 157 | # Some are OS/2 specific | 
|---|
| 158 | ifeq ($(PLATFORM), os2) | 
|---|
| 159 |  | 
|---|
| 160 | VARIABLE_PRINTVAL_LIST +=       \ | 
|---|
| 161 | ODINSDK_PATH | 
|---|
| 162 |  | 
|---|
| 163 | VARIABLE_CHECKDIR_LIST +=       \ | 
|---|
| 164 | ODINSDK_PATH | 
|---|
| 165 |  | 
|---|
| 166 | endif | 
|---|
| 167 |  | 
|---|
| 168 | # For pattern rules below, so all are treated the same | 
|---|
| 169 | DO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval) | 
|---|
| 170 | DO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir) | 
|---|
| 171 | DO_CHECKFIL_LIST=$(VARIABLE_CHECKFIL_LIST:%=%.checkfil) | 
|---|
| 172 |  | 
|---|
| 173 | # Complete variable check | 
|---|
| 174 | variable_check: $(DO_CHECKDIR_LIST) $(DO_CHECKFIL_LIST) | 
|---|
| 175 | variable_list: $(DO_PRINTVAL_LIST) variable_check | 
|---|
| 176 |  | 
|---|
| 177 | # Pattern rule for printing out a variable | 
|---|
| 178 | %.printval: | 
|---|
| 179 | @$(ECHO) "  ALT_$* - $($*.desc)" | 
|---|
| 180 | @$(ECHO) "  \t $*=$($*)" | 
|---|
| 181 |  | 
|---|
| 182 | # Pattern rule for checking to see if a variable with a directory exists | 
|---|
| 183 | %.checkdir: | 
|---|
| 184 | @if [ ! -d $($*) ] ; then \ | 
|---|
| 185 | $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \ | 
|---|
| 186 | fi | 
|---|
| 187 |  | 
|---|
| 188 | # Pattern rule for checking to see if a variable with a file exists | 
|---|
| 189 | %.checkfil: | 
|---|
| 190 | @if [ ! -f $($*) ] ; then \ | 
|---|
| 191 | $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \ | 
|---|
| 192 | fi | 
|---|
| 193 |  | 
|---|
| 194 | # Misc notes on help | 
|---|
| 195 | notes_help: | 
|---|
| 196 | @$(ECHO) "\ | 
|---|
| 197 | --- Notes --- \n\ | 
|---|
| 198 | - All builds use same output directory unless overridden with \n\ | 
|---|
| 199 | \t ALT_OUTPUTDIR=<dir>, changing from product to fastdebug you may want \n\ | 
|---|
| 200 | \t to use the clean target first. \n\ | 
|---|
| 201 | - LANGTOOLS_DIST must refer to a langtools dist area,  used to build. \n\ | 
|---|
| 202 | - CORBA_DIST must refer to a corba dist area. \n\ | 
|---|
| 203 | - JAXP_DIST must refer to a jaxp dist area. \n\ | 
|---|
| 204 | - JAXWS_DIST must refer to a jaxws dist area. \n\ | 
|---|
| 205 | - JDK_IMPORT_PATH must refer to a compatible build, not all past promoted \n\ | 
|---|
| 206 | \t builds or previous release JDK builds will work. \n\ | 
|---|
| 207 | - The 'debug' target and 'import_debug' only works when a debug promoted \n\ | 
|---|
| 208 | \t build is available, and they currently are not. \n\ | 
|---|
| 209 | - The fastest builds have been when the workspace and the BOOTDIR are on \n\ | 
|---|
| 210 | \t local disk. \n\ | 
|---|
| 211 | " | 
|---|
| 212 |  | 
|---|
| 213 | examples_help: | 
|---|
| 214 | @$(ECHO) "\ | 
|---|
| 215 | --- Examples --- \n\ | 
|---|
| 216 | $(MAKE) fastdebug \n\ | 
|---|
| 217 | $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all \n\ | 
|---|
| 218 | $(MAKE) ALT_OUTPUTDIR=/tmp/foobar fastdebug images \n\ | 
|---|
| 219 | $(MAKE) ALT_OUTPUTDIR=/tmp/foobar all docs images \n\ | 
|---|
| 220 | $(MAKE) ALT_BOOTDIR=/opt/java/jdk1.6.0 \n\ | 
|---|
| 221 | $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk1.7.0 \n\ | 
|---|
| 222 | " | 
|---|
| 223 |  | 
|---|
| 224 | # | 
|---|
| 225 | # 'all' target intro | 
|---|
| 226 | # | 
|---|
| 227 | all:: | 
|---|
| 228 | @$(ECHO) $(PLATFORM) $(ARCH) $(RELEASE) build started: $(shell $(DATE) '+%y-%m-%d %H:%M') | 
|---|
| 229 |  | 
|---|
| 230 | # Just in case anyone uses this old name, same as 'build' | 
|---|
| 231 | optimized: build | 
|---|
| 232 |  | 
|---|
| 233 | openjdk: | 
|---|
| 234 | $(MAKE) OPENJDK=true all | 
|---|
| 235 |  | 
|---|
| 236 | # | 
|---|
| 237 | # Special debug rules (You may also want to set ALT_OUTPUTDIR) | 
|---|
| 238 | # | 
|---|
| 239 | debug: | 
|---|
| 240 | $(MAKE) VARIANT=DBG all | 
|---|
| 241 | fastdebug: | 
|---|
| 242 | $(MAKE) VARIANT=DBG FASTDEBUG=true all | 
|---|
| 243 |  | 
|---|
| 244 | # | 
|---|
| 245 | # Rules to re-import VM and other JDK files | 
|---|
| 246 | # | 
|---|
| 247 | import: | 
|---|
| 248 | $(CD) java/redist; $(MAKE) clean all | 
|---|
| 249 |  | 
|---|
| 250 | import_fastdebug: | 
|---|
| 251 | $(MAKE) VARIANT=DBG FASTDEBUG=true import | 
|---|
| 252 |  | 
|---|
| 253 | import_product: | 
|---|
| 254 | $(MAKE) VARIANT=OPT FASTDEBUG=false import | 
|---|
| 255 |  | 
|---|
| 256 | # | 
|---|
| 257 | # Core. | 
|---|
| 258 | # | 
|---|
| 259 |  | 
|---|
| 260 | all build:: sanity-all post-sanity-all | 
|---|
| 261 |  | 
|---|
| 262 | SUBDIRS    = tools java javax org sun sunw com jpda mkdemo mksample launchers | 
|---|
| 263 | all build:: | 
|---|
| 264 | $(SUBDIRS-loop) | 
|---|
| 265 |  | 
|---|
| 266 | clean clobber:: | 
|---|
| 267 | $(RM) -r $(OUTPUTDIR) | 
|---|
| 268 |  | 
|---|
| 269 | # | 
|---|
| 270 | # Docs | 
|---|
| 271 | # | 
|---|
| 272 | OTHERSUBDIRS = docs | 
|---|
| 273 | docs:: sanity-docs post-sanity-docs | 
|---|
| 274 | $(OTHERSUBDIRS-loop) | 
|---|
| 275 |  | 
|---|
| 276 | # | 
|---|
| 277 | # Release engineering targets. | 
|---|
| 278 | # | 
|---|
| 279 | include $(BUILDDIR)/common/Release.gmk | 
|---|
| 280 |  | 
|---|
| 281 | # | 
|---|
| 282 | # Cscope targets. | 
|---|
| 283 | # | 
|---|
| 284 | include $(BUILDDIR)/common/Cscope.gmk | 
|---|
| 285 |  | 
|---|
| 286 | # | 
|---|
| 287 | # Sanity checks. | 
|---|
| 288 | # | 
|---|
| 289 | include $(BUILDDIR)/common/Sanity.gmk | 
|---|
| 290 |  | 
|---|
| 291 | $(OUTPUTDIR) $(TEMPDIR): | 
|---|
| 292 | $(MKDIR) -p $@ | 
|---|
| 293 |  | 
|---|
| 294 | # cleanup everything. If the workspace is not being built by the control | 
|---|
| 295 | # workspace, and if it is a Teamware workspace, then see if there are | 
|---|
| 296 | # any files which are not under SCCS control. | 
|---|
| 297 | clean clobber:: | 
|---|
| 298 | ifndef EXTERNALSANITYCONTROL | 
|---|
| 299 | @if [ -d $(TOPDIR)/Codemgr_wsdata ]; then \ | 
|---|
| 300 | $(ECHO) '\nPerforming workspace scan for remnant files.\n' \ | 
|---|
| 301 | '  Any files listed below are not under SCCS control in the workspace\n' \ | 
|---|
| 302 | '  and you should review them and possibly remove them manually:' ; \ | 
|---|
| 303 | $(FIND) $(TOPDIR)/make $(TOPDIR)/src -type f | \ | 
|---|
| 304 | $(SED) 's+SCCS/[ps]\.++' | $(SORT) | $(UNIQ) -c | $(NAWK) '$$1<2 {print $$2;}' ; \ | 
|---|
| 305 | $(ECHO) 'End of workspace scan.' ; \ | 
|---|
| 306 | fi | 
|---|
| 307 | endif | 
|---|
| 308 |  | 
|---|
| 309 | # this should be the last rule in this file: | 
|---|
| 310 | all:: | 
|---|
| 311 | @if [ -r $(WARNING_FILE) ]; then \ | 
|---|
| 312 | $(CAT) $(WARNING_FILE) ; \ | 
|---|
| 313 | fi | 
|---|
| 314 | @$(ECHO) $(PLATFORM) $(ARCH) $(RELEASE) build finished: $(shell $(DATE) '+%y-%m-%d %H:%M') | 
|---|
| 315 |  | 
|---|
| 316 | # | 
|---|
| 317 | # Developer rule that links 32 and 64 bit builds on Solaris by creating | 
|---|
| 318 | #   softlinks in the 32bit outputdir to the 64bit outputdir. | 
|---|
| 319 | # | 
|---|
| 320 | ifeq ($(PLATFORM), solaris) | 
|---|
| 321 | ifeq ($(ARCH_FAMILY), sparc) | 
|---|
| 322 | ARCH32 = sparc | 
|---|
| 323 | ARCH64 = sparcv9 | 
|---|
| 324 | else | 
|---|
| 325 | ARCH32 = i586 | 
|---|
| 326 | ARCH64 = amd64 | 
|---|
| 327 | endif | 
|---|
| 328 | OUTPUTDIR32      = $(ABS_OUTPUTDIR)/../$(PLATFORM)-$(ARCH32) | 
|---|
| 329 | OUTPUTDIR64      = $(ABS_OUTPUTDIR)/../$(PLATFORM)-$(ARCH64) | 
|---|
| 330 | endif | 
|---|
| 331 |  | 
|---|
| 332 | create_links: | 
|---|
| 333 | ifeq ($(PLATFORM), solaris) | 
|---|
| 334 | @if [ -d $(OUTPUTDIR32) -a -d $(OUTPUTDIR64) ] ; then \ | 
|---|
| 335 | dirlist=`($(CD) $(OUTPUTDIR64); $(FIND) . -name $(ARCH64))`; \ | 
|---|
| 336 | for sd in $$dirlist ; do \ | 
|---|
| 337 | pdir=`$(DIRNAME) $$sd`; \ | 
|---|
| 338 | if [ -d $(OUTPUTDIR32)/$$pdir ] ; then \ | 
|---|
| 339 | echo "Creating link for $$sd"; \ | 
|---|
| 340 | (cd $(OUTPUTDIR32)/$$pdir; $(RM) $(ARCH64); \ | 
|---|
| 341 | $(LN) -s $(OUTPUTDIR64)/$$sd ); \ | 
|---|
| 342 | fi; \ | 
|---|
| 343 | done; \ | 
|---|
| 344 | else \ | 
|---|
| 345 | $(ECHO) "Build both 32 and 64 bit versions first"; \ | 
|---|
| 346 | fi | 
|---|
| 347 | else | 
|---|
| 348 | $(ECHO) "Rule $@ does not apply on $(PLATFORM)-$(ARCH)" | 
|---|
| 349 | endif | 
|---|
| 350 |  | 
|---|
| 351 | # | 
|---|
| 352 | # Binary Plug rules and macros | 
|---|
| 353 | # | 
|---|
| 354 | include $(BUILDDIR)/common/internal/BinaryPlugs.gmk | 
|---|
| 355 |  | 
|---|
| 356 | # | 
|---|
| 357 | # Get top level sccs_get rule | 
|---|
| 358 | # | 
|---|
| 359 | include $(BUILDDIR)/common/Rules-SCCS.gmk | 
|---|
| 360 |  | 
|---|
| 361 | # JPRT rules | 
|---|
| 362 | include jprt.gmk | 
|---|
| 363 |  | 
|---|
| 364 | # | 
|---|
| 365 | # Phonies to avoid accidents. | 
|---|
| 366 | # | 
|---|
| 367 | .PHONY: all build clean clobber optimized debug fastdebug create_links \ | 
|---|
| 368 | import import_product import_fastdebug import_debug | 
|---|
| 369 |  | 
|---|