Thu, 16 May 2013 12:16:07 -0700
Added tag jdk8-b90 for changeset e19283cd30a4
ohair@1369 | 1 | # |
ohair@1369 | 2 | # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
ohair@1369 | 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ohair@1369 | 4 | # |
ohair@1369 | 5 | # This code is free software; you can redistribute it and/or modify it |
ohair@1369 | 6 | # under the terms of the GNU General Public License version 2 only, as |
ohair@1369 | 7 | # published by the Free Software Foundation. Oracle designates this |
ohair@1369 | 8 | # particular file as subject to the "Classpath" exception as provided |
ohair@1369 | 9 | # by Oracle in the LICENSE file that accompanied this code. |
ohair@1369 | 10 | # |
ohair@1369 | 11 | # This code is distributed in the hope that it will be useful, but WITHOUT |
ohair@1369 | 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ohair@1369 | 13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ohair@1369 | 14 | # version 2 for more details (a copy is included in the LICENSE file that |
ohair@1369 | 15 | # accompanied this code). |
ohair@1369 | 16 | # |
ohair@1369 | 17 | # You should have received a copy of the GNU General Public License version |
ohair@1369 | 18 | # 2 along with this work; if not, write to the Free Software Foundation, |
ohair@1369 | 19 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ohair@1369 | 20 | # |
ohair@1369 | 21 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@1369 | 22 | # or visit www.oracle.com if you need additional information or have any |
ohair@1369 | 23 | # questions. |
ohair@1369 | 24 | # |
ohair@1369 | 25 | |
ohair@1369 | 26 | # This must be the first rule |
ohair@1369 | 27 | default: all |
ohair@1369 | 28 | |
ohair@1369 | 29 | include $(SPEC) |
ohair@1369 | 30 | include MakeBase.gmk |
ohair@1369 | 31 | include JavaCompilation.gmk |
ohair@1369 | 32 | |
ohair@1369 | 33 | # The BOOT_JAVAC setup uses the bootdir compiler to compile the tools |
ohair@1369 | 34 | # and the bootstrap javac, to be run by the bootdir jvm. |
ohair@1369 | 35 | $(eval $(call SetupJavaCompiler,BOOT_JAVAC,\ |
ohair@1369 | 36 | JAVAC:=$(JAVAC),\ |
ohair@1369 | 37 | SERVER_DIR:=$(SJAVAC_SERVER_DIR),\ |
ohair@1369 | 38 | SERVER_JVM:=$(SJAVAC_SERVER_JAVA),\ |
ohair@1369 | 39 | FLAGS:=-XDignore.symbol.file=true -g -Xlint:all$(COMMA)-deprecation -Werror)) |
ohair@1369 | 40 | |
erikj@1424 | 41 | # javax.tools.JavaCompilerTool isn't really a suffix but this gets the file copied. |
erikj@1424 | 42 | RESOURCE_SUFFIXES:=.gif .xml .css .js javax.tools.JavaCompilerTool |
erikj@1424 | 43 | |
ohair@1369 | 44 | # Now setup the compilation of the properties compilation tool. You can depend |
ohair@1369 | 45 | # upon $(BUILD_TOOLS) to trigger a compilation of the tools. Note that we |
ohair@1369 | 46 | # add src/share/classes to the sourcepath. This is necessary since the GenStubs |
ohair@1369 | 47 | # program needs to be linked and run towards the new javac sources. |
ohair@1369 | 48 | $(eval $(call SetupJavaCompilation,BUILD_TOOLS,\ |
ohair@1369 | 49 | SETUP:=BOOT_JAVAC,\ |
ohair@1369 | 50 | DISABLE_SJAVAC:=true,\ |
ohair@1369 | 51 | ADD_JAVAC_FLAGS:=-Xprefer:source,\ |
ohair@1369 | 52 | SRC:=$(LANGTOOLS_TOPDIR)/make/tools $(LANGTOOLS_TOPDIR)/src/share/classes,\ |
ohair@1369 | 53 | INCLUDES:=compileproperties genstubs,\ |
ohair@1369 | 54 | BIN:=$(LANGTOOLS_OUTPUTDIR)/btclasses)) |
ohair@1369 | 55 | |
ohair@1369 | 56 | # The compileprops tools compiles a properties file into a resource bundle. |
ohair@1369 | 57 | TOOL_COMPILEPROPS_CMD:=$(JAVA) -cp $(LANGTOOLS_OUTPUTDIR)/btclasses compileproperties.CompileProperties -quiet |
ohair@1369 | 58 | # Lookup the properties that need to be compiled into resource bundles. |
ohair@1369 | 59 | PROPSOURCES:=$(shell find $(LANGTOOLS_TOPDIR)/src/share/classes -name "*.properties") |
ohair@1369 | 60 | # Strip away prefix and suffix, leaving for example only: "com/sun/tools/javac/resources/javac_zh_CN" |
ohair@1369 | 61 | PROPPATHS:=$(patsubst $(LANGTOOLS_TOPDIR)/src/share/classes/%.properties,%,$(PROPSOURCES)) |
ohair@1369 | 62 | # Generate the list of java files to be created. |
ohair@1369 | 63 | PROPJAVAS:=$(patsubst %,$(LANGTOOLS_OUTPUTDIR)/gensrc/%.java,$(PROPPATHS)) |
ohair@1369 | 64 | # Generate the package dirs for the tobe generated java files. |
ohair@1369 | 65 | PROPDIRS:=$(dir $(PROPJAVAS)) |
ohair@1369 | 66 | # Now generate a sequence of "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle" |
ohair@1369 | 67 | # suitable to be fed into the CompileProperties command. |
ohair@1369 | 68 | PROPCMDLINE:=$(subst _SPACE_,$(SPACE),$(join $(addprefix -compile_SPACE_,$(PROPSOURCES)), \ |
ohair@1369 | 69 | $(addsuffix _SPACE_java.util.ListResourceBundle,$(addprefix _SPACE_$(LANGTOOLS_OUTPUTDIR)/gensrc/,$(addsuffix .java,$(PROPPATHS)))))) |
ohair@1369 | 70 | |
ohair@1369 | 71 | # Now setup the rule for the generation of the resource bundles. |
ohair@1369 | 72 | $(LANGTOOLS_OUTPUTDIR)/gensrc/_the_props.d : $(PROPSOURCES) $(BUILD_TOOLS) |
ohair@1369 | 73 | rm -rf $(@D)/* |
ohair@1369 | 74 | mkdir -p $(@D) $(PROPDIRS) |
ohair@1369 | 75 | printf "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" > $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javah/resources/version.properties |
ohair@1369 | 76 | printf "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" > $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javap/resources/version.properties |
ohair@1369 | 77 | printf "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" > $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javac/resources/version.properties |
mchung@1472 | 78 | printf "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" > $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/jdeps/resources/version.properties |
ohair@1369 | 79 | echo Compiling $(words $(PROPSOURCES) v1 v2 v3) properties into resource bundles |
ohair@1369 | 80 | $(TOOL_COMPILEPROPS_CMD) $(PROPCMDLINE) \ |
ohair@1369 | 81 | -compile $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javah/resources/version.properties \ |
ohair@1369 | 82 | $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javah/resources/version.java \ |
ohair@1369 | 83 | java.util.ListResourceBundle \ |
ohair@1369 | 84 | -compile $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javap/resources/version.properties \ |
ohair@1369 | 85 | $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javap/resources/version.java \ |
ohair@1369 | 86 | java.util.ListResourceBundle \ |
ohair@1369 | 87 | -compile $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javac/resources/version.properties \ |
ohair@1369 | 88 | $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/javac/resources/version.java \ |
mchung@1472 | 89 | java.util.ListResourceBundle \ |
mchung@1472 | 90 | -compile $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/jdeps/resources/version.properties \ |
mchung@1472 | 91 | $(LANGTOOLS_OUTPUTDIR)/gensrc/com/sun/tools/jdeps/resources/version.java \ |
ohair@1369 | 92 | java.util.ListResourceBundle |
ohair@1369 | 93 | echo PROPS_ARE_CREATED=yes > $@ |
ohair@1369 | 94 | |
ohair@1369 | 95 | # Trigger the generation of the resource bundles. After the resource bundles have |
ohair@1369 | 96 | # been compiled, then the makefile will restart and the newly created java files |
ohair@1369 | 97 | # will become part of the build further along in the makefile. |
ohair@1369 | 98 | -include $(LANGTOOLS_OUTPUTDIR)/gensrc/_the_props.d |
ohair@1369 | 99 | |
ohair@1369 | 100 | ifeq ($(PROPS_ARE_CREATED),yes) |
ohair@1369 | 101 | # Setup the rules to build a dist/bootstrap/lib/javac.jar, ie a smaller intermediate javac |
ohair@1369 | 102 | # that can be compiled with an old javac. The intermediate javac is then used |
ohair@1369 | 103 | # to compile javac again and to build the complete new jdk. |
ohair@1369 | 104 | $(eval $(call SetupJavaCompilation,BUILD_BOOTSTRAP_LANGTOOLS,\ |
ohair@1369 | 105 | SETUP:=BOOT_JAVAC,\ |
ohair@1369 | 106 | DISABLE_SJAVAC:=true,\ |
ohair@1369 | 107 | SRC:=$(LANGTOOLS_TOPDIR)/src/share/classes $(LANGTOOLS_OUTPUTDIR)/gensrc,\ |
ohair@1369 | 108 | EXCLUDES:=com/sun/tools/javac/nio,\ |
erikj@1424 | 109 | COPY:=$(RESOURCE_SUFFIXES),\ |
ohair@1369 | 110 | BIN:=$(LANGTOOLS_OUTPUTDIR)/btclasses/bootstrap)) |
ohair@1369 | 111 | |
ohair@1369 | 112 | $(eval $(call SetupArchive,ARCHIVE_BOOTSTRAP_JAVAC,$(BUILD_BOOTSTRAP_LANGTOOLS),\ |
ohair@1369 | 113 | SRCS:=$(LANGTOOLS_OUTPUTDIR)/btclasses/bootstrap,\ |
ohair@1369 | 114 | JAR:=$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar,\ |
ohrstrom@1525 | 115 | SUFFIXES:=.class $(RESOURCE_SUFFIXES))) |
ohair@1369 | 116 | |
ohair@1369 | 117 | # GenStubs is used to bootstrap any dependencies from javac to the new JDK that is not |
ohair@1369 | 118 | # yet built. It is currently not needed but might be again in the future. The following |
ohair@1369 | 119 | # exercises the functionality to verify that it works. |
ohair@1369 | 120 | TOOL_GENSTUBS_CMD=$(JAVA) \ |
ohair@1369 | 121 | "-Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar" \ |
ohair@1369 | 122 | -classpath $(LANGTOOLS_OUTPUTDIR)/btclasses \ |
ohair@1369 | 123 | genstubs.GenStubs |
ohair@1369 | 124 | # We fetch source from the JDK... |
ohair@1369 | 125 | JDKS=$(JDK_TOPDIR)/src/share/classes |
ohair@1369 | 126 | # Build the list of classes to generate stubs from. java/util/Objects.java isn't |
ohair@1369 | 127 | # currently needed, but is used as a demo for now. |
ohair@1369 | 128 | STUBSOURCES:=$(shell $(FIND) $(JDKS) -name "*.java" | $(GREP) \ |
ohair@1369 | 129 | -e "$(JDKS)/java/util/Objects.java") |
ohair@1369 | 130 | # Rewrite the file names into class names because the GenStubs tool require this. |
ohair@1369 | 131 | STUBCLASSES:=$(subst /,.,$(patsubst $(JDKS)/%.java,%,$(STUBSOURCES))) |
ohair@1369 | 132 | |
ohair@1369 | 133 | # Now setup the build recipe for genstubs. |
ohair@1369 | 134 | $(LANGTOOLS_OUTPUTDIR)/genstubs/_the_stubs.d : $(STUBSOURCES) $(BUILD_TOOLS) \ |
ohair@1369 | 135 | $(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar \ |
ohair@1369 | 136 | $(LANGTOOLS_OUTPUTDIR)/gensrc/_the_props.d |
ohair@1369 | 137 | mkdir -p $(@D) |
ohair@1369 | 138 | mkdir -p $(LANGTOOLS_OUTPUTDIR)/tmpstubs |
ohair@1369 | 139 | echo $(LOG_INFO) Generating stubs from JDK sources. |
ohair@1369 | 140 | ($(TOOL_GENSTUBS_CMD) -s $(LANGTOOLS_OUTPUTDIR)/tmpstubs -sourcepath $(JDKS) $(STUBCLASSES) && echo STUBS_ARE_CREATED=yes > $@) |
ohair@1369 | 141 | if $(DIFF) -x "_the*" -rq $(LANGTOOLS_OUTPUTDIR)/tmpstubs $(LANGTOOLS_OUTPUTDIR)/genstubs > /dev/null 2>&1; then \ |
ohair@1369 | 142 | echo $(LOG_INFO) No changes in the stubs!; \ |
ohair@1369 | 143 | rm -rf $(LANGTOOLS_OUTPUTDIR)/tmpstubs; \ |
ohair@1369 | 144 | else \ |
ohair@1369 | 145 | echo $(LOG_INFO) Changes in stubs detected!; \ |
ohair@1369 | 146 | rm -rf $(@D); \ |
ohair@1369 | 147 | mv $(LANGTOOLS_OUTPUTDIR)/tmpstubs $(@D); \ |
ohair@1369 | 148 | fi |
ohair@1369 | 149 | echo STUBS_ARE_CREATED=yes > $@ |
ohair@1369 | 150 | |
ohair@1369 | 151 | # Trigger a generation of the genstubs java source code and a restart |
ohair@1369 | 152 | # of the makefile to make sure that the following build setup use the |
ohair@1369 | 153 | # newly created java files. |
ohair@1369 | 154 | -include $(LANGTOOLS_OUTPUTDIR)/genstubs/_the_stubs.d |
ohair@1369 | 155 | |
ohair@1369 | 156 | ifeq ($(STUBS_ARE_CREATED),yes) |
ohair@1369 | 157 | # Setup a compiler configuration using the intermediate javac in dist/bootstrap/lib/javac.jar |
ohair@1369 | 158 | # that generates code for the new jdk that is being built. |
ohair@1369 | 159 | # The code compiled by this compiler setup, cannot necessarily be run with the bootstrap jvm. |
ohair@1369 | 160 | $(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE,\ |
ohair@1369 | 161 | JVM:=$(JAVA),\ |
ohair@1369 | 162 | JAVAC:="-Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar" \ |
ohrstrom@1525 | 163 | -cp $(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar \ |
ohrstrom@1525 | 164 | com.sun.tools.javac.Main,\ |
ohair@1369 | 165 | FLAGS:=-XDignore.symbol.file=true -Xlint:all$(COMMA)-deprecation -Werror,\ |
ohair@1369 | 166 | SERVER_DIR:=$(SJAVAC_SERVER_DIR),\ |
ohair@1369 | 167 | SERVER_JVM:=$(SJAVAC_SERVER_JAVA))) |
ohair@1369 | 168 | |
ohair@1369 | 169 | $(eval $(call SetupJavaCompilation,BUILD_FULL_JAVAC,\ |
ohair@1369 | 170 | SETUP:=GENERATE_NEWBYTECODE,\ |
ohair@1369 | 171 | SRC:=$(LANGTOOLS_TOPDIR)/src/share/classes $(LANGTOOLS_OUTPUTDIR)/gensrc \ |
ohair@1369 | 172 | $(LANGTOOLS_OUTPUTDIR)/genstubs,\ |
ohair@1369 | 173 | EXCLUDES:=java/util java/io java/nio,\ |
ohair@1369 | 174 | COPY:=$(RESOURCE_SUFFIXES),\ |
ohair@1369 | 175 | BIN:=$(LANGTOOLS_OUTPUTDIR)/classes)) |
ohair@1369 | 176 | |
ohair@1369 | 177 | $(eval $(call SetupArchive,ARCHIVE_FULL_JAVAC,$(BUILD_FULL_JAVAC),\ |
ohair@1369 | 178 | SETUP:=GENERATE_NEWBYTECODE,\ |
ohair@1369 | 179 | SRCS:=$(LANGTOOLS_OUTPUTDIR)/classes,\ |
ohair@1369 | 180 | SUFFIXES:=.class $(RESOURCE_SUFFIXES),\ |
ohair@1369 | 181 | JAR:=$(LANGTOOLS_OUTPUTDIR)/dist/lib/classes.jar)) |
ohair@1369 | 182 | |
ohair@1369 | 183 | $(eval $(call SetupZipArchive,ZIP_FULL_JAVAC_SOURCE,\ |
ohair@1369 | 184 | SRC:=$(LANGTOOLS_TOPDIR)/src/share/classes $(LANGTOOLS_OUTPUTDIR)/gensrc,\ |
ohair@1369 | 185 | ZIP:=$(LANGTOOLS_OUTPUTDIR)/dist/lib/src.zip)) |
ohair@1369 | 186 | |
ohair@1369 | 187 | all: $(LANGTOOLS_OUTPUTDIR)/dist/lib/classes.jar \ |
ohair@1369 | 188 | $(LANGTOOLS_OUTPUTDIR)/dist/lib/src.zip \ |
ohrstrom@1525 | 189 | $(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar |
ohair@1369 | 190 | |
ohair@1369 | 191 | endif |
ohair@1369 | 192 | endif |