blob: dcd928718df9a27a9054089ea47bb5f8be35da4d [file] [log] [blame]
Kelly O'Hair228c2162012-09-18 11:29:16 -07001#
2# Copyright (c) 2012, Oracle and/or its affiliates. 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. Oracle designates this
8# particular file as subject to the "Classpath" exception as provided
9# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22# or visit www.oracle.com if you need additional information or have any
23# questions.
24#
25
Erik Joelsson8ae16062012-12-28 09:51:15 +010026# This must be the first rule
27default:
28
29# Inclusion of this pseudo-target will cause make to execute this file
30# serially, regardless of -j. Recursively called makefiles will not be
31# affected, however. This is required for correct dependency management.
32.NOTPARALLEL:
33
34# The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU make.
35# /usr/ccs/bin/make lacks basically every other flow control mechanism.
36TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1
37
38# Assume we have GNU make, but check version.
39ifeq (,$(findstring 3.81,$(MAKE_VERSION)))
40 ifeq (,$(findstring 3.82,$(MAKE_VERSION)))
41 $(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 3.81 or newer.)
42 endif
43endif
44
45# Locate this Makefile
46ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),)
47 makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST))
Kelly O'Hair228c2162012-09-18 11:29:16 -070048else
Erik Joelsson8ae16062012-12-28 09:51:15 +010049 makefile_path:=$(lastword $(MAKEFILE_LIST))
Kelly O'Hair228c2162012-09-18 11:29:16 -070050endif
Erik Joelsson8ae16062012-12-28 09:51:15 +010051root_dir:=$(dir $(makefile_path))
Kelly O'Hair228c2162012-09-18 11:29:16 -070052
Erik Joelsson8ae16062012-12-28 09:51:15 +010053include $(root_dir)/common/makefiles/Jprt.gmk
Kelly O'Hair228c2162012-09-18 11:29:16 -070054
Erik Joelsson8ae16062012-12-28 09:51:15 +010055# ... and then we can include our helper functions
56include $(root_dir)/common/makefiles/MakeHelpers.gmk
Kelly O'Hair228c2162012-09-18 11:29:16 -070057
Erik Joelsson8ae16062012-12-28 09:51:15 +010058$(eval $(call ParseLogLevel))
59$(eval $(call ParseConfAndSpec))
Kelly O'Hair228c2162012-09-18 11:29:16 -070060
Erik Joelsson8ae16062012-12-28 09:51:15 +010061# Now determine if we have zero, one or several configurations to build.
62ifeq ($(SPEC),)
63 # Since we got past ParseConfAndSpec, we must be building a global target. Do nothing.
64else
65 ifeq ($(words $(SPEC)),1)
66 # We are building a single configuration. This is the normal case. Execute the Main.gmk file.
67 include $(root_dir)/common/makefiles/Main.gmk
68 else
69 # We are building multiple configurations.
70 # First, find out the valid targets
71 # Run the makefile with an arbitraty SPEC using -p -q (quiet dry-run and dump rules) to find
72 # available PHONY targets. Use this list as valid targets to pass on to the repeated calls.
73 all_phony_targets=$(filter-out $(global_targets), $(strip $(shell \
74 $(MAKE) -p -q -f common/makefiles SPEC=$(firstword $(SPEC)) | \
75 grep ^.PHONY: | head -n 1 | cut -d " " -f 2-)))
Kelly O'Hair228c2162012-09-18 11:29:16 -070076
Erik Joelsson8ae16062012-12-28 09:51:15 +010077$(all_phony_targets):
78 @$(foreach spec,$(SPEC),($(MAKE) -f NewMakefile.gmk SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) $@) &&) true
Kelly O'Hair228c2162012-09-18 11:29:16 -070079
Erik Joelsson8ae16062012-12-28 09:51:15 +010080 endif
Kelly O'Hair228c2162012-09-18 11:29:16 -070081endif
82
Erik Joelsson8ae16062012-12-28 09:51:15 +010083# Here are "global" targets, i.e. targets that can be executed without specifying a single configuration.
84# If you addd more global targets, please update the variable global_targets in MakeHelpers.
Kelly O'Hairf9c6f4b2012-10-26 14:29:57 -070085
86help:
Erik Joelsson8ae16062012-12-28 09:51:15 +010087 $(info )
88 $(info OpenJDK Makefile help)
89 $(info =====================)
90 $(info )
91 $(info Common make targets)
92 $(info . make [default] # Compile all product in langtools, hotspot, jaxp, jaxws,)
93 $(info . # corba and jdk)
94 $(info . make all # Compile everything, all repos and images)
95 $(info . make images # Create complete j2sdk and j2re images)
96 $(info . make overlay-images # Create limited images for sparc 64 bit platforms)
97 $(info . make bootcycle-images # Build images twice, second time with newly build JDK)
98 $(info . make install # Install the generated images locally)
99 $(info . make clean # Remove all files generated by make, but not those)
100 $(info . # generated by configure)
101 $(info . make dist-clean # Remove all files, including configuration)
102 $(info . make help # Give some help on using make)
103 $(info . make test # Run tests, default is all tests (see TEST below))
104 $(info )
105 $(info Targets for specific components)
106 $(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk, images or overlay-images))
107 $(info . make <component> # Build <component> and everything it depends on. )
108 $(info . make <component>-only # Build <component> only, without dependencies. This)
109 $(info . # is faster but can result in incorrect build results!)
110 $(info . make clean-<component> # Remove files generated by make for <component>)
111 $(info )
112 $(info Useful make variables)
113 $(info . make CONF= # Build all configurations (note, assignment is empty))
114 $(info . make CONF=<substring> # Build the configuration(s) with a name matching)
115 $(info . # <substring>)
116 $(info )
117 $(info . make LOG=<loglevel> # Change the log level from warn to <loglevel>)
118 $(info . # Available log levels are:)
119 $(info . # 'warn' (default), 'info', 'debug' and 'trace')
120 $(info . # To see executed command lines, use LOG=debug)
121 $(info )
122 $(info . make JOBS=<n> # Run <n> parallel make jobs)
123 $(info . # Note that -jN does not work as expected!)
124 $(info )
125 $(info . make test TEST=<test> # Only run the given test or tests, e.g.)
126 $(info . # make test TEST="jdk_lang jdk_net")
127 $(info )
Kelly O'Hairf9c6f4b2012-10-26 14:29:57 -0700128
Erik Joelsson8ae16062012-12-28 09:51:15 +0100129.PHONY: help