author | duke |
Wed, 05 Jul 2017 18:28:52 +0200 | |
changeset 14355 | dbff70aaaac3 |
parent 14111 | 2a82ecb35fc7 |
child 15053 | 64278cb83950 |
permissions | -rw-r--r-- |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
1 |
# |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
2 |
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
4 |
# |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
5 |
# This code is free software; you can redistribute it and/or modify it |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
6 |
# under the terms of the GNU General Public License version 2 only, as |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
7 |
# published by the Free Software Foundation. Oracle designates this |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
8 |
# particular file as subject to the "Classpath" exception as provided |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
9 |
# by Oracle in the LICENSE file that accompanied this code. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
10 |
# |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
15 |
# accompanied this code). |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
16 |
# |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
17 |
# You should have received a copy of the GNU General Public License version |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation, |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
20 |
# |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
21 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
22 |
# or visit www.oracle.com if you need additional information or have any |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
23 |
# questions. |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
24 |
# |
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
25 |
|
12801 | 26 |
# This must be the first rule |
14111 | 27 |
all: |
12801 | 28 |
|
13697 | 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 |
||
14111 | 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 (,$(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 |
|
43 |
endif |
|
44 |
||
13132 | 45 |
# Locate this Makefile |
46 |
ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),) |
|
47 |
makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST)) |
|
12801 | 48 |
else |
13132 | 49 |
makefile_path:=$(lastword $(MAKEFILE_LIST)) |
12801 | 50 |
endif |
13132 | 51 |
root_dir:=$(patsubst %/common/makefiles/Makefile,%,$(makefile_path)) |
12801 | 52 |
|
13132 | 53 |
# ... and then we can include our helper functions |
54 |
include $(dir $(makefile_path))/MakeHelpers.gmk |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
55 |
|
13132 | 56 |
$(eval $(call ParseLogLevel)) |
57 |
$(eval $(call ParseConfAndSpec)) |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
58 |
|
14111 | 59 |
# Now determine if we have zero, one or several configurations to build. |
60 |
ifeq ($(SPEC),) |
|
61 |
# Since we got past ParseConfAndSpec, we must be building a global target. Do nothing. |
|
62 |
else |
|
63 |
ifeq ($(words $(SPEC)),1) |
|
64 |
# We are building a single configuration. This is the normal case. Execute the Main.gmk file. |
|
65 |
include $(dir $(makefile_path))/Main.gmk |
|
66 |
else |
|
67 |
# We are building multiple configurations. |
|
68 |
# First, find out the valid targets |
|
69 |
# Run the makefile with an arbitraty SPEC using -p -q (quiet dry-run and dump rules) to find |
|
70 |
# available PHONY targets. Use this list as valid targets to pass on to the repeated calls. |
|
71 |
all_phony_targets=$(filter-out $(global_targets), $(strip $(shell \ |
|
72 |
$(MAKE) -p -q -f $(makefile_path) SPEC=$(firstword $(SPEC)) | \ |
|
73 |
grep ^.PHONY: | head -n 1 | cut -d " " -f 2-))) |
|
74 |
||
75 |
$(all_phony_targets): |
|
13697 | 76 |
@$(foreach spec,$(SPEC),($(MAKE) -f $(makefile_path) SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) $@) &&) true |
12801 | 77 |
|
13132 | 78 |
endif |
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
79 |
endif |
12801 | 80 |
|
81 |
# Here are "global" targets, i.e. targets that can be executed without specifying a single configuration. |
|
14111 | 82 |
# If you addd more global targets, please update the variable global_targets in MakeHelpers. |
12801 | 83 |
|
12258
6ec26f6cc53e
7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff
changeset
|
84 |
help: |
12801 | 85 |
$(info ) |
86 |
$(info OpenJDK Makefile help) |
|
87 |
$(info =====================) |
|
88 |
$(info ) |
|
89 |
$(info Common make targets) |
|
13697 | 90 |
$(info . make [all] # Compile all code but do not create images) |
91 |
$(info . make images # Create complete j2sdk and j2re images) |
|
92 |
$(info . make overlay-images # Create limited images for sparc 64 bit platforms) |
|
93 |
$(info . make bootcycle-images # Build images twice, second time with newly build JDK) |
|
94 |
$(info . make install # Install the generated images locally) |
|
95 |
$(info . make clean # Remove all files generated by make, but not those) |
|
96 |
$(info . # generated by configure) |
|
97 |
$(info . make dist-clean # Remove all files, including configuration) |
|
98 |
$(info . make help # Give some help on using make) |
|
99 |
$(info . make test # Run tests, default is all tests (see TEST below)) |
|
100 |
$(info ) |
|
101 |
$(info Targets for specific components) |
|
14111 | 102 |
$(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk, images or overlay-images)) |
13697 | 103 |
$(info . make <component> # Build <component> and everything it depends on. ) |
104 |
$(info . make <component>-only # Build <component> only, without dependencies. This) |
|
105 |
$(info . # is faster but can result in incorrect build results!) |
|
106 |
$(info . make clean-<component> # Remove files generated by make for <component>) |
|
12801 | 107 |
$(info ) |
108 |
$(info Useful make variables) |
|
13697 | 109 |
$(info . make CONF= # Build all configurations (note, assignment is empty)) |
110 |
$(info . make CONF=<substring> # Build the configuration(s) with a name matching) |
|
111 |
$(info . # <substring>) |
|
12801 | 112 |
$(info ) |
13697 | 113 |
$(info . make LOG=<loglevel> # Change the log level from warn to <loglevel>) |
114 |
$(info . # Available log levels are:) |
|
115 |
$(info . # 'warn' (default), 'info', 'debug' and 'trace') |
|
14111 | 116 |
$(info . # To see executed command lines, use LOG=debug) |
12801 | 117 |
$(info ) |
13697 | 118 |
$(info . make JOBS=<n> # Run <n> parallel make jobs) |
119 |
$(info . # Note that -jN does not work as expected!) |
|
120 |
$(info ) |
|
121 |
$(info . make test TEST=<test> # Only run the given test or tests, e.g.) |
|
122 |
$(info . # make test TEST="jdk_lang jdk_net") |
|
12801 | 123 |
$(info ) |
14111 | 124 |
|
125 |
configure: |
|
126 |
@$(SHELL) $(root_dir)/configure $(CONFIGURE_ARGS) |
|
127 |
@echo ==================================================== |
|
128 |
@echo "Note: This is a non-recommended way of running configure." |
|
129 |
@echo "Instead, run 'sh configure' in the top-level directory" |
|
130 |
||
131 |
.PHONY: help configure |