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