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