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 erikj@445: default: all erikj@445: 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 SetupLogging)) erikj@458: $(eval $(call ParseConfAndSpec)) erikj@445: erikj@458: # Setup number of jobs to use. -jN is unfortunately not available for us to parse from the command line, erikj@458: # hence this workaround. erikj@458: ifeq ($(JOBS),) erikj@458: JOBS=$(NUM_CORES) ohair@425: endif ohair@425: ohair@425: ifneq ($(words $(SPEC)),1) erikj@458: ### We have multiple configurations to build, call make repeatedly erikj@458: all jdk hotspot jaxws jaxp corba langtools install images clean dist-clean: erikj@445: @$(foreach spec,$(SPEC),($(MAKE) -f $(makefile_path) SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) $@ $(MAKE_ARGS)) &&) true erikj@445: erikj@458: .PHONY: all jdk hotspot jaxws jaxp corba langtools install images clean dist-clean erikj@445: ohair@425: else erikj@458: ### This is the main part of the Makefile, for the normal case with SPEC specifying a single existing spec.gmk file. ohair@425: ohair@425: # Now load the spec erikj@458: include $(SPEC) ohair@425: ohair@425: # Load the vital tools for all the makefiles. erikj@458: include $(SRC_ROOT)/common/makefiles/MakeBase.gmk ohair@425: erikj@458: ### Clean up from previous run erikj@458: erikj@458: # Remove any build.log from a previous run, if they exist ohair@425: ifneq (,$(BUILD_LOG)) erikj@458: ifneq (,$(BUILD_LOG_PREVIOUS)) erikj@458: # Rotate old log erikj@458: $(shell $(RM) $(BUILD_LOG_PREVIOUS) 2> /dev/null) erikj@458: $(shell $(MV) $(BUILD_LOG) $(BUILD_LOG_PREVIOUS) 2> /dev/null) erikj@458: else erikj@458: $(shell $(RM) $(BUILD_LOG) 2> /dev/null) erikj@458: endif ohair@425: endif ohair@425: # Remove any javac server logs and port files. This ohair@425: # prevents a new make run to reuse the previous servers. ohair@425: ifneq (,$(JAVAC_SERVERS)) ohair@425: $(shell mkdir -p $(JAVAC_SERVERS) && rm -rf $(JAVAC_SERVERS)/*) ohair@425: endif ohair@425: # Clean out any notifications from the previous build. ohair@425: $(shell find $(OUTPUT_ROOT) -name "_the.*.notify" $(FIND_DELETE)) ohair@425: erikj@458: # Reset the build timers. erikj@458: $(eval $(call ResetTimers)) erikj@445: erikj@458: ### Main targets erikj@445: ohair@425: all: jdk ohair@425: @$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port) erikj@445: @$(call AtRootMakeEnd) ohair@425: erikj@458: langtools: start-make langtools-only erikj@458: langtools-only: ohair@425: @$(call MakeStart,langtools,all) erikj@458: @($(CD) $(LANGTOOLS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(MAKE_ARGS)) ohair@425: @$(call MakeFinish,langtools,all) ohair@425: erikj@458: corba: langtools corba-only erikj@458: corba-only: ohair@425: @$(call MakeStart,corba,all) erikj@458: @($(CD) $(CORBA_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(MAKE_ARGS)) ohair@425: @$(call MakeFinish,corba,all) ohair@425: erikj@458: jaxp: langtools jaxp-only erikj@458: jaxp-only: ohair@425: @$(call MakeStart,jaxp,all) erikj@458: @($(CD) $(JAXP_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(MAKE_ARGS)) ohair@425: @$(call MakeFinish,jaxp,all) ohair@425: erikj@458: jaxws: langtools jaxp jaxws-only erikj@458: jaxws-only: ohair@425: @$(call MakeStart,jaxws,all) erikj@458: @($(CD) $(JAXWS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(MAKE_ARGS)) ohair@425: @$(call MakeFinish,jaxws,all) ohair@425: erikj@458: hotspot: langtools hotspot-only erikj@458: hotspot-only: ohair@425: @$(call MakeStart,hotspot,all) erikj@445: @($(CD) $(HOTSPOT_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) -j1 $(HOTSPOT_MAKE_ARGS) $(MAKE_ARGS)) ohair@425: @$(call MakeFinish,hotspot,all) ohair@425: erikj@458: jdk: langtools corba jaxp jaxws hotspot jdk-only erikj@458: jdk-only: ohair@425: @$(call MakeStart,jdk,all) erikj@458: @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(MAKE_ARGS)) ohair@425: @$(call MakeFinish,jdk,all) ohair@425: erikj@458: images: source-tips start-make jdk langtools corba jaxp jaxws hotspot images-only erikj@458: images-only: ohair@425: @$(call MakeStart,jdk-images,$@) erikj@458: @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(JDK_MAKE_ARGS) $(MAKE_ARGS) images) ohair@425: @$(call MakeFinish,jdk-images,$@) ohair@425: @$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port) erikj@445: @$(call AtRootMakeEnd) ohair@425: erikj@458: install: source-tips start-make jdk langtools corba jaxp jaxws hotspot install-only erikj@458: install-only: erikj@458: @$(call MakeStart,jdk-images,$@) erikj@458: @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(JDK_MAKE_ARGS) $(MAKE_ARGS) install) erikj@458: @$(call MakeFinish,jdk-images,$@) erikj@445: @$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port) erikj@445: @$(call AtRootMakeEnd) ohair@425: erikj@445: start-make: erikj@445: @$(call AtRootMakeStart) erikj@445: erikj@458: .PHONY: jdk hotspot jaxws jaxp corba langtools install images start-make erikj@445: erikj@445: test: start-make erikj@445: @$(call MakeStart,test,$(if $(TEST),$(TEST),all)) erikj@445: @($(CD) $(SRC_ROOT)/test && $(BUILD_LOG_WRAPPER) $(MAKE) MAKEFLAGS= -j1 PRODUCT_HOME=$(OUTPUT_ROOT)/jdk JPRT_JAVA_HOME=$(OUTPUT_ROOT)/jdk ALT_OUTPUTDIR=$(OUTPUT_ROOT) $(TEST)) || true erikj@445: @$(call MakeFinish,test,$(if $(TEST),$(TEST),all)) erikj@445: @$(call AtRootMakeEnd) erikj@445: .PHONY: test erikj@445: erikj@445: erikj@445: # Stores the tips for each repository. This file is be used when constructing the jdk image and can be erikj@445: # used to track the exact sources used to build that image. erikj@445: source-tips: $(OUTPUT_ROOT)/source_tips erikj@445: $(OUTPUT_ROOT)/source_tips: FRC erikj@445: @$(MKDIR) -p $(@D) erikj@445: @$(RM) $@ erikj@445: @$(call GetSourceTips) erikj@445: ohair@425: ohair@425: # Remove everything, except the output from configure. ohair@425: clean: erikj@458: @(cd $(OUTPUT_ROOT) && $(RM) -r `$(LS) $(OUTPUT_ROOT) | grep -v spec.gmk | grep -v spec.sh | grep -v Makefile | grep -v config.status | grep -v config.log | grep -v config.h | grep -v configure-arguments | grep -v "localdevenv.*" | grep -v uncygdrive.exe`) ohair@425: @$(ECHO) Cleaned everything except the build configuration. ohair@425: .PHONY: clean ohair@425: ohair@425: # Remove everything, you have to rerun configure. ohair@425: dist-clean: ohair@425: @$(RM) -r $(OUTPUT_ROOT) ohair@425: @$(ECHO) Cleaned everything, you will have to re-run configure. ohair@425: .PHONY: dist-clean ohair@425: ohair@425: clean-jdk: erikj@458: @(cd $(OUTPUT_ROOT) && $(RM) -r `$(LS) $(OUTPUT_ROOT) | grep -v spec.gmk | grep -v spec.sh | grep -v Makefile | grep -v config.status | grep -v config.log | grep -v config.h | grep -v configure-arguments | \ ohair@425: grep -v langtools | grep -v corba | grep -v jaxp | grep -v jaxws | grep -v hotspot`) ohair@425: @$(ECHO) "Cleaned jdk build artifacts (but not langtools,corba,jaxp,jaxws,hotspot nor the build configuration)" ohair@425: .PHONY: clean ohair@425: erikj@445: endif erikj@445: erikj@445: # Here are "global" targets, i.e. targets that can be executed without specifying a single configuration. erikj@445: # If you addd more global targets, please update the fatal-error macro. 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) erikj@445: $(info . make [all] # Compile all code but do not create images) erikj@445: $(info . make images # Create complete j2sdk and j2re images) erikj@445: $(info . make install # Install the generated images locally) erikj@445: $(info . make clean # Remove all files generated by make, but not those generated by configure) erikj@445: $(info . make dist-clean # Remove all files generated by both make and configure) erikj@445: $(info . make help # Give some help on using make) erikj@445: $(info . make test # Run tests, default is all tests (see TEST below)) erikj@445: $(info ) erikj@445: $(info Useful make variables) erikj@445: $(info . make CONF= # Build all configurations (note, assignment is empty)) erikj@445: $(info . make CONF= # Build the configuration(s) with a name matching the given substring) erikj@445: $(info ) erikj@445: $(info . make LOG= # Change loglevel from warn (default) to the given loglevel) erikj@445: $(info . # Available loglevels are: warn, info, debug and trace) erikj@445: $(info . # To see executed command lines, use LOG=info) erikj@445: $(info ) erikj@445: $(info . make test TEST= # Only run the given test or tests, e.g.) erikj@445: $(info . # make test TEST="jdk_lang jdk_net") erikj@445: $(info ) ohair@425: .PHONY: help erikj@445: FRC: # Force target