author | aeremeev |
Wed, 10 Dec 2014 21:45:39 +0200 | |
changeset 27997 | 44407cab4584 |
parent 27602 | 236555ddac42 |
child 28286 | 02d8f96d7c92 |
permissions | -rw-r--r-- |
0 | 1 |
# |
21759 | 2 |
# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
0 | 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 |
|
5499 | 7 |
# published by the Free Software Foundation. Oracle designates this |
0 | 8 |
# particular file as subject to the "Classpath" exception as provided |
5499 | 9 |
# by Oracle in the LICENSE file that accompanied this code. |
0 | 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 |
# |
|
5499 | 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. |
|
0 | 24 |
# |
25 |
||
21759 | 26 |
# This must be the first rule |
27 |
default: |
|
17
bb9f330cd95a
6649672: Adjustments to OUTPUTDIR default and mkdirs to avoid empty directory clutter
ohair
parents:
16
diff
changeset
|
28 |
|
21759 | 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: |
|
9618 | 33 |
|
21759 | 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. |
|
27595
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26548
diff
changeset
|
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 |
0 | 37 |
|
21759 | 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.) |
|
874
638ddad10e12
6728161: Add SKIP_BOOT_CYCLE feature to create boot jdk and use it during build
ohair
parents:
668
diff
changeset
|
41 |
endif |
638ddad10e12
6728161: Add SKIP_BOOT_CYCLE feature to create boot jdk and use it during build
ohair
parents:
668
diff
changeset
|
42 |
|
21759 | 43 |
# Locate this Makefile |
44 |
ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),) |
|
45 |
makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST)) |
|
46 |
else |
|
47 |
makefile_path:=$(lastword $(MAKEFILE_LIST)) |
|
874
638ddad10e12
6728161: Add SKIP_BOOT_CYCLE feature to create boot jdk and use it during build
ohair
parents:
668
diff
changeset
|
48 |
endif |
27595
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26548
diff
changeset
|
49 |
root_dir:=$(patsubst %/,%,$(dir $(makefile_path))) |
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26548
diff
changeset
|
50 |
|
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26548
diff
changeset
|
51 |
ifneq ($(findstring qp,$(MAKEFLAGS)),) |
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26548
diff
changeset
|
52 |
# When called with -qp, assume an external part (e.g. bash completion) is trying |
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26548
diff
changeset
|
53 |
# to understand our targets. |
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26548
diff
changeset
|
54 |
# Duplication of global targets, needed before ParseConfAndSpec in case we have |
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26548
diff
changeset
|
55 |
# no configurations. |
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26548
diff
changeset
|
56 |
help: |
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26548
diff
changeset
|
57 |
# If CONF is not set, look for all available configurations |
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26548
diff
changeset
|
58 |
CONF?= |
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26548
diff
changeset
|
59 |
endif |
874
638ddad10e12
6728161: Add SKIP_BOOT_CYCLE feature to create boot jdk and use it during build
ohair
parents:
668
diff
changeset
|
60 |
|
21759 | 61 |
# ... and then we can include our helper functions |
62 |
include $(root_dir)/make/MakeHelpers.gmk |
|
15903 | 63 |
|
21759 | 64 |
$(eval $(call ParseLogLevel)) |
65 |
$(eval $(call ParseConfAndSpec)) |
|
8441 | 66 |
|
21759 | 67 |
# Now determine if we have zero, one or several configurations to build. |
68 |
ifeq ($(SPEC),) |
|
69 |
# Since we got past ParseConfAndSpec, we must be building a global target. Do nothing. |
|
70 |
else |
|
25854 | 71 |
# In Cygwin, the MAKE variable gets messed up if the make executable is called with |
72 |
# a Windows mixed path (c:/cygwin/bin/make.exe). If that's the case, fix it by removing |
|
73 |
# the prepended root_dir. |
|
74 |
ifneq ($(findstring :, $(MAKE)), ) |
|
75 |
MAKE := $(patsubst $(root_dir)%, %, $(MAKE)) |
|
76 |
endif |
|
77 |
||
78 |
# We are potentially building multiple configurations. |
|
79 |
# First, find out the valid targets |
|
80 |
# Run the makefile with an arbitrary SPEC using -p -q (quiet dry-run and dump rules) to find |
|
81 |
# available PHONY targets. Use this list as valid targets to pass on to the repeated calls. |
|
82 |
all_phony_targets := $(sort $(filter-out $(global_targets), $(strip $(shell \ |
|
26548 | 83 |
cd $(root_dir)/make && $(MAKE) -f Main.gmk -p -q FRC SPEC=$(firstword $(SPEC)) \ |
84 |
-I $(root_dir)/make/common | grep "^.PHONY:" | head -n 1 | cut -d " " -f 2-)))) |
|
25854 | 85 |
|
86 |
# Loop through the configurations and call the main-wrapper for each one. The wrapper |
|
87 |
# target will execute with a single configuration loaded. |
|
88 |
$(all_phony_targets): |
|
89 |
@$(if $(TARGET_RUN),,\ |
|
90 |
$(foreach spec,$(SPEC),\ |
|
91 |
(cd $(root_dir) && $(MAKE) SPEC=$(spec) MAIN_TARGETS="$(call GetRealTarget)" \ |
|
92 |
$(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) main-wrapper) &&) true) |
|
93 |
@echo > /dev/null |
|
94 |
$(eval TARGET_RUN=true) |
|
95 |
||
96 |
.PHONY: $(all_phony_targets) |
|
874
638ddad10e12
6728161: Add SKIP_BOOT_CYCLE feature to create boot jdk and use it during build
ohair
parents:
668
diff
changeset
|
97 |
|
25854 | 98 |
ifneq ($(MAIN_TARGETS), ) |
99 |
# The wrapper target was called so we now have a single configuration. Load the spec file |
|
100 |
# and call the real Main.gmk. |
|
101 |
include $(SPEC) |
|
27595
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26548
diff
changeset
|
102 |
include $(SRC_ROOT)/make/common/MakeBase.gmk |
874
638ddad10e12
6728161: Add SKIP_BOOT_CYCLE feature to create boot jdk and use it during build
ohair
parents:
668
diff
changeset
|
103 |
|
25854 | 104 |
### Clean up from previous run |
105 |
# Remove any build.log from a previous run, if they exist |
|
106 |
ifneq (,$(BUILD_LOG)) |
|
107 |
ifneq (,$(BUILD_LOG_PREVIOUS)) |
|
108 |
# Rotate old log |
|
109 |
$(shell $(RM) $(BUILD_LOG_PREVIOUS) 2> /dev/null) |
|
110 |
$(shell $(MV) $(BUILD_LOG) $(BUILD_LOG_PREVIOUS) 2> /dev/null) |
|
111 |
else |
|
112 |
$(shell $(RM) $(BUILD_LOG) 2> /dev/null) |
|
113 |
endif |
|
114 |
$(shell $(RM) $(OUTPUT_ROOT)/build-trace-time.log 2> /dev/null) |
|
115 |
endif |
|
116 |
# Remove any javac server logs and port files. This |
|
117 |
# prevents a new make run to reuse the previous servers. |
|
118 |
ifneq (,$(SJAVAC_SERVER_DIR)) |
|
119 |
$(shell $(MKDIR) -p $(SJAVAC_SERVER_DIR) && $(RM) -rf $(SJAVAC_SERVER_DIR)/*) |
|
120 |
endif |
|
874
638ddad10e12
6728161: Add SKIP_BOOT_CYCLE feature to create boot jdk and use it during build
ohair
parents:
668
diff
changeset
|
121 |
|
26398
ca1f84f97e20
8057537: Serialize reconfigure and fix make clean-foo foo
erikj
parents:
26128
diff
changeset
|
122 |
# Split out the targets requiring sequential execution. Run these targets separately |
ca1f84f97e20
8057537: Serialize reconfigure and fix make clean-foo foo
erikj
parents:
26128
diff
changeset
|
123 |
# from the rest so that the rest may still enjoy full parallel execution. |
ca1f84f97e20
8057537: Serialize reconfigure and fix make clean-foo foo
erikj
parents:
26128
diff
changeset
|
124 |
SEQUENTIAL_TARGETS := $(filter dist-clean clean% reconfigure, $(MAIN_TARGETS)) |
ca1f84f97e20
8057537: Serialize reconfigure and fix make clean-foo foo
erikj
parents:
26128
diff
changeset
|
125 |
PARALLEL_TARGETS := $(filter-out $(SEQUENTIAL_TARGETS), $(MAIN_TARGETS)) |
ca1f84f97e20
8057537: Serialize reconfigure and fix make clean-foo foo
erikj
parents:
26128
diff
changeset
|
126 |
|
25854 | 127 |
main-wrapper: |
26398
ca1f84f97e20
8057537: Serialize reconfigure and fix make clean-foo foo
erikj
parents:
26128
diff
changeset
|
128 |
ifneq ($(SEQUENTIAL_TARGETS), ) |
26548 | 129 |
(cd $(SRC_ROOT)/make && $(MAKE) -f Main.gmk SPEC=$(SPEC) -j 1 \ |
26398
ca1f84f97e20
8057537: Serialize reconfigure and fix make clean-foo foo
erikj
parents:
26128
diff
changeset
|
130 |
$(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $(SEQUENTIAL_TARGETS)) |
ca1f84f97e20
8057537: Serialize reconfigure and fix make clean-foo foo
erikj
parents:
26128
diff
changeset
|
131 |
endif |
ca1f84f97e20
8057537: Serialize reconfigure and fix make clean-foo foo
erikj
parents:
26128
diff
changeset
|
132 |
ifneq ($(PARALLEL_TARGETS), ) |
ca1f84f97e20
8057537: Serialize reconfigure and fix make clean-foo foo
erikj
parents:
26128
diff
changeset
|
133 |
@$(call AtMakeStart) |
26548 | 134 |
(cd $(SRC_ROOT)/make && $(BUILD_LOG_WRAPPER) $(MAKE) -f Main.gmk SPEC=$(SPEC) -j $(JOBS) \ |
26398
ca1f84f97e20
8057537: Serialize reconfigure and fix make clean-foo foo
erikj
parents:
26128
diff
changeset
|
135 |
$(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $(PARALLEL_TARGETS) \ |
ca1f84f97e20
8057537: Serialize reconfigure and fix make clean-foo foo
erikj
parents:
26128
diff
changeset
|
136 |
$(if $(filter true, $(OUTPUT_SYNC_SUPPORTED)), -O$(OUTPUT_SYNC))) |
ca1f84f97e20
8057537: Serialize reconfigure and fix make clean-foo foo
erikj
parents:
26128
diff
changeset
|
137 |
@$(call AtMakeEnd) |
ca1f84f97e20
8057537: Serialize reconfigure and fix make clean-foo foo
erikj
parents:
26128
diff
changeset
|
138 |
endif |
25854 | 139 |
|
140 |
.PHONY: main-wrapper |
|
141 |
||
142 |
endif |
|
874
638ddad10e12
6728161: Add SKIP_BOOT_CYCLE feature to create boot jdk and use it during build
ohair
parents:
668
diff
changeset
|
143 |
endif |
638ddad10e12
6728161: Add SKIP_BOOT_CYCLE feature to create boot jdk and use it during build
ohair
parents:
668
diff
changeset
|
144 |
|
21759 | 145 |
# Here are "global" targets, i.e. targets that can be executed without specifying a single configuration. |
25854 | 146 |
# If you add more global targets, please update the variable global_targets in MakeHelpers. |
0 | 147 |
|
21759 | 148 |
help: |
149 |
$(info ) |
|
150 |
$(info OpenJDK Makefile help) |
|
151 |
$(info =====================) |
|
152 |
$(info ) |
|
153 |
$(info Common make targets) |
|
25854 | 154 |
$(info . make [default] # Compile all modules in langtools, hotspot, jaxp, jaxws,) |
155 |
$(info . # corba and jdk and create a runnable "exploded" image) |
|
156 |
$(info . make all # Compile everything, all repos, docs and images) |
|
27560 | 157 |
$(info . make images # Create complete jdk and jre images) |
158 |
$(info . make <phase> # Compile the specified phase and everything it depends on) |
|
159 |
$(info . # (gensrc, java, copy, libs, launchers, gendata, rmic)) |
|
160 |
$(info . make *-only # Applies to most targets and disables compling the) |
|
161 |
$(info . # dependencies for the target. This is faster but may) |
|
162 |
$(info . # result in incorrect build results!) |
|
25854 | 163 |
$(info . make docs # Create all docs) |
164 |
$(info . make docs-javadoc # Create just javadocs, depends on less than full docs) |
|
27560 | 165 |
$(info . make profiles # Create complete jre compact profile images) |
26128
91be51647a45
8056062: Additional minor cleanups from source restructure build changes
erikj
parents:
25854
diff
changeset
|
166 |
$(info . make bootcycle-images # Build images twice, second time with newly built JDK) |
21759 | 167 |
$(info . make install # Install the generated images locally) |
26398
ca1f84f97e20
8057537: Serialize reconfigure and fix make clean-foo foo
erikj
parents:
26128
diff
changeset
|
168 |
$(info . make reconfigure # Rerun configure with the same arguments as last time) |
21759 | 169 |
$(info . make help # Give some help on using make) |
170 |
$(info . make test # Run tests, default is all tests (see TEST below)) |
|
171 |
$(info ) |
|
27560 | 172 |
$(info Targets for cleaning) |
173 |
$(info . make clean # Remove all files generated by make, but not those) |
|
174 |
$(info . # generated by configure) |
|
175 |
$(info . make dist-clean # Remove all files, including configuration) |
|
176 |
$(info . make clean-<outputdir> # Remove the subdir in the output dir with the name) |
|
177 |
$(info . make clean-<phase> # Remove all build results related to a certain build) |
|
178 |
$(info . # phase (gensrc, java, libs, launchers)) |
|
179 |
$(info . make clean-<module> # Remove all build results related to a certain module) |
|
180 |
$(info . make clean-<module>-<phase> # Remove all build results related to a certain) |
|
181 |
$(info . # module and phase) |
|
182 |
$(info ) |
|
25854 | 183 |
$(info Targets for specific modules) |
184 |
$(info . make <module> # Build <module> and everything it depends on. ) |
|
27560 | 185 |
$(info . make <module>-<phase> # Compile the specified phase for the specified module) |
186 |
$(info . # and everything it depends on) |
|
187 |
$(info . # (gensrc, java, copy, libs, launchers, gendata, rmic)) |
|
21759 | 188 |
$(info ) |
189 |
$(info Useful make variables) |
|
190 |
$(info . make CONF= # Build all configurations (note, assignment is empty)) |
|
191 |
$(info . make CONF=<substring> # Build the configuration(s) with a name matching) |
|
192 |
$(info . # <substring>) |
|
193 |
$(info ) |
|
194 |
$(info . make LOG=<loglevel> # Change the log level from warn to <loglevel>) |
|
195 |
$(info . # Available log levels are:) |
|
196 |
$(info . # 'warn' (default), 'info', 'debug' and 'trace') |
|
197 |
$(info . # To see executed command lines, use LOG=debug) |
|
198 |
$(info ) |
|
199 |
$(info . make JOBS=<n> # Run <n> parallel make jobs) |
|
200 |
$(info . # Note that -jN does not work as expected!) |
|
201 |
$(info ) |
|
202 |
$(info . make test TEST=<test> # Only run the given test or tests, e.g.) |
|
203 |
$(info . # make test TEST="jdk_lang jdk_net") |
|
204 |
$(info ) |
|
0 | 205 |
|
21759 | 206 |
.PHONY: help |