ohair@425: # ohair@425: # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. ohair@425: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ohair@425: # ohair@425: # This code is free software; you can redistribute it and/or modify it ohair@425: # under the terms of the GNU General Public License version 2 only, as ohair@425: # published by the Free Software Foundation. Oracle designates this ohair@425: # particular file as subject to the "Classpath" exception as provided ohair@425: # by Oracle in the LICENSE file that accompanied this code. ohair@425: # ohair@425: # This code is distributed in the hope that it will be useful, but WITHOUT ohair@425: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ohair@425: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ohair@425: # version 2 for more details (a copy is included in the LICENSE file that ohair@425: # accompanied this code). ohair@425: # ohair@425: # You should have received a copy of the GNU General Public License version ohair@425: # 2 along with this work; if not, write to the Free Software Foundation, ohair@425: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ohair@425: # ohair@425: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@425: # or visit www.oracle.com if you need additional information or have any ohair@425: # questions. ohair@425: # ohair@425: erikj@445: # This must be the first rule ohair@494: all: erikj@445: ohair@478: # Inclusion of this pseudo-target will cause make to execute this file ohair@478: # serially, regardless of -j. Recursively called makefiles will not be ohair@478: # affected, however. This is required for correct dependency management. ohair@478: .NOTPARALLEL: ohair@478: ohair@494: # The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU make. ohair@494: # /usr/ccs/bin/make lacks basically every other flow control mechanism. ohair@494: TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1 ohair@494: ohair@494: # Assume we have GNU make, but check version. ohair@494: ifeq (,$(findstring 3.81,$(MAKE_VERSION))) ohair@494: ifeq (,$(findstring 3.82,$(MAKE_VERSION))) ohair@494: $(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 3.81 or newer.) ohair@494: endif ohair@494: endif ohair@494: erikj@458: # Locate this Makefile erikj@458: ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),) erikj@458: makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST)) erikj@458: else erikj@458: makefile_path:=$(lastword $(MAKEFILE_LIST)) erikj@458: endif erikj@458: root_dir:=$(patsubst %/common/makefiles/Makefile,%,$(makefile_path)) erikj@445: erikj@458: # ... and then we can include our helper functions erikj@458: include $(dir $(makefile_path))/MakeHelpers.gmk erikj@445: erikj@458: $(eval $(call ParseLogLevel)) erikj@458: $(eval $(call ParseConfAndSpec)) erikj@445: ohair@494: # Now determine if we have zero, one or several configurations to build. ohair@494: ifeq ($(SPEC),) ohair@494: # Since we got past ParseConfAndSpec, we must be building a global target. Do nothing. ohair@494: else ohair@494: ifeq ($(words $(SPEC)),1) ohair@494: # We are building a single configuration. This is the normal case. Execute the Main.gmk file. ohair@494: include $(dir $(makefile_path))/Main.gmk ohair@494: else ohair@494: # We are building multiple configurations. ohair@494: # First, find out the valid targets ohair@494: # Run the makefile with an arbitraty SPEC using -p -q (quiet dry-run and dump rules) to find ohair@494: # available PHONY targets. Use this list as valid targets to pass on to the repeated calls. ohair@494: all_phony_targets=$(filter-out $(global_targets), $(strip $(shell \ ohair@494: $(MAKE) -p -q -f $(makefile_path) SPEC=$(firstword $(SPEC)) | \ ohair@494: grep ^.PHONY: | head -n 1 | cut -d " " -f 2-))) ohair@494: ohair@494: $(all_phony_targets): ohair@478: @$(foreach spec,$(SPEC),($(MAKE) -f $(makefile_path) SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) $@) &&) true erikj@445: erikj@458: endif ohair@425: endif erikj@445: erikj@445: # Here are "global" targets, i.e. targets that can be executed without specifying a single configuration. ohair@494: # If you addd more global targets, please update the variable global_targets in MakeHelpers. erikj@445: ohair@425: help: erikj@445: $(info ) erikj@445: $(info OpenJDK Makefile help) erikj@445: $(info =====================) erikj@445: $(info ) erikj@445: $(info Common make targets) ohair@478: $(info . make [all] # Compile all code but do not create images) ohair@478: $(info . make images # Create complete j2sdk and j2re images) ohair@478: $(info . make overlay-images # Create limited images for sparc 64 bit platforms) ohair@478: $(info . make bootcycle-images # Build images twice, second time with newly build JDK) ohair@478: $(info . make install # Install the generated images locally) ohair@478: $(info . make clean # Remove all files generated by make, but not those) ohair@478: $(info . # generated by configure) ohair@478: $(info . make dist-clean # Remove all files, including configuration) ohair@478: $(info . make help # Give some help on using make) ohair@478: $(info . make test # Run tests, default is all tests (see TEST below)) ohair@478: $(info ) ohair@478: $(info Targets for specific components) ohair@494: $(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk, images or overlay-images)) ohair@478: $(info . make # Build and everything it depends on. ) ohair@478: $(info . make -only # Build only, without dependencies. This) ohair@478: $(info . # is faster but can result in incorrect build results!) ohair@478: $(info . make clean- # Remove files generated by make for ) erikj@445: $(info ) erikj@445: $(info Useful make variables) ohair@478: $(info . make CONF= # Build all configurations (note, assignment is empty)) ohair@478: $(info . make CONF= # Build the configuration(s) with a name matching) ohair@478: $(info . # ) erikj@445: $(info ) ohair@478: $(info . make LOG= # Change the log level from warn to ) ohair@478: $(info . # Available log levels are:) ohair@478: $(info . # 'warn' (default), 'info', 'debug' and 'trace') ohair@494: $(info . # To see executed command lines, use LOG=debug) erikj@445: $(info ) ohair@478: $(info . make JOBS= # Run parallel make jobs) ohair@478: $(info . # Note that -jN does not work as expected!) ohair@478: $(info ) ohair@478: $(info . make test TEST= # Only run the given test or tests, e.g.) ohair@478: $(info . # make test TEST="jdk_lang jdk_net") erikj@445: $(info ) ohair@494: ohair@494: configure: ohair@494: @$(SHELL) $(root_dir)/configure $(CONFIGURE_ARGS) ohair@494: @echo ==================================================== ohair@494: @echo "Note: This is a non-recommended way of running configure." ohair@494: @echo "Instead, run 'sh configure' in the top-level directory" ohair@494: ohair@494: .PHONY: help configure