Makefile 6.3 KB
Newer Older
D
duke 已提交
1
#
I
ihse 已提交
2
# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
D
duke 已提交
3 4 5 6
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
7
# published by the Free Software Foundation.  Oracle designates this
D
duke 已提交
8
# particular file as subject to the "Classpath" exception as provided
9
# by Oracle in the LICENSE file that accompanied this code.
D
duke 已提交
10 11 12 13 14 15 16 17 18 19 20
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
21 22 23
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
D
duke 已提交
24 25
#

I
ihse 已提交
26 27
# This must be the first rule
default:
28

I
ihse 已提交
29 30 31 32
# Inclusion of this pseudo-target will cause make to execute this file
# serially, regardless of -j. Recursively called makefiles will not be
# affected, however. This is required for correct dependency management.
.NOTPARALLEL:
O
ohrstrom 已提交
33

I
ihse 已提交
34 35 36
# The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU make.
# /usr/ccs/bin/make lacks basically every other flow control mechanism.
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

I
ihse 已提交
38 39 40
# Assume we have GNU make, but check version.
ifeq ($(strip $(foreach v, 3.81% 3.82% 4.%, $(filter $v, $(MAKE_VERSION)))), )
  $(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 3.81 or newer.)
41 42
endif

I
ihse 已提交
43 44 45
# Locate this Makefile
ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),)
  makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST))
46
else
I
ihse 已提交
47
  makefile_path:=$(lastword $(MAKEFILE_LIST))
D
duke 已提交
48
endif
I
ihse 已提交
49
root_dir:=$(dir $(makefile_path))
D
duke 已提交
50

I
ihse 已提交
51 52
# ... and then we can include our helper functions
include $(root_dir)/make/MakeHelpers.gmk
D
duke 已提交
53

I
ihse 已提交
54 55
$(eval $(call ParseLogLevel))
$(eval $(call ParseConfAndSpec))
D
duke 已提交
56

I
ihse 已提交
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
# Now determine if we have zero, one or several configurations to build.
ifeq ($(SPEC),)
  # Since we got past ParseConfAndSpec, we must be building a global target. Do nothing.
else
  ifeq ($(words $(SPEC)),1)
    # We are building a single configuration. This is the normal case. Execute the Main.gmk file.
    include $(root_dir)/make/Main.gmk
  else
    # We are building multiple configurations.
    # First, find out the valid targets
    # Run the makefile with an arbitrary SPEC using -p -q (quiet dry-run and dump rules) to find
    # available PHONY targets. Use this list as valid targets to pass on to the repeated calls.
    all_phony_targets=$(filter-out $(global_targets) bundles-only, $(strip $(shell \
        $(MAKE) -p -q -f make/Main.gmk FRC SPEC=$(firstword $(SPEC)) | \
        grep ^.PHONY: | head -n 1 | cut -d " " -f 2-)))
D
duke 已提交
72

I
ihse 已提交
73 74 75
    $(all_phony_targets):
	@$(foreach spec,$(SPEC),($(MAKE) -f NewMakefile.gmk SPEC=$(spec) \
	    $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $@) &&) true
D
duke 已提交
76

I
ihse 已提交
77
    .PHONY: $(all_phony_targets)
D
duke 已提交
78

I
ihse 已提交
79
  endif
D
duke 已提交
80 81
endif

I
ihse 已提交
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
# Include this after a potential spec file has been included so that the bundles target
# has access to the spec variables.
include $(root_dir)/make/Jprt.gmk

# Here are "global" targets, i.e. targets that can be executed without specifying a single configuration.
# If you addd more global targets, please update the variable global_targets in MakeHelpers.

help:
	$(info )
	$(info OpenJDK Makefile help)
	$(info =====================)
	$(info )
	$(info Common make targets)
	$(info .  make [default]         # Compile all product in langtools, hotspot, jaxp, jaxws,)
	$(info .                         # corba and jdk)
	$(info .  make all               # Compile everything, all repos and images)
	$(info .  make images            # Create complete j2sdk and j2re images)
	$(info .  make docs              # Create javadocs)
	$(info .  make overlay-images    # Create limited images for sparc 64 bit platforms)
	$(info .  make profiles          # Create complete j2re compact profile images)
	$(info .  make bootcycle-images  # Build images twice, second time with newly build JDK)
	$(info .  make install           # Install the generated images locally)
	$(info .  make clean             # Remove all files generated by make, but not those)
	$(info .                         # generated by configure)
	$(info .  make dist-clean        # Remove all files, including configuration)
	$(info .  make help              # Give some help on using make)
	$(info .  make test              # Run tests, default is all tests (see TEST below))
	$(info )
	$(info Targets for specific components)
	$(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk, nashorn, images, overlay-images, docs or test))
	$(info .  make <component>       # Build <component> and everything it depends on. )
	$(info .  make <component>-only  # Build <component> only, without dependencies. This)
	$(info .                         # is faster but can result in incorrect build results!)
	$(info .  make clean-<component> # Remove files generated by make for <component>)
	$(info )
	$(info Useful make variables)
	$(info .  make CONF=             # Build all configurations (note, assignment is empty))
	$(info .  make CONF=<substring>  # Build the configuration(s) with a name matching)
	$(info .                         # <substring>)
	$(info )
	$(info .  make LOG=<loglevel>    # Change the log level from warn to <loglevel>)
	$(info .                         # Available log levels are:)
	$(info .                         # 'warn' (default), 'info', 'debug' and 'trace')
	$(info .                         # To see executed command lines, use LOG=debug)
	$(info )
	$(info .  make JOBS=<n>          # Run <n> parallel make jobs)
	$(info .                         # Note that -jN does not work as expected!)
	$(info )
	$(info .  make test TEST=<test>  # Only run the given test or tests, e.g.)
	$(info .                         # make test TEST="jdk_lang jdk_net")
	$(info )

.PHONY: help