Tue, 10 Apr 2012 08:18:28 -0700
7074397: Build infrastructure changes (makefile re-write)
Summary: New makefiles transition, old and new living side by side for now.
Reviewed-by: ohair, jjg, dholmes, ohrstrom, erikj, ihse, tgranat, ykantser
Contributed-by: ohrstrom <fredrik.ohrstrom@oracle.com>, erikj <erik.joelsson@oracle.com>, ihse <magnus.ihse.bursie@oracle.com>, tgranat <torbjorn.granat@oracle.com>, ykantser <yekaterina.kantserova@oracle.com>
ohair@425 | 1 | # |
ohair@425 | 2 | # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
ohair@425 | 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ohair@425 | 4 | # |
ohair@425 | 5 | # This code is free software; you can redistribute it and/or modify it |
ohair@425 | 6 | # under the terms of the GNU General Public License version 2 only, as |
ohair@425 | 7 | # published by the Free Software Foundation. Oracle designates this |
ohair@425 | 8 | # particular file as subject to the "Classpath" exception as provided |
ohair@425 | 9 | # by Oracle in the LICENSE file that accompanied this code. |
ohair@425 | 10 | # |
ohair@425 | 11 | # This code is distributed in the hope that it will be useful, but WITHOUT |
ohair@425 | 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ohair@425 | 13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ohair@425 | 14 | # version 2 for more details (a copy is included in the LICENSE file that |
ohair@425 | 15 | # accompanied this code). |
ohair@425 | 16 | # |
ohair@425 | 17 | # You should have received a copy of the GNU General Public License version |
ohair@425 | 18 | # 2 along with this work; if not, write to the Free Software Foundation, |
ohair@425 | 19 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ohair@425 | 20 | # |
ohair@425 | 21 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@425 | 22 | # or visit www.oracle.com if you need additional information or have any |
ohair@425 | 23 | # questions. |
ohair@425 | 24 | # |
ohair@425 | 25 | |
ohair@425 | 26 | # Default to sane output from make. |
ohair@425 | 27 | # Override with empty string to get insane amount of output. |
ohair@425 | 28 | # Override with -d to get even more insane amount of debugging output. |
ohair@425 | 29 | # Override with "-d -p" to get it all. |
ohair@425 | 30 | VERBOSE=-s |
ohair@425 | 31 | |
ohair@425 | 32 | # Find all environment or command line variables that begin with ALT. |
ohair@425 | 33 | list_alt_overrides_with_origins = $(filter ALT_%=environment ALT_%=command,$(foreach var,$(.VARIABLES),$(var)=$(firstword $(origin $(var))))) |
ohair@425 | 34 | list_alt_overrides=$(subst =command,,$(subst =environment,,$(list_alt_overrides_with_origins))) |
ohair@425 | 35 | ifneq ($(list_alt_overrides),) |
ohair@425 | 36 | $(info You have set the following ALT_ variables:) |
ohair@425 | 37 | $(foreach var,$(list_alt_overrides), $(info $(var)=$($(var)))) |
ohair@425 | 38 | $(error Using ALT_ variables is deprecated! Please clean your environment!) |
ohair@425 | 39 | endif |
ohair@425 | 40 | |
ohair@425 | 41 | # The spec.gmk file contains the variables extracted by the configure script. |
ohair@425 | 42 | # It is usually set with SPEC=....spec.gmk on the make command line. |
ohair@425 | 43 | # However if you simply type make from the openjdk source root, it will go looking |
ohair@425 | 44 | # for a spec file, if only one is found, use it. If more than one is found, |
ohair@425 | 45 | # complain. If none is found, request the user to run configure! |
ohair@425 | 46 | SPEC ?= $(wildcard $(CURDIR)/../../build/*/spec.gmk) |
ohair@425 | 47 | |
ohair@425 | 48 | ifeq ($(words $(SPEC)),0) |
ohair@425 | 49 | $(error You must run configure!) |
ohair@425 | 50 | endif |
ohair@425 | 51 | |
ohair@425 | 52 | ifneq ($(words $(SPEC)),1) |
ohair@425 | 53 | ifeq ($(MAKECMDGOALS),all-conf) |
ohair@425 | 54 | SPECS:=$(shell echo $(SPEC) | sed -e 's|$(CURDIR)/build/||g' -e 's|/spec.gmk|\\n|g' -e 's| ||g') |
ohair@425 | 55 | allconf: |
ohair@425 | 56 | @echo Building configurations: |
ohair@425 | 57 | @printf "$(SPECS)" |
ohair@425 | 58 | @$(foreach s,$(SPEC),($(MAKE) SPEC=$s $(VERBOSE) VERBOSE=$(VERBOSE) images) &&) true |
ohair@425 | 59 | @echo Done building configurations: |
ohair@425 | 60 | @printf "$(SPECS)" |
ohair@425 | 61 | .PHONY: all-conf |
ohair@425 | 62 | else |
ohair@425 | 63 | $(error Since you have more than one output dir configured under build, \ |
ohair@425 | 64 | you have to either run make from the output dir of your choice \ |
ohair@425 | 65 | or specify run "make SPEC=build/.../spec.gmk" or run all the build configurations \ |
ohair@425 | 66 | using "make all-conf") |
ohair@425 | 67 | endif |
ohair@425 | 68 | else |
ohair@425 | 69 | |
ohair@425 | 70 | # Now load the spec |
ohair@425 | 71 | -include $(SPEC) |
ohair@425 | 72 | |
ohair@425 | 73 | # Load the vital tools for all the makefiles. |
ohair@425 | 74 | -include $(SRC_ROOT)/common/makefiles/MakeBase.gmk |
ohair@425 | 75 | |
ohair@425 | 76 | # Remove any build.log from a previous run |
ohair@425 | 77 | ifneq (,$(BUILD_LOG)) |
ohair@425 | 78 | $(shell $(RM) $(BUILD_LOG)) |
ohair@425 | 79 | endif |
ohair@425 | 80 | |
ohair@425 | 81 | # Remove any javac server logs and port files. This |
ohair@425 | 82 | # prevents a new make run to reuse the previous servers. |
ohair@425 | 83 | ifneq (,$(JAVAC_SERVERS)) |
ohair@425 | 84 | $(shell mkdir -p $(JAVAC_SERVERS) && rm -rf $(JAVAC_SERVERS)/*) |
ohair@425 | 85 | endif |
ohair@425 | 86 | # Reset the build timers. |
ohair@425 | 87 | $(eval $(call ResetTimers)) |
ohair@425 | 88 | # Clean out any notifications from the previous build. |
ohair@425 | 89 | $(shell find $(OUTPUT_ROOT) -name "_the.*.notify" $(FIND_DELETE)) |
ohair@425 | 90 | |
ohair@425 | 91 | all: jdk |
ohair@425 | 92 | @$(call StopTimer) |
ohair@425 | 93 | @$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port) |
ohair@425 | 94 | |
ohair@425 | 95 | langtools: start-timer |
ohair@425 | 96 | @$(call MakeStart,langtools,all) |
ohair@425 | 97 | @($(CD) $(LANGTOOLS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(LANGTOOLS_MAKE_ARGS)) |
ohair@425 | 98 | @$(call MakeFinish,langtools,all) |
ohair@425 | 99 | |
ohair@425 | 100 | corba: langtools |
ohair@425 | 101 | @$(call MakeStart,corba,all) |
ohair@425 | 102 | @($(CD) $(CORBA_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(CORBA_MAKE_ARGS)) |
ohair@425 | 103 | @$(call MakeFinish,corba,all) |
ohair@425 | 104 | |
ohair@425 | 105 | jaxp: langtools |
ohair@425 | 106 | @$(call MakeStart,jaxp,all) |
ohair@425 | 107 | @($(CD) $(JAXP_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(CORBA_MAKE_ARGS)) |
ohair@425 | 108 | @$(call MakeFinish,jaxp,all) |
ohair@425 | 109 | |
ohair@425 | 110 | jaxws: langtools jaxp |
ohair@425 | 111 | @$(call MakeStart,jaxws,all) |
ohair@425 | 112 | @($(CD) $(JAXWS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(CORBA_MAKE_ARGS)) |
ohair@425 | 113 | @$(call MakeFinish,jaxws,all) |
ohair@425 | 114 | |
ohair@425 | 115 | hotspot: langtools |
ohair@425 | 116 | @$(call MakeStart,hotspot,all) |
ohair@425 | 117 | @($(CD) $(HOTSPOT_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) -j1 $(HOTSPOT_MAKE_ARGS)) |
ohair@425 | 118 | @$(call MakeFinish,hotspot,all) |
ohair@425 | 119 | |
ohair@425 | 120 | jdk: langtools corba jaxp jaxws hotspot |
ohair@425 | 121 | @$(call MakeStart,jdk,all) |
ohair@425 | 122 | @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(JDK_MAKE_ARGS)) |
ohair@425 | 123 | @$(call MakeFinish,jdk,all) |
ohair@425 | 124 | |
ohair@425 | 125 | images install packages: start-timer jdk langtools corba jaxp jaxws hotspot |
ohair@425 | 126 | @$(call MakeStart,jdk-images,$@) |
ohair@425 | 127 | @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(NUM_CORES) $(JDK_MAKE_ARGS) $@) |
ohair@425 | 128 | @$(call MakeFinish,jdk-images,$@) |
ohair@425 | 129 | @$(call StopTimer) |
ohair@425 | 130 | @$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port) |
ohair@425 | 131 | |
ohair@425 | 132 | start-timer: |
ohair@425 | 133 | @$(call StartTimer) |
ohair@425 | 134 | |
ohair@425 | 135 | .PHONY: jdk hotspot jaxws jaxp corba langtools install images packages start-timer |
ohair@425 | 136 | |
ohair@425 | 137 | # Remove everything, except the output from configure. |
ohair@425 | 138 | clean: |
ohair@425 | 139 | @(cd $(OUTPUT_ROOT) && $(RM) -r `$(LS) $(OUTPUT_ROOT) | grep -v spec.gmk | 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 | 140 | @$(ECHO) Cleaned everything except the build configuration. |
ohair@425 | 141 | .PHONY: clean |
ohair@425 | 142 | |
ohair@425 | 143 | # Remove everything, you have to rerun configure. |
ohair@425 | 144 | dist-clean: |
ohair@425 | 145 | @$(RM) -r $(OUTPUT_ROOT) |
ohair@425 | 146 | @$(ECHO) Cleaned everything, you will have to re-run configure. |
ohair@425 | 147 | .PHONY: dist-clean |
ohair@425 | 148 | |
ohair@425 | 149 | clean-jdk: |
ohair@425 | 150 | @(cd $(OUTPUT_ROOT) && $(RM) -r `$(LS) $(OUTPUT_ROOT) | grep -v spec.gmk | grep -v Makefile | grep -v config.status | grep -v config.log | grep -v config.h | grep -v configure-arguments | \ |
ohair@425 | 151 | grep -v langtools | grep -v corba | grep -v jaxp | grep -v jaxws | grep -v hotspot`) |
ohair@425 | 152 | @$(ECHO) "Cleaned jdk build artifacts (but not langtools,corba,jaxp,jaxws,hotspot nor the build configuration)" |
ohair@425 | 153 | .PHONY: clean |
ohair@425 | 154 | |
ohair@425 | 155 | help: |
ohair@425 | 156 | $(info ) |
ohair@425 | 157 | $(info Typical make commands:) |
ohair@425 | 158 | $(info make) |
ohair@425 | 159 | $(info make VERBOSE= # print all commands) |
ohair@425 | 160 | $(info make VERBOSE="-d -p" # debug make as well) |
ohair@425 | 161 | $(info make all-conf # build images for all configurations) |
ohair@425 | 162 | $(info make clean # remove build artifacts) |
ohair@425 | 163 | $(info make dist-clean # you have to rerun configure) |
ohair@425 | 164 | # $(info make test # run tests) |
ohair@425 | 165 | $(info make images # create the jdk and jre images) |
ohair@425 | 166 | $(info make install # install the jdk image) |
ohair@425 | 167 | # $(info make modules # EXPERIMENTAL: Migrate JDK into a modularized form!) |
ohair@425 | 168 | $(info make packages # create zips and other packages) |
ohair@425 | 169 | |
ohair@425 | 170 | # $(info make eclipse_workspace # Create an Eclipse workspace) |
ohair@425 | 171 | # $(info make netbeans_workspace # Create a NetBeans workspace) |
ohair@425 | 172 | # $(info make vs_workspace # Create a Visual Studio workspace) |
ohair@425 | 173 | |
ohair@425 | 174 | .PHONY: help |
ohair@425 | 175 | |
ohair@425 | 176 | endif |