makefiles/Makefile

Thu, 31 May 2012 15:07:29 -0700

author
jjh
date
Thu, 31 May 2012 15:07:29 -0700
changeset 1270
844478076c25
parent 1244
807ca8ffbeb4
child 1273
ac29cc95b5c5
permissions
-rw-r--r--

7159016: Static import of member in processor-generated class fails in JDK 7
Reviewed-by: jjg

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

mercurial