NewMakefile.gmk

Sat, 23 Feb 2013 10:47:01 -0800

author
ohair
date
Sat, 23 Feb 2013 10:47:01 -0800
changeset 632
d3e3d5b06f45
parent 624
7ed0c9db6943
child 713
eea249c1ecee
permissions
-rw-r--r--

8004712: build-infra: Move user guide from web pages to repository
Summary: Just the initial work, will need more changes.
Reviewed-by: tbell

ohair@478 1 #
ohair@478 2 # Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
ohair@478 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ohair@478 4 #
ohair@478 5 # This code is free software; you can redistribute it and/or modify it
ohair@478 6 # under the terms of the GNU General Public License version 2 only, as
ohair@478 7 # published by the Free Software Foundation. Oracle designates this
ohair@478 8 # particular file as subject to the "Classpath" exception as provided
ohair@478 9 # by Oracle in the LICENSE file that accompanied this code.
ohair@478 10 #
ohair@478 11 # This code is distributed in the hope that it will be useful, but WITHOUT
ohair@478 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ohair@478 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ohair@478 14 # version 2 for more details (a copy is included in the LICENSE file that
ohair@478 15 # accompanied this code).
ohair@478 16 #
ohair@478 17 # You should have received a copy of the GNU General Public License version
ohair@478 18 # 2 along with this work; if not, write to the Free Software Foundation,
ohair@478 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ohair@478 20 #
ohair@478 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@478 22 # or visit www.oracle.com if you need additional information or have any
ohair@478 23 # questions.
ohair@478 24 #
ohair@478 25
erikj@559 26 # This must be the first rule
erikj@559 27 default:
ohair@478 28
erikj@559 29 # Inclusion of this pseudo-target will cause make to execute this file
erikj@559 30 # serially, regardless of -j. Recursively called makefiles will not be
erikj@559 31 # affected, however. This is required for correct dependency management.
erikj@559 32 .NOTPARALLEL:
ohair@478 33
erikj@559 34 # The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU make.
erikj@559 35 # /usr/ccs/bin/make lacks basically every other flow control mechanism.
erikj@559 36 TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1
ohair@478 37
erikj@559 38 # Assume we have GNU make, but check version.
erikj@559 39 ifeq (,$(findstring 3.81,$(MAKE_VERSION)))
erikj@559 40 ifeq (,$(findstring 3.82,$(MAKE_VERSION)))
erikj@559 41 $(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 3.81 or newer.)
erikj@559 42 endif
ohair@478 43 endif
ohair@478 44
erikj@559 45 # Locate this Makefile
erikj@559 46 ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),)
erikj@559 47 makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST))
erikj@559 48 else
erikj@559 49 makefile_path:=$(lastword $(MAKEFILE_LIST))
erikj@559 50 endif
erikj@559 51 root_dir:=$(dir $(makefile_path))
ohair@478 52
erikj@559 53 # ... and then we can include our helper functions
erikj@559 54 include $(root_dir)/common/makefiles/MakeHelpers.gmk
ohair@478 55
erikj@559 56 $(eval $(call ParseLogLevel))
erikj@559 57 $(eval $(call ParseConfAndSpec))
ohair@478 58
erikj@559 59 # Now determine if we have zero, one or several configurations to build.
erikj@559 60 ifeq ($(SPEC),)
erikj@559 61 # Since we got past ParseConfAndSpec, we must be building a global target. Do nothing.
erikj@559 62 else
erikj@559 63 ifeq ($(words $(SPEC)),1)
erikj@559 64 # We are building a single configuration. This is the normal case. Execute the Main.gmk file.
erikj@559 65 include $(root_dir)/common/makefiles/Main.gmk
erikj@559 66 else
erikj@559 67 # We are building multiple configurations.
erikj@559 68 # First, find out the valid targets
erikj@559 69 # Run the makefile with an arbitraty SPEC using -p -q (quiet dry-run and dump rules) to find
erikj@559 70 # available PHONY targets. Use this list as valid targets to pass on to the repeated calls.
erikj@559 71 all_phony_targets=$(filter-out $(global_targets), $(strip $(shell \
erikj@559 72 $(MAKE) -p -q -f common/makefiles SPEC=$(firstword $(SPEC)) | \
erikj@559 73 grep ^.PHONY: | head -n 1 | cut -d " " -f 2-)))
ohair@478 74
erikj@559 75 $(all_phony_targets):
erikj@559 76 @$(foreach spec,$(SPEC),($(MAKE) -f NewMakefile.gmk SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) $@) &&) true
ohair@478 77
erikj@559 78 endif
erikj@559 79 endif
ohair@494 80
erikj@578 81 # Include this after a potential spec file has been included so that the bundles target
erikj@578 82 # has access to the spec variables.
erikj@578 83 include $(root_dir)/common/makefiles/Jprt.gmk
erikj@578 84
erikj@559 85 # Here are "global" targets, i.e. targets that can be executed without specifying a single configuration.
erikj@559 86 # If you addd more global targets, please update the variable global_targets in MakeHelpers.
ohair@494 87
ohair@494 88 help:
erikj@559 89 $(info )
erikj@559 90 $(info OpenJDK Makefile help)
erikj@559 91 $(info =====================)
erikj@559 92 $(info )
erikj@559 93 $(info Common make targets)
erikj@559 94 $(info . make [default] # Compile all product in langtools, hotspot, jaxp, jaxws,)
erikj@559 95 $(info . # corba and jdk)
erikj@559 96 $(info . make all # Compile everything, all repos and images)
erikj@559 97 $(info . make images # Create complete j2sdk and j2re images)
erikj@559 98 $(info . make overlay-images # Create limited images for sparc 64 bit platforms)
dholmes@624 99 $(info . make profiles # Create complete j2re compact profile images)
erikj@559 100 $(info . make bootcycle-images # Build images twice, second time with newly build JDK)
erikj@559 101 $(info . make install # Install the generated images locally)
erikj@559 102 $(info . make clean # Remove all files generated by make, but not those)
erikj@559 103 $(info . # generated by configure)
erikj@559 104 $(info . make dist-clean # Remove all files, including configuration)
erikj@559 105 $(info . make help # Give some help on using make)
erikj@559 106 $(info . make test # Run tests, default is all tests (see TEST below))
erikj@559 107 $(info )
erikj@559 108 $(info Targets for specific components)
erikj@559 109 $(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk, images or overlay-images))
erikj@559 110 $(info . make <component> # Build <component> and everything it depends on. )
erikj@559 111 $(info . make <component>-only # Build <component> only, without dependencies. This)
erikj@559 112 $(info . # is faster but can result in incorrect build results!)
erikj@559 113 $(info . make clean-<component> # Remove files generated by make for <component>)
erikj@559 114 $(info )
erikj@559 115 $(info Useful make variables)
erikj@559 116 $(info . make CONF= # Build all configurations (note, assignment is empty))
erikj@559 117 $(info . make CONF=<substring> # Build the configuration(s) with a name matching)
erikj@559 118 $(info . # <substring>)
erikj@559 119 $(info )
erikj@559 120 $(info . make LOG=<loglevel> # Change the log level from warn to <loglevel>)
erikj@559 121 $(info . # Available log levels are:)
erikj@559 122 $(info . # 'warn' (default), 'info', 'debug' and 'trace')
erikj@559 123 $(info . # To see executed command lines, use LOG=debug)
erikj@559 124 $(info )
erikj@559 125 $(info . make JOBS=<n> # Run <n> parallel make jobs)
erikj@559 126 $(info . # Note that -jN does not work as expected!)
erikj@559 127 $(info )
erikj@559 128 $(info . make test TEST=<test> # Only run the given test or tests, e.g.)
erikj@559 129 $(info . # make test TEST="jdk_lang jdk_net")
erikj@559 130 $(info )
ohair@494 131
erikj@559 132 .PHONY: help

mercurial