common/makefiles/Makefile

Thu, 05 Jul 2012 18:27:07 -0700

author
erikj
date
Thu, 05 Jul 2012 18:27:07 -0700
changeset 459
3156dff953b1
parent 458
c8d320b48626
child 478
2ba6f4da4bf3
permissions
-rw-r--r--

7182051: Update of latest build-infra Makefiles (missing files)
Reviewed-by: ohair

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
erikj@445 26 # This must be the first rule
erikj@445 27 default: all
erikj@445 28
erikj@458 29 # Locate this Makefile
erikj@458 30 ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),)
erikj@458 31 makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST))
erikj@458 32 else
erikj@458 33 makefile_path:=$(lastword $(MAKEFILE_LIST))
erikj@458 34 endif
erikj@458 35 root_dir:=$(patsubst %/common/makefiles/Makefile,%,$(makefile_path))
erikj@445 36
erikj@458 37 # ... and then we can include our helper functions
erikj@458 38 include $(dir $(makefile_path))/MakeHelpers.gmk
erikj@445 39
erikj@458 40 $(eval $(call ParseLogLevel))
erikj@458 41 $(eval $(call SetupLogging))
erikj@458 42 $(eval $(call ParseConfAndSpec))
erikj@445 43
erikj@458 44 # Setup number of jobs to use. -jN is unfortunately not available for us to parse from the command line,
erikj@458 45 # hence this workaround.
erikj@458 46 ifeq ($(JOBS),)
erikj@458 47 JOBS=$(NUM_CORES)
ohair@425 48 endif
ohair@425 49
ohair@425 50 ifneq ($(words $(SPEC)),1)
erikj@458 51 ### We have multiple configurations to build, call make repeatedly
erikj@458 52 all jdk hotspot jaxws jaxp corba langtools install images clean dist-clean:
erikj@445 53 @$(foreach spec,$(SPEC),($(MAKE) -f $(makefile_path) SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) $@ $(MAKE_ARGS)) &&) true
erikj@445 54
erikj@458 55 .PHONY: all jdk hotspot jaxws jaxp corba langtools install images clean dist-clean
erikj@445 56
ohair@425 57 else
erikj@458 58 ### This is the main part of the Makefile, for the normal case with SPEC specifying a single existing spec.gmk file.
ohair@425 59
ohair@425 60 # Now load the spec
erikj@458 61 include $(SPEC)
ohair@425 62
ohair@425 63 # Load the vital tools for all the makefiles.
erikj@458 64 include $(SRC_ROOT)/common/makefiles/MakeBase.gmk
ohair@425 65
erikj@458 66 ### Clean up from previous run
erikj@458 67
erikj@458 68 # Remove any build.log from a previous run, if they exist
ohair@425 69 ifneq (,$(BUILD_LOG))
erikj@458 70 ifneq (,$(BUILD_LOG_PREVIOUS))
erikj@458 71 # Rotate old log
erikj@458 72 $(shell $(RM) $(BUILD_LOG_PREVIOUS) 2> /dev/null)
erikj@458 73 $(shell $(MV) $(BUILD_LOG) $(BUILD_LOG_PREVIOUS) 2> /dev/null)
erikj@458 74 else
erikj@458 75 $(shell $(RM) $(BUILD_LOG) 2> /dev/null)
erikj@458 76 endif
ohair@425 77 endif
ohair@425 78 # Remove any javac server logs and port files. This
ohair@425 79 # prevents a new make run to reuse the previous servers.
ohair@425 80 ifneq (,$(JAVAC_SERVERS))
ohair@425 81 $(shell mkdir -p $(JAVAC_SERVERS) && rm -rf $(JAVAC_SERVERS)/*)
ohair@425 82 endif
ohair@425 83 # Clean out any notifications from the previous build.
ohair@425 84 $(shell find $(OUTPUT_ROOT) -name "_the.*.notify" $(FIND_DELETE))
ohair@425 85
erikj@458 86 # Reset the build timers.
erikj@458 87 $(eval $(call ResetTimers))
erikj@445 88
erikj@458 89 ### Main targets
erikj@445 90
ohair@425 91 all: jdk
ohair@425 92 @$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port)
erikj@445 93 @$(call AtRootMakeEnd)
ohair@425 94
erikj@458 95 langtools: start-make langtools-only
erikj@458 96 langtools-only:
ohair@425 97 @$(call MakeStart,langtools,all)
erikj@458 98 @($(CD) $(LANGTOOLS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(MAKE_ARGS))
ohair@425 99 @$(call MakeFinish,langtools,all)
ohair@425 100
erikj@458 101 corba: langtools corba-only
erikj@458 102 corba-only:
ohair@425 103 @$(call MakeStart,corba,all)
erikj@458 104 @($(CD) $(CORBA_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(MAKE_ARGS))
ohair@425 105 @$(call MakeFinish,corba,all)
ohair@425 106
erikj@458 107 jaxp: langtools jaxp-only
erikj@458 108 jaxp-only:
ohair@425 109 @$(call MakeStart,jaxp,all)
erikj@458 110 @($(CD) $(JAXP_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(MAKE_ARGS))
ohair@425 111 @$(call MakeFinish,jaxp,all)
ohair@425 112
erikj@458 113 jaxws: langtools jaxp jaxws-only
erikj@458 114 jaxws-only:
ohair@425 115 @$(call MakeStart,jaxws,all)
erikj@458 116 @($(CD) $(JAXWS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(MAKE_ARGS))
ohair@425 117 @$(call MakeFinish,jaxws,all)
ohair@425 118
erikj@458 119 hotspot: langtools hotspot-only
erikj@458 120 hotspot-only:
ohair@425 121 @$(call MakeStart,hotspot,all)
erikj@445 122 @($(CD) $(HOTSPOT_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) -j1 $(HOTSPOT_MAKE_ARGS) $(MAKE_ARGS))
ohair@425 123 @$(call MakeFinish,hotspot,all)
ohair@425 124
erikj@458 125 jdk: langtools corba jaxp jaxws hotspot jdk-only
erikj@458 126 jdk-only:
ohair@425 127 @$(call MakeStart,jdk,all)
erikj@458 128 @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(MAKE_ARGS))
ohair@425 129 @$(call MakeFinish,jdk,all)
ohair@425 130
erikj@458 131 images: source-tips start-make jdk langtools corba jaxp jaxws hotspot images-only
erikj@458 132 images-only:
ohair@425 133 @$(call MakeStart,jdk-images,$@)
erikj@458 134 @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(JDK_MAKE_ARGS) $(MAKE_ARGS) images)
ohair@425 135 @$(call MakeFinish,jdk-images,$@)
ohair@425 136 @$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port)
erikj@445 137 @$(call AtRootMakeEnd)
ohair@425 138
erikj@458 139 install: source-tips start-make jdk langtools corba jaxp jaxws hotspot install-only
erikj@458 140 install-only:
erikj@458 141 @$(call MakeStart,jdk-images,$@)
erikj@458 142 @($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) -j$(JOBS) $(JDK_MAKE_ARGS) $(MAKE_ARGS) install)
erikj@458 143 @$(call MakeFinish,jdk-images,$@)
erikj@445 144 @$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port)
erikj@445 145 @$(call AtRootMakeEnd)
ohair@425 146
erikj@445 147 start-make:
erikj@445 148 @$(call AtRootMakeStart)
erikj@445 149
erikj@458 150 .PHONY: jdk hotspot jaxws jaxp corba langtools install images start-make
erikj@445 151
erikj@445 152 test: start-make
erikj@445 153 @$(call MakeStart,test,$(if $(TEST),$(TEST),all))
erikj@445 154 @($(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 155 @$(call MakeFinish,test,$(if $(TEST),$(TEST),all))
erikj@445 156 @$(call AtRootMakeEnd)
erikj@445 157 .PHONY: test
erikj@445 158
erikj@445 159
erikj@445 160 # Stores the tips for each repository. This file is be used when constructing the jdk image and can be
erikj@445 161 # used to track the exact sources used to build that image.
erikj@445 162 source-tips: $(OUTPUT_ROOT)/source_tips
erikj@445 163 $(OUTPUT_ROOT)/source_tips: FRC
erikj@445 164 @$(MKDIR) -p $(@D)
erikj@445 165 @$(RM) $@
erikj@445 166 @$(call GetSourceTips)
erikj@445 167
ohair@425 168
ohair@425 169 # Remove everything, except the output from configure.
ohair@425 170 clean:
erikj@458 171 @(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 172 @$(ECHO) Cleaned everything except the build configuration.
ohair@425 173 .PHONY: clean
ohair@425 174
ohair@425 175 # Remove everything, you have to rerun configure.
ohair@425 176 dist-clean:
ohair@425 177 @$(RM) -r $(OUTPUT_ROOT)
ohair@425 178 @$(ECHO) Cleaned everything, you will have to re-run configure.
ohair@425 179 .PHONY: dist-clean
ohair@425 180
ohair@425 181 clean-jdk:
erikj@458 182 @(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 183 grep -v langtools | grep -v corba | grep -v jaxp | grep -v jaxws | grep -v hotspot`)
ohair@425 184 @$(ECHO) "Cleaned jdk build artifacts (but not langtools,corba,jaxp,jaxws,hotspot nor the build configuration)"
ohair@425 185 .PHONY: clean
ohair@425 186
erikj@445 187 endif
erikj@445 188
erikj@445 189 # Here are "global" targets, i.e. targets that can be executed without specifying a single configuration.
erikj@445 190 # If you addd more global targets, please update the fatal-error macro.
erikj@445 191
ohair@425 192 help:
erikj@445 193 $(info )
erikj@445 194 $(info OpenJDK Makefile help)
erikj@445 195 $(info =====================)
erikj@445 196 $(info )
erikj@445 197 $(info Common make targets)
erikj@445 198 $(info . make [all] # Compile all code but do not create images)
erikj@445 199 $(info . make images # Create complete j2sdk and j2re images)
erikj@445 200 $(info . make install # Install the generated images locally)
erikj@445 201 $(info . make clean # Remove all files generated by make, but not those generated by configure)
erikj@445 202 $(info . make dist-clean # Remove all files generated by both make and configure)
erikj@445 203 $(info . make help # Give some help on using make)
erikj@445 204 $(info . make test # Run tests, default is all tests (see TEST below))
erikj@445 205 $(info )
erikj@445 206 $(info Useful make variables)
erikj@445 207 $(info . make CONF= # Build all configurations (note, assignment is empty))
erikj@445 208 $(info . make CONF=<substring> # Build the configuration(s) with a name matching the given substring)
erikj@445 209 $(info )
erikj@445 210 $(info . make LOG=<loglevel> # Change loglevel from warn (default) to the given loglevel)
erikj@445 211 $(info . # Available loglevels are: warn, info, debug and trace)
erikj@445 212 $(info . # To see executed command lines, use LOG=info)
erikj@445 213 $(info )
erikj@445 214 $(info . make test TEST=<test> # Only run the given test or tests, e.g.)
erikj@445 215 $(info . # make test TEST="jdk_lang jdk_net")
erikj@445 216 $(info )
ohair@425 217 .PHONY: help
erikj@445 218 FRC: # Force target

mercurial