Makefile revision 910:a667caba1e84
1139749Simp#
2138755Simp# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
3138755Simp# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4138755Simp#
5138755Simp# This code is free software; you can redistribute it and/or modify it
6138755Simp# under the terms of the GNU General Public License version 2 only, as
7138755Simp# published by the Free Software Foundation.  Oracle designates this
8138755Simp# particular file as subject to the "Classpath" exception as provided
9140040Simp# by Oracle in the LICENSE file that accompanied this code.
10138755Simp#
11140040Simp# This code is distributed in the hope that it will be useful, but WITHOUT
12140040Simp# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13138755Simp# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14138755Simp# version 2 for more details (a copy is included in the LICENSE file that
15138755Simp# accompanied this code).
16138755Simp#
17140040Simp# You should have received a copy of the GNU General Public License version
18140040Simp# 2 along with this work; if not, write to the Free Software Foundation,
19138755Simp# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20138755Simp#
21138755Simp# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22138755Simp# or visit www.oracle.com if you need additional information or have any
23138755Simp# questions.
24138755Simp#
25138755Simp
26138755Simp# This must be the first rule
27138755Simpdefault:
28138755Simp
29138755Simp# Inclusion of this pseudo-target will cause make to execute this file
30637Snate# serially, regardless of -j. Recursively called makefiles will not be
31637Snate# affected, however. This is required for correct dependency management.
32637Snate.NOTPARALLEL:
33637Snate
34637Snate# The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU make.
35637Snate# /usr/ccs/bin/make lacks basically every other flow control mechanism.
36637SnateTEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1
37637Snate
38637Snate# Assume we have GNU make, but check version.
39637Snateifeq ($(strip $(foreach v, 3.81% 3.82% 4.%, $(filter $v, $(MAKE_VERSION)))), )
40637Snate  $(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 3.81 or newer.)
41637Snateendif
42637Snate
43637Snate# Locate this Makefile
44637Snateifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),)
45637Snate  makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST))
46637Snateelse
47637Snate  makefile_path:=$(lastword $(MAKEFILE_LIST))
48637Snateendif
49637Snateroot_dir:=$(dir $(makefile_path))
50637Snate
51637Snate# ... and then we can include our helper functions
52637Snateinclude $(root_dir)/make/MakeHelpers.gmk
53637Snate
54637Snate$(eval $(call ParseLogLevel))
55637Snate$(eval $(call ParseConfAndSpec))
564259Sjkh
574259Sjkh# Now determine if we have zero, one or several configurations to build.
58637Snateifeq ($(SPEC),)
59637Snate  # Since we got past ParseConfAndSpec, we must be building a global target. Do nothing.
60637Snateelse
61637Snate  ifeq ($(words $(SPEC)),1)
62637Snate    # We are building a single configuration. This is the normal case. Execute the Main.gmk file.
63637Snate    include $(root_dir)/make/Main.gmk
64637Snate  else
65637Snate    # We are building multiple configurations.
66637Snate    # First, find out the valid targets
67637Snate    # Run the makefile with an arbitrary SPEC using -p -q (quiet dry-run and dump rules) to find
68637Snate    # available PHONY targets. Use this list as valid targets to pass on to the repeated calls.
69637Snate    all_phony_targets=$(filter-out $(global_targets) bundles-only, $(strip $(shell \
70637Snate        $(MAKE) -p -q -f make/Main.gmk FRC SPEC=$(firstword $(SPEC)) | \
71637Snate        grep ^.PHONY: | head -n 1 | cut -d " " -f 2-)))
72637Snate
732056Swollman    $(all_phony_targets):
743745Swollman	@$(foreach spec,$(SPEC),($(MAKE) -f NewMakefile.gmk SPEC=$(spec) \
7512658Sbde	    $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $@) &&) true
762056Swollman
77129882Sphk    .PHONY: $(all_phony_targets)
7858229Syokota
7929368Speter  endif
8071286Swollmanendif
812056Swollman
8266860Sphk# Include this after a potential spec file has been included so that the bundles target
83637Snate# has access to the spec variables.
8458229Syokotainclude $(root_dir)/make/Jprt.gmk
8558229Syokota
8658229Syokota# Here are "global" targets, i.e. targets that can be executed without specifying a single configuration.
877430Sbde# If you addd more global targets, please update the variable global_targets in MakeHelpers.
8858229Syokota
89637Snatehelp:
90138755Simp	$(info )
9131603Syokota	$(info OpenJDK Makefile help)
92138755Simp	$(info =====================)
93637Snate	$(info )
9412675Sjulian	$(info Common make targets)
9512675Sjulian	$(info .  make [default]         # Compile all product in langtools, hotspot, jaxp, jaxws,)
9612675Sjulian	$(info .                         # corba and jdk)
9731603Syokota	$(info .  make all               # Compile everything, all repos and images)
9829368Speter	$(info .  make images            # Create complete j2sdk and j2re images)
9912675Sjulian	$(info .  make docs              # Create javadocs)
10047625Sphk	$(info .  make overlay-images    # Create limited images for sparc 64 bit platforms)
101126080Sphk	$(info .  make profiles          # Create complete j2re compact profile images)
102111815Sphk	$(info .  make bootcycle-images  # Build images twice, second time with newly build JDK)
103111815Sphk	$(info .  make install           # Install the generated images locally)
104111815Sphk	$(info .  make clean             # Remove all files generated by make, but not those)
105111815Sphk	$(info .                         # generated by configure)
106111815Sphk	$(info .  make dist-clean        # Remove all files, including configuration)
107111815Sphk	$(info .  make help              # Give some help on using make)
10847625Sphk	$(info .  make test              # Run tests, default is all tests (see TEST below))
10912675Sjulian	$(info )
11092765Salfred	$(info Targets for specific components)
111272956Sjhb	$(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk, nashorn, images, overlay-images, docs or test))
112272956Sjhb	$(info .  make <component>       # Build <component> and everything it depends on. )
11312675Sjulian	$(info .  make <component>-only  # Build <component> only, without dependencies. This)
114272956Sjhb	$(info .                         # is faster but can result in incorrect build results!)
115637Snate	$(info .  make clean-<component> # Remove files generated by make for <component>)
116637Snate	$(info )
117637Snate	$(info Useful make variables)
118138755Simp	$(info .  make CONF=             # Build all configurations (note, assignment is empty))
119138755Simp	$(info .  make CONF=<substring>  # Build the configuration(s) with a name matching)
120637Snate	$(info .                         # <substring>)
12158229Syokota	$(info )
122138755Simp	$(info .  make LOG=<loglevel>    # Change the log level from warn to <loglevel>)
123637Snate	$(info .                         # Available log levels are:)
12458229Syokota	$(info .                         # 'warn' (default), 'info', 'debug' and 'trace')
12558229Syokota	$(info .                         # To see executed command lines, use LOG=debug)
126272956Sjhb	$(info )
127272956Sjhb	$(info .  make JOBS=<n>          # Run <n> parallel make jobs)
12858229Syokota	$(info .                         # Note that -jN does not work as expected!)
12958229Syokota	$(info )
130138755Simp	$(info .  make test TEST=<test>  # Only run the given test or tests, e.g.)
131138755Simp	$(info .                         # make test TEST="jdk_lang jdk_net")
13258229Syokota	$(info )
13358229Syokota
134272956Sjhb.PHONY: help
13558229Syokota