J. Duke | 686d76f | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 1 | # |
Magnus Ihse Bursie | 1a8ec8e | 2013-11-14 10:53:23 +0100 | [diff] [blame] | 2 | # Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
J. Duke | 686d76f | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 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 |
Kelly O'Hair | 136614e | 2010-05-25 15:51:26 -0700 | [diff] [blame] | 7 | # published by the Free Software Foundation. Oracle designates this |
J. Duke | 686d76f | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 8 | # particular file as subject to the "Classpath" exception as provided |
Kelly O'Hair | 136614e | 2010-05-25 15:51:26 -0700 | [diff] [blame] | 9 | # by Oracle in the LICENSE file that accompanied this code. |
J. Duke | 686d76f | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 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 | # |
Kelly O'Hair | 136614e | 2010-05-25 15:51:26 -0700 | [diff] [blame] | 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. |
J. Duke | 686d76f | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 24 | # |
| 25 | |
Magnus Ihse Bursie | 1a8ec8e | 2013-11-14 10:53:23 +0100 | [diff] [blame] | 26 | # This must be the first rule |
| 27 | default: |
Kelly O'Hair | 228c216 | 2012-09-18 11:29:16 -0700 | [diff] [blame] | 28 | |
Magnus Ihse Bursie | 1a8ec8e | 2013-11-14 10:53:23 +0100 | [diff] [blame] | 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. |
| 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 |
| 37 | |
| 38 | # Assume we have GNU make, but check version. |
| 39 | ifeq ($(strip $(foreach v, 3.81% 3.82% 4.%, $(filter $v, $(MAKE_VERSION)))), ) |
| 40 | $(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 3.81 or newer.) |
Kelly O'Hair | ec348ed | 2013-01-04 21:04:03 -0800 | [diff] [blame] | 41 | endif |
| 42 | |
Magnus Ihse Bursie | 1a8ec8e | 2013-11-14 10:53:23 +0100 | [diff] [blame] | 43 | # Locate this Makefile |
| 44 | ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),) |
| 45 | makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST)) |
Kelly O'Hair | fa892cf | 2008-08-06 14:57:13 -0700 | [diff] [blame] | 46 | else |
Magnus Ihse Bursie | 1a8ec8e | 2013-11-14 10:53:23 +0100 | [diff] [blame] | 47 | makefile_path:=$(lastword $(MAKEFILE_LIST)) |
| 48 | endif |
| 49 | root_dir:=$(dir $(makefile_path)) |
Kelly O'Hair | fa892cf | 2008-08-06 14:57:13 -0700 | [diff] [blame] | 50 | |
Magnus Ihse Bursie | 1a8ec8e | 2013-11-14 10:53:23 +0100 | [diff] [blame] | 51 | # ... and then we can include our helper functions |
| 52 | include $(root_dir)/make/MakeHelpers.gmk |
Kelly O'Hair | fa892cf | 2008-08-06 14:57:13 -0700 | [diff] [blame] | 53 | |
Magnus Ihse Bursie | 1a8ec8e | 2013-11-14 10:53:23 +0100 | [diff] [blame] | 54 | $(eval $(call ParseLogLevel)) |
| 55 | $(eval $(call ParseConfAndSpec)) |
| 56 | |
| 57 | # Now determine if we have zero, one or several configurations to build. |
| 58 | ifeq ($(SPEC),) |
| 59 | # Since we got past ParseConfAndSpec, we must be building a global target. Do nothing. |
| 60 | else |
| 61 | ifeq ($(words $(SPEC)),1) |
| 62 | # We are building a single configuration. This is the normal case. Execute the Main.gmk file. |
| 63 | include $(root_dir)/make/Main.gmk |
| 64 | else |
| 65 | # We are building multiple configurations. |
| 66 | # First, find out the valid targets |
| 67 | # Run the makefile with an arbitrary SPEC using -p -q (quiet dry-run and dump rules) to find |
| 68 | # available PHONY targets. Use this list as valid targets to pass on to the repeated calls. |
Mikael Vidstedt | c352c89 | 2014-07-15 18:46:37 -0700 | [diff] [blame] | 69 | all_phony_targets=$(filter-out $(global_targets), $(strip $(shell \ |
Magnus Ihse Bursie | e5e1bbd | 2013-12-09 14:43:16 +0100 | [diff] [blame] | 70 | cd $(root_dir) && $(MAKE) -p -q FRC SPEC=$(firstword $(SPEC)) | \ |
Magnus Ihse Bursie | 1a8ec8e | 2013-11-14 10:53:23 +0100 | [diff] [blame] | 71 | grep ^.PHONY: | head -n 1 | cut -d " " -f 2-))) |
| 72 | |
| 73 | $(all_phony_targets): |
Magnus Ihse Bursie | e5e1bbd | 2013-12-09 14:43:16 +0100 | [diff] [blame] | 74 | @$(foreach spec,$(SPEC),(cd $(root_dir) && $(MAKE) SPEC=$(spec) \ |
Magnus Ihse Bursie | 1a8ec8e | 2013-11-14 10:53:23 +0100 | [diff] [blame] | 75 | $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $@) &&) true |
| 76 | |
| 77 | .PHONY: $(all_phony_targets) |
| 78 | |
| 79 | endif |
Kelly O'Hair | fa892cf | 2008-08-06 14:57:13 -0700 | [diff] [blame] | 80 | endif |
| 81 | |
Magnus Ihse Bursie | 1a8ec8e | 2013-11-14 10:53:23 +0100 | [diff] [blame] | 82 | # Here are "global" targets, i.e. targets that can be executed without specifying a single configuration. |
| 83 | # If you addd more global targets, please update the variable global_targets in MakeHelpers. |
Kelly O'Hair | 0eca63f | 2010-06-21 11:00:15 -0700 | [diff] [blame] | 84 | |
Magnus Ihse Bursie | 1a8ec8e | 2013-11-14 10:53:23 +0100 | [diff] [blame] | 85 | help: |
| 86 | $(info ) |
| 87 | $(info OpenJDK Makefile help) |
| 88 | $(info =====================) |
| 89 | $(info ) |
| 90 | $(info Common make targets) |
| 91 | $(info . make [default] # Compile all product in langtools, hotspot, jaxp, jaxws,) |
| 92 | $(info . # corba and jdk) |
| 93 | $(info . make all # Compile everything, all repos and images) |
| 94 | $(info . make images # Create complete j2sdk and j2re images) |
| 95 | $(info . make docs # Create javadocs) |
| 96 | $(info . make overlay-images # Create limited images for sparc 64 bit platforms) |
| 97 | $(info . make profiles # Create complete j2re compact profile images) |
| 98 | $(info . make bootcycle-images # Build images twice, second time with newly build JDK) |
| 99 | $(info . make install # Install the generated images locally) |
| 100 | $(info . make clean # Remove all files generated by make, but not those) |
| 101 | $(info . # generated by configure) |
| 102 | $(info . make dist-clean # Remove all files, including configuration) |
| 103 | $(info . make help # Give some help on using make) |
| 104 | $(info . make test # Run tests, default is all tests (see TEST below)) |
| 105 | $(info ) |
| 106 | $(info Targets for specific components) |
| 107 | $(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk, nashorn, images, overlay-images, docs or test)) |
| 108 | $(info . make <component> # Build <component> and everything it depends on. ) |
| 109 | $(info . make <component>-only # Build <component> only, without dependencies. This) |
| 110 | $(info . # is faster but can result in incorrect build results!) |
| 111 | $(info . make clean-<component> # Remove files generated by make for <component>) |
| 112 | $(info ) |
| 113 | $(info Useful make variables) |
| 114 | $(info . make CONF= # Build all configurations (note, assignment is empty)) |
| 115 | $(info . make CONF=<substring> # Build the configuration(s) with a name matching) |
| 116 | $(info . # <substring>) |
| 117 | $(info ) |
| 118 | $(info . make LOG=<loglevel> # Change the log level from warn to <loglevel>) |
| 119 | $(info . # Available log levels are:) |
| 120 | $(info . # 'warn' (default), 'info', 'debug' and 'trace') |
| 121 | $(info . # To see executed command lines, use LOG=debug) |
| 122 | $(info ) |
| 123 | $(info . make JOBS=<n> # Run <n> parallel make jobs) |
| 124 | $(info . # Note that -jN does not work as expected!) |
| 125 | $(info ) |
| 126 | $(info . make test TEST=<test> # Only run the given test or tests, e.g.) |
| 127 | $(info . # make test TEST="jdk_lang jdk_net") |
| 128 | $(info ) |
Kelly O'Hair | fa892cf | 2008-08-06 14:57:13 -0700 | [diff] [blame] | 129 | |
Magnus Ihse Bursie | 1a8ec8e | 2013-11-14 10:53:23 +0100 | [diff] [blame] | 130 | .PHONY: help |