8054834: Modular Source Code

Co-authored-by: Alan Bateman <alan.bateman@oracle.com>
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Magnus Ihse Bursie <magnus.ihse.bursie@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Paul Sandoz <paul.sandoz@oracle.com>
Reviewed-by: alanb, chegar, ihse, mduigou
This commit is contained in:
Chris Hegarty 2014-08-17 15:51:37 +01:00
parent a00c5cca87
commit ebd8efe5ef
30 changed files with 5726 additions and 467 deletions

105
Makefile
View File

@ -58,29 +58,70 @@ $(eval $(call ParseConfAndSpec))
ifeq ($(SPEC),)
# Since we got past ParseConfAndSpec, we must be building a global target. Do nothing.
else
ifeq ($(words $(SPEC)),1)
# We are building a single configuration. This is the normal case. Execute the Main.gmk file.
include $(root_dir)/make/Main.gmk
else
# We are building multiple configurations.
# First, find out the valid targets
# Run the makefile with an arbitrary SPEC using -p -q (quiet dry-run and dump rules) to find
# available PHONY targets. Use this list as valid targets to pass on to the repeated calls.
all_phony_targets=$(filter-out $(global_targets), $(strip $(shell \
cd $(root_dir) && $(MAKE) -p -q FRC SPEC=$(firstword $(SPEC)) | \
grep ^.PHONY: | head -n 1 | cut -d " " -f 2-)))
$(all_phony_targets):
@$(foreach spec,$(SPEC),(cd $(root_dir) && $(MAKE) SPEC=$(spec) \
$(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $@) &&) true
.PHONY: $(all_phony_targets)
# In Cygwin, the MAKE variable gets messed up if the make executable is called with
# a Windows mixed path (c:/cygwin/bin/make.exe). If that's the case, fix it by removing
# the prepended root_dir.
ifneq ($(findstring :, $(MAKE)), )
MAKE := $(patsubst $(root_dir)%, %, $(MAKE))
endif
# We are potentially building multiple configurations.
# First, find out the valid targets
# Run the makefile with an arbitrary SPEC using -p -q (quiet dry-run and dump rules) to find
# available PHONY targets. Use this list as valid targets to pass on to the repeated calls.
all_phony_targets := $(sort $(filter-out $(global_targets), $(strip $(shell \
cd $(root_dir)/make && $(MAKE) -f Main.gmk -p -q FRC SPEC=$(firstword $(SPEC)) | \
grep "^.PHONY:" | head -n 1 | cut -d " " -f 2-))))
# Loop through the configurations and call the main-wrapper for each one. The wrapper
# target will execute with a single configuration loaded.
$(all_phony_targets):
@$(if $(TARGET_RUN),,\
$(foreach spec,$(SPEC),\
(cd $(root_dir) && $(MAKE) SPEC=$(spec) MAIN_TARGETS="$(call GetRealTarget)" \
$(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) main-wrapper) &&) true)
@echo > /dev/null
$(eval TARGET_RUN=true)
.PHONY: $(all_phony_targets)
ifneq ($(MAIN_TARGETS), )
# The wrapper target was called so we now have a single configuration. Load the spec file
# and call the real Main.gmk.
include $(SPEC)
### Clean up from previous run
# Remove any build.log from a previous run, if they exist
ifneq (,$(BUILD_LOG))
ifneq (,$(BUILD_LOG_PREVIOUS))
# Rotate old log
$(shell $(RM) $(BUILD_LOG_PREVIOUS) 2> /dev/null)
$(shell $(MV) $(BUILD_LOG) $(BUILD_LOG_PREVIOUS) 2> /dev/null)
else
$(shell $(RM) $(BUILD_LOG) 2> /dev/null)
endif
$(shell $(RM) $(OUTPUT_ROOT)/build-trace-time.log 2> /dev/null)
endif
# Remove any javac server logs and port files. This
# prevents a new make run to reuse the previous servers.
ifneq (,$(SJAVAC_SERVER_DIR))
$(shell $(MKDIR) -p $(SJAVAC_SERVER_DIR) && $(RM) -rf $(SJAVAC_SERVER_DIR)/*)
endif
main-wrapper:
@$(if $(findstring clean, $(MAIN_TARGETS)), , $(call AtMakeStart))
(cd $(root_dir)/make && $(BUILD_LOG_WRAPPER) $(MAKE) -f Main.gmk SPEC=$(SPEC) -j $(JOBS) \
$(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $(MAIN_TARGETS) \
$(if $(filter true, $(OUTPUT_SYNC_SUPPORTED)), -O$(OUTPUT_SYNC)))
@$(if $(findstring clean, $(MAIN_TARGETS)), , $(call AtMakeEnd))
.PHONY: main-wrapper
endif
endif
# Here are "global" targets, i.e. targets that can be executed without specifying a single configuration.
# If you addd more global targets, please update the variable global_targets in MakeHelpers.
# If you add more global targets, please update the variable global_targets in MakeHelpers.
help:
$(info )
@ -88,12 +129,12 @@ help:
$(info =====================)
$(info )
$(info Common make targets)
$(info . make [default] # Compile all product in langtools, hotspot, jaxp, jaxws,)
$(info . # corba and jdk)
$(info . make all # Compile everything, all repos and images)
$(info . make [default] # Compile all modules in langtools, hotspot, jaxp, jaxws,)
$(info . # corba and jdk and create a runnable "exploded" image)
$(info . make all # Compile everything, all repos, docs and images)
$(info . make images # Create complete j2sdk and j2re images)
$(info . make docs # Create javadocs)
$(info . make overlay-images # Create limited images for sparc 64 bit platforms)
$(info . make docs # Create all docs)
$(info . make docs-javadoc # Create just javadocs, depends on less than full docs)
$(info . make profiles # Create complete j2re compact profile images)
$(info . make bootcycle-images # Build images twice, second time with newly build JDK)
$(info . make install # Install the generated images locally)
@ -103,12 +144,18 @@ help:
$(info . make help # Give some help on using make)
$(info . make test # Run tests, default is all tests (see TEST below))
$(info )
$(info Targets for specific components)
$(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk, nashorn, images, overlay-images, docs or test))
$(info . make <component> # Build <component> and everything it depends on. )
$(info . make <component>-only # Build <component> only, without dependencies. This)
$(info Targets for specific modules)
$(info . make <module> # Build <module> and everything it depends on. )
$(info . make <module>-only # Build <module> only, without dependencies. This)
$(info . # is faster but can result in incorrect build results!)
$(info . make clean-<component> # Remove files generated by make for <component>)
$(info . make <module>-java # Compile java classes for <module> and everything it)
$(info . # depends on)
$(info . make <module>-libs # Build native libraries for <module> and everything it)
$(info . # depends on)
$(info . make <module>-launchers# Build native executables for <module> and everything it)
$(info . # depends on)
$(info . make <module>-gensrc # Execute the gensrc step for <module> and everything it)
$(info . # depends on)
$(info )
$(info Useful make variables)
$(info . make CONF= # Build all configurations (note, assignment is empty))

View File

@ -759,6 +759,32 @@ AC_DEFUN([BASIC_CHECK_MAKE_VERSION],
fi
])
AC_DEFUN([BASIC_CHECK_MAKE_OUTPUT_SYNC],
[
# Check if make supports the output sync option and if so, setup using it.
AC_MSG_CHECKING([if make --output-sync is supported])
if $MAKE --version -O > /dev/null 2>&1; then
OUTPUT_SYNC_SUPPORTED=true
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([for output-sync value])
AC_ARG_WITH([output-sync], [AS_HELP_STRING([--with-output-sync],
[set make output sync type if supported by make. @<:@recurse@:>@])],
[OUTPUT_SYNC=$with_output_sync])
if test "x$OUTPUT_SYNC" = "x"; then
OUTPUT_SYNC=none
fi
AC_MSG_RESULT([$OUTPUT_SYNC])
if ! $MAKE --version -O$OUTPUT_SYNC > /dev/null 2>&1; then
AC_MSG_ERROR([Make did not the support the value $OUTPUT_SYNC as output sync type.])
fi
else
OUTPUT_SYNC_SUPPORTED=false
AC_MSG_RESULT([no])
fi
AC_SUBST(OUTPUT_SYNC_SUPPORTED)
AC_SUBST(OUTPUT_SYNC)
])
# Goes looking for a usable version of GNU make.
AC_DEFUN([BASIC_CHECK_GNU_MAKE],
[
@ -805,6 +831,8 @@ AC_DEFUN([BASIC_CHECK_GNU_MAKE],
MAKE=$FOUND_MAKE
AC_SUBST(MAKE)
AC_MSG_NOTICE([Using GNU make 3.81 (or later) at $FOUND_MAKE (version: $MAKE_VERSION_STRING)])
BASIC_CHECK_MAKE_OUTPUT_SYNC
])
AC_DEFUN([BASIC_CHECK_FIND_DELETE],

View File

@ -401,4 +401,10 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS],
JAVA_FLAGS_SMALL=$boot_jdk_jvmargs_small
AC_SUBST(JAVA_FLAGS_SMALL)
JAVA_TOOL_FLAGS_SMALL=""
for f in $JAVA_FLAGS_SMALL; do
JAVA_TOOL_FLAGS_SMALL="$JAVA_TOOL_FLAGS_SMALL -J$f"
done
AC_SUBST(JAVA_TOOL_FLAGS_SMALL)
])

View File

@ -45,7 +45,7 @@ EXPR="@EXPR@"
FILE="@FILE@"
FIND="@FIND@"
GREP="@GREP@"
JAVAP="@FIXPATH@ @BOOT_JDK@/bin/javap"
JAVAP="@FIXPATH@ @BOOT_JDK@/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
LDD="@LDD@"
MKDIR="@MKDIR@"
NAWK="@NAWK@"

View File

@ -668,12 +668,9 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
# Setup some hard coded includes
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \
-I${JDK_OUTPUTDIR}/include \
-I${JDK_OUTPUTDIR}/include/$OPENJDK_TARGET_OS \
-I${JDK_TOPDIR}/src/share/javavm/export \
-I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_EXPORT_DIR/javavm/export \
-I${JDK_TOPDIR}/src/share/native/common \
-I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_API_DIR/native/common"
-I${JDK_TOPDIR}/src/java.base/share/native/include \
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS/native/include \
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_API_DIR/native/include"
# The shared libraries are compiled using the picflag.
CFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"

View File

@ -805,6 +805,7 @@ JAXWS_TOPDIR
JAXP_TOPDIR
CORBA_TOPDIR
LANGTOOLS_TOPDIR
JAVA_TOOL_FLAGS_SMALL
JAVA_FLAGS_SMALL
JAVA_FLAGS_BIG
JAVA_FLAGS
@ -865,6 +866,8 @@ LDD
ZIP
UNZIP
FIND_DELETE
OUTPUT_SYNC
OUTPUT_SYNC_SUPPORTED
MAKE
CHECK_TOOLSDIR_MAKE
CHECK_TOOLSDIR_GMAKE
@ -1044,6 +1047,7 @@ with_toolchain_path
with_extra_path
with_sdk_name
with_conf_name
with_output_sync
with_builddeps_conf
with_builddeps_server
with_builddeps_dir
@ -1881,6 +1885,8 @@ Optional Packages:
--with-sdk-name use the platform SDK of the given name. [macosx]
--with-conf-name use this as the name of the configuration [generated
from important configuration options]
--with-output-sync set make output sync type if supported by make.
[recurse]
--with-builddeps-conf use this configuration file for the builddeps
--with-builddeps-server download and use build dependencies from this server
url
@ -3487,6 +3493,8 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# $2: the description on how we found this
# Goes looking for a usable version of GNU make.
@ -4311,7 +4319,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=1405336663
DATE_WHEN_GENERATED=1407143049
###############################################################################
#
@ -13924,7 +13932,7 @@ $as_echo "$COMPILE_TYPE" >&6; }
# Setup OPENJDK_TARGET_OS_API_DIR, used in source paths.
if test "x$OPENJDK_TARGET_OS_API" = xposix; then
OPENJDK_TARGET_OS_API_DIR="solaris"
OPENJDK_TARGET_OS_API_DIR="unix"
fi
if test "x$OPENJDK_TARGET_OS_API" = xwinapi; then
OPENJDK_TARGET_OS_API_DIR="windows"
@ -17147,6 +17155,39 @@ $as_echo "$as_me: Rewriting FOUND_MAKE to \"$new_complete\"" >&6;}
$as_echo "$as_me: Using GNU make 3.81 (or later) at $FOUND_MAKE (version: $MAKE_VERSION_STRING)" >&6;}
# Check if make supports the output sync option and if so, setup using it.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if make --output-sync is supported" >&5
$as_echo_n "checking if make --output-sync is supported... " >&6; }
if $MAKE --version -O > /dev/null 2>&1; then
OUTPUT_SYNC_SUPPORTED=true
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for output-sync value" >&5
$as_echo_n "checking for output-sync value... " >&6; }
# Check whether --with-output-sync was given.
if test "${with_output_sync+set}" = set; then :
withval=$with_output_sync; OUTPUT_SYNC=$with_output_sync
fi
if test "x$OUTPUT_SYNC" = "x"; then
OUTPUT_SYNC=none
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $OUTPUT_SYNC" >&5
$as_echo "$OUTPUT_SYNC" >&6; }
if ! $MAKE --version -O$OUTPUT_SYNC > /dev/null 2>&1; then
as_fn_error $? "Make did not the support the value $OUTPUT_SYNC as output sync type." "$LINENO" 5
fi
else
OUTPUT_SYNC_SUPPORTED=false
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
# Test if find supports -delete
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if find supports -delete" >&5
@ -19866,8 +19907,6 @@ fi
if test "x$with_cacerts_file" != x; then
CACERTS_FILE=$with_cacerts_file
else
CACERTS_FILE=${SRC_ROOT}/jdk/src/share/lib/security/cacerts
fi
@ -26378,6 +26417,12 @@ $as_echo "$boot_jdk_jvmargs_small" >&6; }
JAVA_FLAGS_SMALL=$boot_jdk_jvmargs_small
JAVA_TOOL_FLAGS_SMALL=""
for f in $JAVA_FLAGS_SMALL; do
JAVA_TOOL_FLAGS_SMALL="$JAVA_TOOL_FLAGS_SMALL -J$f"
done
###############################################################################
#
@ -42285,12 +42330,9 @@ fi
# Setup some hard coded includes
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \
-I${JDK_OUTPUTDIR}/include \
-I${JDK_OUTPUTDIR}/include/$OPENJDK_TARGET_OS \
-I${JDK_TOPDIR}/src/share/javavm/export \
-I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_EXPORT_DIR/javavm/export \
-I${JDK_TOPDIR}/src/share/native/common \
-I${JDK_TOPDIR}/src/$OPENJDK_TARGET_OS_API_DIR/native/common"
-I${JDK_TOPDIR}/src/java.base/share/native/include \
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS/native/include \
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_API_DIR/native/include"
# The shared libraries are compiled using the picflag.
CFLAGS_JDKLIB="$COMMON_CCXXFLAGS_JDK $CFLAGS_JDK $PICFLAG $CFLAGS_JDKLIB_EXTRA"
@ -49120,7 +49162,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if elliptic curve crypto implementation is present" >&5
$as_echo_n "checking if elliptic curve crypto implementation is present... " >&6; }
if test -d "${SRC_ROOT}/jdk/src/share/native/sun/security/ec/impl"; then
if test -d "${SRC_ROOT}/jdk/src/jdk.crypto.ec/share/native/libsunec/impl"; then
ENABLE_INTREE_EC=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }

View File

@ -414,8 +414,6 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
[specify alternative cacerts file])])
if test "x$with_cacerts_file" != x; then
CACERTS_FILE=$with_cacerts_file
else
CACERTS_FILE=${SRC_ROOT}/jdk/src/share/lib/security/cacerts
fi
AC_SUBST(CACERTS_FILE)
@ -441,7 +439,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
[
AC_MSG_CHECKING([if elliptic curve crypto implementation is present])
if test -d "${SRC_ROOT}/jdk/src/share/native/sun/security/ec/impl"; then
if test -d "${SRC_ROOT}/jdk/src/jdk.crypto.ec/share/native/libsunec/impl"; then
ENABLE_INTREE_EC=yes
AC_MSG_RESULT([yes])
else

View File

@ -331,7 +331,7 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS],
# Setup OPENJDK_TARGET_OS_API_DIR, used in source paths.
if test "x$OPENJDK_TARGET_OS_API" = xposix; then
OPENJDK_TARGET_OS_API_DIR="solaris"
OPENJDK_TARGET_OS_API_DIR="unix"
fi
if test "x$OPENJDK_TARGET_OS_API" = xwinapi; then
OPENJDK_TARGET_OS_API_DIR="windows"

View File

@ -74,6 +74,9 @@ ifeq (,$(findstring -I @TOPDIR@/make/common,$(MAKE)))
MAKE:=$(MAKE) -I @TOPDIR@/make/common
endif
OUTPUT_SYNC_SUPPORTED:=@OUTPUT_SYNC_SUPPORTED@
OUTPUT_SYNC:=@OUTPUT_SYNC@
# The "human readable" name of this configuration
CONF_NAME:=@CONF_NAME@
@ -240,6 +243,7 @@ HOTSPOT_OUTPUTDIR=$(BUILD_OUTPUT)/hotspot
JDK_OUTPUTDIR=$(BUILD_OUTPUT)/jdk
NASHORN_OUTPUTDIR=$(BUILD_OUTPUT)/nashorn
IMAGES_OUTPUTDIR=$(BUILD_OUTPUT)/images
TESTMAKE_OUTPUTDIR=$(BUILD_OUTPUT)/testmake
LANGTOOLS_DIST=$(LANGTOOLS_OUTPUTDIR)/dist
CORBA_DIST=$(CORBA_OUTPUTDIR)/dist
@ -446,6 +450,7 @@ POST_MCS_CMD:=@POST_MCS_CMD@
JAVA_FLAGS:=@JAVA_FLAGS@
JAVA_FLAGS_BIG:=@JAVA_FLAGS_BIG@
JAVA_FLAGS_SMALL:=@JAVA_FLAGS_SMALL@
JAVA_TOOL_FLAGS_SMALL:=@JAVA_TOOL_FLAGS_SMALL@
JAVA=@FIXPATH@ @JAVA@ $(JAVA_FLAGS_BIG) $(JAVA_FLAGS)
JAVA_SMALL=@FIXPATH@ @JAVA@ $(JAVA_FLAGS_SMALL) $(JAVA_FLAGS)
@ -459,7 +464,7 @@ JAVAH:=@FIXPATH@ @JAVAH@
JAR:=@FIXPATH@ @JAR@
NATIVE2ASCII:=@FIXPATH@ @NATIVE2ASCII@ $(addprefix -J, $(JAVA_FLAGS_SMALL))
NATIVE2ASCII:=@FIXPATH@ @NATIVE2ASCII@ $(JAVA_TOOL_FLAGS_SMALL)
JARSIGNER:=@FIXPATH@ @JARSIGNER@

View File

@ -93,14 +93,16 @@ diff_text() {
fi
# Ignore date strings in class files.
# On Macosx the system sources for generated java classes produce different output on
# consequtive invokations seemingly randomly.
# consequtive invocations seemingly randomly.
# For example a method parameter randomly named "thePoint" or "aPoint". Ignore this.
# Anonymous lambda classes get randomly assigned counters in their names.
if test "x$SUFFIX" = "xclass"; then
# To improve performance when large diffs are found, do a rough filtering of classes
# elibeble for these exceptions
if $GREP -R -e '[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}' \
-e '[0-9]\{2\}/[0-9]\{2\}/[0-9]\{4\}' \
-e thePoint -e aPoint -e setItemsPtr ${THIS_FILE} > /dev/null; then
-e thePoint -e aPoint -e setItemsPtr \
-e 'lambda\$[a-zA-Z0-9]*\$[0-9]' ${THIS_FILE} > /dev/null; then
$JAVAP -c -constants -l -p ${OTHER_FILE} > ${OTHER_FILE}.javap
$JAVAP -c -constants -l -p ${THIS_FILE} > ${THIS_FILE}.javap
TMP=$($DIFF ${OTHER_FILE}.javap ${THIS_FILE}.javap | \
@ -109,7 +111,8 @@ diff_text() {
-e '/[0-9]\{2\}\/[0-9]\{2\}\/[0-9]\{4\}/d' \
-e '/[<>].*Point Lcom\/apple\/jobjc\/foundation\/NSPoint;/d' \
-e '/[<>].*public com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*itemsPtr();/d' \
-e '/[<>].*public void setItemsPtr(com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*);/d')
-e '/[<>].*public void setItemsPtr(com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*);/d' \
-e '/[<>].*lambda\$[a-zA-Z0-9]*\$[0-9]*/d')
fi
fi
if test "x$SUFFIX" = "xproperties"; then
@ -122,7 +125,16 @@ diff_text() {
# -e :a -e '/\\$/N; s/\\\n//; ta' \
# -e 's/^[ \t]*//;s/[ \t]*$//' \
# -e 's/\\=/=/' | LC_ALL=C $SORT > $OTHER_FILE.cleaned
TMP=$(LC_ALL=C $DIFF $OTHER_FILE.cleaned $THIS_FILE)
# Filter out date string differences.
TMP=$(LC_ALL=C $DIFF $OTHER_FILE.cleaned $THIS_FILE | \
$GREP '^[<>]' | \
$SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d')
fi
if test "x$SUFFIX" = "xMF"; then
# Filter out date string differences.
TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \
$GREP '^[<>]' | \
$SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d')
fi
if test -n "$TMP"; then
echo Files $OTHER_FILE and $THIS_FILE differ
@ -145,7 +157,7 @@ compare_dirs() {
(cd $OTHER_DIR && $FIND . -type d | $SORT > $WORK_DIR/dirs_other)
(cd $THIS_DIR && $FIND . -type d | $SORT > $WORK_DIR/dirs_this)
$DIFF $WORK_DIR/dirs_other $WORK_DIR/dirs_other > $WORK_DIR/dirs_diff
$DIFF $WORK_DIR/dirs_other $WORK_DIR/dirs_this > $WORK_DIR/dirs_diff
echo -n Directory structure...
if [ -s $WORK_DIR/dirs_diff ]; then
@ -251,8 +263,8 @@ compare_file_types() {
do
if [ ! -f ${OTHER_DIR}/$f ]; then continue; fi
if [ ! -f ${THIS_DIR}/$f ]; then continue; fi
OF=`cd ${OTHER_DIR} && $FILE -h $f`
TF=`cd ${THIS_DIR} && $FILE -h $f`
OF=`cd ${OTHER_DIR} && $FILE -h $f | $SED 's/BuildID[^,]*//g'`
TF=`cd ${THIS_DIR} && $FILE -h $f | $SED 's/BuildID[^,]*//g'`
if [ "$f" = "./src.zip" ] || [[ "$f" = *"/Home/src.zip" ]] || [[ "$f" = *"/lib/JObjC.jar" ]]
then
if [ "`echo $OF | $GREP -ic zip`" -gt 0 -a "`echo $TF | $GREP -ic zip`" -gt 0 ]
@ -317,12 +329,14 @@ compare_general_files() {
-e 's/[A-Z][a-z]*, [A-Z][a-z]* [0-9][0-9]*, [12][0-9]* [0-9][0-9:]* [AMP]\{2,2\} [A-Z][A-Z]*/(removed)/' \
-e 's/[A-Z][a-z]* [A-Z][a-z]* [0-9][0-9] [0-9][0-9:]* [A-Z][A-Z]* [12][0-9]*/(removed)/' \
-e 's/^\( from \).*\(\.idl\)$/\1(removed)\2/' \
-e 's/^\(.*\)\( o'"'"'clock \)\([A-Z][A-Z][A-Z]\)/(removed)\2(removed)/' \
> $OTHER_FILE
$CAT $THIS_DIR/$f | $SED -e 's/\(-- Generated by javadoc \).*\( --\)/\1(removed)\2/' \
-e 's/\(<meta name="date" content="\).*\(">\)/\1(removed)\2/' \
-e 's/[A-Z][a-z]*, [A-Z][a-z]* [0-9][0-9]*, [12][0-9]* [0-9][0-9:]* [AMP]\{2,2\} [A-Z][A-Z]*/(removed)/' \
-e 's/[A-Z][a-z]* [A-Z][a-z]* [0-9][0-9] [0-9][0-9:]* [A-Z][A-Z]* [12][0-9]*/(removed)/' \
-e 's/^\( from \).*\(\.idl\)$/\1(removed)\2/' \
-e 's/^\(.*\)\( o'"'"'clock \)\([A-Z][A-Z][A-Z]\)/(removed)\2(removed)/' \
> $THIS_FILE
else
OTHER_FILE=$OTHER_DIR/$f
@ -510,7 +524,8 @@ compare_all_jar_files() {
WORK_DIR=$3
# TODO filter?
ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.jar" -o -name "*.war" | $SORT | $FILTER)
ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.jar" -o -name "*.war" \
| $SORT | $FILTER)
if [ -n "$ZIPS" ]; then
echo Jar files...
@ -538,9 +553,14 @@ compare_bin_file() {
OTHER_DIR=$2
WORK_DIR=$3
BIN_FILE=$4
OTHER_BIN_FILE=$5
THIS_FILE=$THIS_DIR/$BIN_FILE
OTHER_FILE=$OTHER_DIR/$BIN_FILE
if [ -n "$OTHER_BIN_FILE" ]; then
OTHER_FILE=$OTHER_DIR/$OTHER_BIN_FILE
else
OTHER_FILE=$OTHER_DIR/$BIN_FILE
fi
NAME=$(basename $BIN_FILE)
WORK_FILE_BASE=$WORK_DIR/$BIN_FILE
FILE_WORK_DIR=$(dirname $WORK_FILE_BASE)
@ -970,6 +990,8 @@ if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "-?" ] || [ "$1" = "/h" ] || [ "$1
echo "bash ./common/bin/compareimages.sh CodePointIM.jar"
echo ""
echo "-2zips <file1> <file2> Compare two zip files only"
echo "-2bins <file1> <file2> Compare two binary files only"
echo "-2dirs <dir1> <dir2> Compare two directories as if they were images"
echo ""
exit 10
fi
@ -1032,6 +1054,15 @@ while [ -n "$1" ]; do
-execs)
CMP_EXECS=true
;;
-2dirs)
THIS="$(cd "$2" && pwd )"
OTHER="$(cd "$3" && pwd )"
THIS_BASE_DIR="$THIS"
OTHER_BASE_DIR="$OTHER"
SKIP_DEFAULT=true
shift
shift
;;
-2zips)
CMP_2_ZIPS=true
THIS_FILE=$2
@ -1039,6 +1070,13 @@ while [ -n "$1" ]; do
shift
shift
;;
-2bins)
CMP_2_BINS=true
THIS_FILE=$2
OTHER_FILE=$3
shift
shift
;;
*)
CMP_NAMES=false
CMP_PERMS=false
@ -1069,6 +1107,18 @@ if [ "$CMP_2_ZIPS" = "true" ]; then
exit
fi
if [ "$CMP_2_BINS" = "true" ]; then
THIS_DIR="$(dirname $THIS_FILE)"
THIS_DIR="$(cd "$THIS_DIR" && pwd )"
OTHER_DIR="$(dirname $OTHER_FILE)"
OTHER_DIR="$(cd "$OTHER_DIR" && pwd )"
THIS_FILE_NAME="$(basename $THIS_FILE)"
OTHER_FILE_NAME="$(basename $OTHER_FILE)"
echo Comparing $THIS_DIR/$THIS_FILE_NAME and $OTHER_DIR/$OTHER_FILE_NAME
compare_bin_file $THIS_DIR $OTHER_DIR $COMPARE_ROOT/2bins $THIS_FILE_NAME $OTHER_FILE_NAME
exit
fi
if [ "$CMP_NAMES" = "false" ] && [ "$CMP_TYPES" = "false" ] && [ "$CMP_PERMS" = "false" ] && [ "$CMP_GENERAL" = "false" ] && [ "$CMP_ZIPS" = "false" ] && [ "$CMP_JARS" = "false" ] && [ "$CMP_LIBS" = "false" ] && [ "$CMP_EXECS" = "false" ]; then
CMP_NAMES=true
CMP_PERMS=true
@ -1084,151 +1134,154 @@ if [ -z "$FILTER" ]; then
FILTER="$CAT"
fi
if [ -z "$OTHER" ]; then
OTHER="$THIS/../$LEGACY_BUILD_DIR"
if [ -d "$OTHER" ]; then
if [ "$SKIP_DEFAULT" != "true" ]; then
if [ -z "$OTHER" ]; then
OTHER="$THIS/../$LEGACY_BUILD_DIR"
if [ -d "$OTHER" ]; then
OTHER="$( cd "$OTHER" && pwd )"
else
echo "Default old build directory does not exist:"
echo "$OTHER"
exit 1
fi
echo "Comparing to default old build:"
echo "$OTHER"
echo
else
if [ ! -d "$OTHER" ]; then
echo "Other build directory does not exist:"
echo "$OTHER"
exit 1
fi
OTHER="$( cd "$OTHER" && pwd )"
else
echo "Default old build directory does not exist:"
echo "Comparing to:"
echo "$OTHER"
exit 1
echo
fi
echo "Comparing to default old build:"
echo "$OTHER"
echo
else
if [ ! -d "$OTHER" ]; then
echo "Other build directory does not exist:"
echo "$OTHER"
exit 1
fi
OTHER="$( cd "$OTHER" && pwd )"
echo "Comparing to:"
echo "$OTHER"
echo
fi
# Figure out the layout of the this build. Which kinds of images have been produced
if [ -d "$THIS/install/j2sdk-image" ]; then
THIS_J2SDK="$THIS/install/j2sdk-image"
THIS_J2RE="$THIS/install/j2re-image"
echo "Selecting install images in this build"
elif [ -d "$THIS/deploy/j2sdk-image" ]; then
THIS_J2SDK="$THIS/deploy/j2sdk-image"
THIS_J2RE="$THIS/deploy/j2re-image"
echo "Selecting deploy images in this build"
elif [ -d "$THIS/images/j2sdk-image" ]; then
THIS_J2SDK="$THIS/images/j2sdk-image"
THIS_J2RE="$THIS/images/j2re-image"
echo "Selecting jdk images in this build"
fi
if [ -d "$THIS/images/j2sdk-overlay-image" ]; then
# Figure out the layout of the this build. Which kinds of images have been produced
if [ -d "$THIS/install/j2sdk-image" ]; then
# If there is an install image, prefer that, it's also overlay
THIS_J2SDK_OVERLAY="$THIS/install/j2sdk-image"
THIS_J2RE_OVERLAY="$THIS/install/j2re-image"
echo "Selecting install overlay images in this build"
else
THIS_J2SDK_OVERLAY="$THIS/images/j2sdk-overlay-image"
THIS_J2RE_OVERLAY="$THIS/images/j2re-overlay-image"
echo "Selecting jdk overlay images in this build"
THIS_J2SDK="$THIS/install/j2sdk-image"
THIS_J2RE="$THIS/install/j2re-image"
echo "Selecting install images in this build"
elif [ -d "$THIS/deploy/j2sdk-image" ]; then
THIS_J2SDK="$THIS/deploy/j2sdk-image"
THIS_J2RE="$THIS/deploy/j2re-image"
echo "Selecting deploy images in this build"
elif [ -d "$THIS/images/j2sdk-image" ]; then
THIS_J2SDK="$THIS/images/j2sdk-image"
THIS_J2RE="$THIS/images/j2re-image"
echo "Selecting jdk images in this build"
fi
fi
if [ -d "$THIS/images/j2sdk-bundle" ]; then
THIS_J2SDK_BUNDLE="$THIS/images/j2sdk-bundle"
THIS_J2RE_BUNDLE="$THIS/images/j2re-bundle"
echo "Selecting bundles in this build"
fi
# Figure out the layout of the other build (old or new, normal or overlay image)
if [ -d "$OTHER/j2sdk-image" ]; then
if [ -f "$OTHER/j2sdk-image/LICENSE" ]; then
OTHER_J2SDK="$OTHER/j2sdk-image"
OTHER_J2RE="$OTHER/j2re-image"
echo "Selecting old-style images in other build"
else
OTHER_J2SDK_OVERLAY="$OTHER/j2sdk-image"
OTHER_J2RE_OVERLAY="$OTHER/j2re-image"
echo "Selecting overlay images in other build"
if [ -d "$THIS/images/j2sdk-overlay-image" ]; then
if [ -d "$THIS/install/j2sdk-image" ]; then
# If there is an install image, prefer that, it's also overlay
THIS_J2SDK_OVERLAY="$THIS/install/j2sdk-image"
THIS_J2RE_OVERLAY="$THIS/install/j2re-image"
echo "Selecting install overlay images in this build"
else
THIS_J2SDK_OVERLAY="$THIS/images/j2sdk-overlay-image"
THIS_J2RE_OVERLAY="$THIS/images/j2re-overlay-image"
echo "Selecting jdk overlay images in this build"
fi
fi
elif [ -d "$OTHER/install/j2sdk-image" ]; then
OTHER_J2SDK="$OTHER/install/j2sdk-image"
OTHER_J2RE="$OTHER/install/j2re-image"
echo "Selecting install images in other build"
elif [ -d "$OTHER/deploy/j2sdk-image" ]; then
OTHER_J2SDK="$OTHER/deploy/j2sdk-image"
OTHER_J2RE="$OTHER/deploy/j2re-image"
echo "Selecting deploy images in other build"
elif [ -d "$OTHER/images/j2sdk-image" ]; then
OTHER_J2SDK="$OTHER/images/j2sdk-image"
OTHER_J2RE="$OTHER/images/j2re-image"
echo "Selecting jdk images in other build"
fi
if [ -d "$OTHER/j2sdk-bundle" ]; then
OTHER_J2SDK_BUNDLE="$OTHER/j2sdk-bundle"
OTHER_J2RE_BUNDLE="$OTHER/j2re-bundle"
echo "Selecting bundles in other build"
elif [ -d "$OTHER/images/j2sdk-bundle" ]; then
OTHER_J2SDK_BUNDLE="$OTHER/images/j2sdk-bundle"
OTHER_J2RE_BUNDLE="$OTHER/images/j2re-bundle"
echo "Selecting jdk bundles in other build"
fi
if [ -d "$THIS/images/j2sdk-bundle" ]; then
THIS_J2SDK_BUNDLE="$THIS/images/j2sdk-bundle"
THIS_J2RE_BUNDLE="$THIS/images/j2re-bundle"
echo "Selecting bundles in this build"
fi
if [ -z "$THIS_J2SDK" ] || [ -z "$THIS_J2RE" ]; then
if [ -z "$THIS_J2SDK_OVERLAY" ]; then
echo "Cannot locate images for this build. Are you sure you have run 'make images'?"
# Figure out the layout of the other build (old or new, normal or overlay image)
if [ -d "$OTHER/j2sdk-image" ]; then
if [ -f "$OTHER/j2sdk-image/LICENSE" ]; then
OTHER_J2SDK="$OTHER/j2sdk-image"
OTHER_J2RE="$OTHER/j2re-image"
echo "Selecting old-style images in other build"
else
OTHER_J2SDK_OVERLAY="$OTHER/j2sdk-image"
OTHER_J2RE_OVERLAY="$OTHER/j2re-image"
echo "Selecting overlay images in other build"
fi
elif [ -d "$OTHER/install/j2sdk-image" ]; then
OTHER_J2SDK="$OTHER/install/j2sdk-image"
OTHER_J2RE="$OTHER/install/j2re-image"
echo "Selecting install images in other build"
elif [ -d "$OTHER/deploy/j2sdk-image" ]; then
OTHER_J2SDK="$OTHER/deploy/j2sdk-image"
OTHER_J2RE="$OTHER/deploy/j2re-image"
echo "Selecting deploy images in other build"
elif [ -d "$OTHER/images/j2sdk-image" ]; then
OTHER_J2SDK="$OTHER/images/j2sdk-image"
OTHER_J2RE="$OTHER/images/j2re-image"
echo "Selecting jdk images in other build"
fi
if [ -d "$OTHER/j2sdk-bundle" ]; then
OTHER_J2SDK_BUNDLE="$OTHER/j2sdk-bundle"
OTHER_J2RE_BUNDLE="$OTHER/j2re-bundle"
echo "Selecting bundles in other build"
elif [ -d "$OTHER/images/j2sdk-bundle" ]; then
OTHER_J2SDK_BUNDLE="$OTHER/images/j2sdk-bundle"
OTHER_J2RE_BUNDLE="$OTHER/images/j2re-bundle"
echo "Selecting jdk bundles in other build"
fi
if [ -z "$THIS_J2SDK" ] || [ -z "$THIS_J2RE" ]; then
if [ -z "$THIS_J2SDK_OVERLAY" ]; then
echo "Cannot locate images for this build. Are you sure you have run 'make images'?"
exit 1
fi
fi
if [ -z "$OTHER_J2SDK" ] && [ -n "$OTHER_J2SDK_OVERLAY" ] && [ -z "$THIS_J2SDK_OVERLAY" ]; then
echo "OTHER build only has an overlay image while this build does not. Nothing to compare!"
exit 1
fi
fi
if [ -z "$OTHER_J2SDK" ] && [ -n "$OTHER_J2SDK_OVERLAY" ] && [ -z "$THIS_J2SDK_OVERLAY" ]; then
echo "OTHER build only has an overlay image while this build does not. Nothing to compare!"
exit 1
fi
if [ -z "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
echo "WARNING! OTHER build has bundles built while this build does not."
echo "Skipping bundle compare!"
fi
if [ -d "$THIS/docs" ]; then
THIS_DOCS="$THIS/docs"
fi
if [ -d "$OTHER/docs" ]; then
OTHER_DOCS="$OTHER/docs"
fi
if [ -z "$THIS_DOCS" ]; then
echo "WARNING! Docs haven't been built and won't be compared."
fi
if [ -z "$OTHER_DOCS" ]; then
echo "WARNING! Other build doesn't contain docs, skipping doc compare."
fi
if [ -d "$OTHER/images" ]; then
OTHER_SEC_DIR="$OTHER/images"
else
OTHER_SEC_DIR="$OTHER/tmp"
fi
OTHER_SEC_BIN="$OTHER_SEC_DIR/sec-bin.zip"
THIS_SEC_DIR="$THIS/images"
THIS_SEC_BIN="$THIS_SEC_DIR/sec-bin.zip"
if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
if [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
JGSS_WINDOWS_BIN="jgss-windows-x64-bin.zip"
else
JGSS_WINDOWS_BIN="jgss-windows-i586-bin.zip"
if [ -z "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
echo "WARNING! OTHER build has bundles built while this build does not."
echo "Skipping bundle compare!"
fi
OTHER_SEC_WINDOWS_BIN="$OTHER_SEC_DIR/sec-windows-bin.zip"
OTHER_JGSS_WINDOWS_BIN="$OTHER_SEC_DIR/$JGSS_WINDOWS_BIN"
THIS_SEC_WINDOWS_BIN="$THIS_SEC_DIR/sec-windows-bin.zip"
THIS_JGSS_WINDOWS_BIN="$THIS_SEC_DIR/$JGSS_WINDOWS_BIN"
if [ -d "$OTHER/images" ]; then
OTHER_SEC_DIR="$OTHER/images"
else
OTHER_SEC_DIR="$OTHER/tmp"
fi
OTHER_SEC_BIN="$OTHER_SEC_DIR/sec-bin.zip"
THIS_SEC_DIR="$THIS/images"
THIS_SEC_BIN="$THIS_SEC_DIR/sec-bin.zip"
if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
if [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
JGSS_WINDOWS_BIN="jgss-windows-x64-bin.zip"
else
JGSS_WINDOWS_BIN="jgss-windows-i586-bin.zip"
fi
OTHER_SEC_WINDOWS_BIN="$OTHER_SEC_DIR/sec-windows-bin.zip"
OTHER_JGSS_WINDOWS_BIN="$OTHER_SEC_DIR/$JGSS_WINDOWS_BIN"
THIS_SEC_WINDOWS_BIN="$THIS_SEC_DIR/sec-windows-bin.zip"
THIS_JGSS_WINDOWS_BIN="$THIS_SEC_DIR/$JGSS_WINDOWS_BIN"
fi
if [ -d "$THIS/docs" ]; then
THIS_DOCS="$THIS/docs"
fi
if [ -d "$OTHER/docs" ]; then
OTHER_DOCS="$OTHER/docs"
fi
if [ -z "$THIS_DOCS" ]; then
echo "WARNING! Docs haven't been built and won't be compared."
fi
if [ -z "$OTHER_DOCS" ]; then
echo "WARNING! Other build doesn't contain docs, skipping doc compare."
fi
fi
##########################################################################################
@ -1274,6 +1327,10 @@ if [ "$CMP_NAMES" = "true" ]; then
echo -n "Docs "
compare_files $THIS_DOCS $OTHER_DOCS $COMPARE_ROOT/docs
fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_dirs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
compare_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
fi
if [ "$CMP_PERMS" = "true" ]; then
@ -1295,6 +1352,9 @@ if [ "$CMP_PERMS" = "true" ]; then
echo -n "J2RE Bundle "
compare_permissions $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_permissions $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
fi
if [ "$CMP_TYPES" = "true" ]; then
@ -1316,6 +1376,9 @@ if [ "$CMP_TYPES" = "true" ]; then
echo -n "J2RE Bundle "
compare_file_types $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_file_types $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
fi
if [ "$CMP_GENERAL" = "true" ]; then
@ -1341,6 +1404,9 @@ if [ "$CMP_GENERAL" = "true" ]; then
echo -n "Docs "
compare_general_files $THIS_DOCS $OTHER_DOCS $COMPARE_ROOT/docs
fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_general_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
fi
if [ "$CMP_ZIPS" = "true" ]; then
@ -1365,12 +1431,18 @@ if [ "$CMP_ZIPS" = "true" ]; then
compare_zip_file $THIS_SEC_DIR $OTHER_SEC_DIR $COMPARE_ROOT/sec-bin $JGSS_WINDOWS_BIN
fi
fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_all_zip_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
fi
if [ "$CMP_JARS" = "true" ]; then
if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
compare_all_jar_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_all_jar_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
fi
if [ "$CMP_LIBS" = "true" ]; then
@ -1386,6 +1458,9 @@ if [ "$CMP_LIBS" = "true" ]; then
echo -n "Bundle "
compare_all_libs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_all_libs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
fi
if [ "$CMP_EXECS" = "true" ]; then
@ -1396,6 +1471,9 @@ if [ "$CMP_EXECS" = "true" ]; then
echo -n "Overlay "
compare_all_execs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
fi
if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
compare_all_execs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
fi
fi
echo

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,196 @@
#!/bin/sh
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# Script for updating a patch file as per the shuffled/unshuffled source location.
usage() {
echo "Usage: $0 [-h|--help] [-v|--verbose] <repo> <input_patch> <output_patch>"
echo "where:"
echo " <repo> is one of: corba, jaxp, jaxws, jdk, langtools, nashorn"
echo " [Note: patches from other repos do not need updating]"
echo " <input_patch> is the input patch file, that needs shuffling/unshuffling"
echo " <output_patch> is the updated patch file "
echo " "
exit 1
}
SCRIPT_DIR=`pwd`/`dirname $0`
UNSHUFFLE_LIST=$SCRIPT_DIR"/unshuffle_list.txt"
if [ ! -f "$UNSHUFFLE_LIST" ] ; then
echo "FATAL: cannot find $UNSHUFFLE_LIST"
exit 1
fi
vflag="false"
while [ $# -gt 0 ]
do
case $1 in
-h | --help )
usage
;;
-v | --verbose )
vflag="true"
;;
-*) # bad option
usage
;;
* ) # non option
break
;;
esac
shift
done
# Make sure we have the right number of arguments
if [ ! $# -eq 3 ] ; then
echo "ERROR: Invalid number of arguments."
usage
fi
# Check the given repo
repos="corba jaxp jaxws jdk langtools nashorn"
repo="$1"
found="false"
for r in $repos ; do
if [ $repo = "$r" ] ; then
found="true"
break;
fi
done
if [ $found = "false" ] ; then
echo "ERROR: Unknown repo: $repo. Should be one of [$repos]."
usage
fi
# Check given input/output files
input="$2"
output="$3"
if [ ! -f $input ] ; then
echo "ERROR: Cannot find input patch file: $input"
exit 1
fi
if [ -f $output ] ; then
echo "ERROR: Output patch already exists: $output"
exit 1
fi
what="" ## shuffle or unshuffle
verbose() {
if [ ${vflag} = "true" ] ; then
echo "$@"
fi
}
unshuffle() {
line=$@
verbose "Attempting to rewrite: \"$line\""
# Retrieve the file name
path=
if echo "$line" | egrep '^diff' > /dev/null ; then
if ! echo "$line" | egrep '\-\-git' > /dev/null ; then
echo "ERROR: Only git patches supported. Please use 'hg export --git ...'."
exit 1
fi
path="`echo "$line" | sed -e s@'diff --git a/'@@ -e s@' b/.*$'@@`"
elif echo "$line" | egrep '^\-\-\-' > /dev/null ; then
path="`echo "$line" | sed -e s@'--- a/'@@`"
elif echo "$line" | egrep '^\+\+\+' > /dev/null ; then
path="`echo "$line" | sed s@'+++ b/'@@`"
fi
verbose "Extracted path: \"$path\""
# Only source can be shuffled, or unshuffled
if ! echo "$path" | egrep '^src/.*' > /dev/null ; then
verbose "Not a src path, skipping."
echo "$line" >> $output
return
fi
# Shuffle or unshuffle?
if [ "${what}" = "" ] ; then
if echo "$path" | egrep '^src/java\..*|^src/jdk\..*' > /dev/null ; then
what="unshuffle"
else
what="shuffle"
fi
verbose "Shuffle or unshuffle: $what"
fi
# Find the most specific matches in the shuffle list
matches=
matchpath="$repo"/"$path"/x
while [ "$matchpath" != "" ] ; do
matchpath="`echo $matchpath | sed s@'\(.*\)/.*$'@'\1'@`"
if [ "${what}" = "shuffle" ] ; then
pattern=": $matchpath$"
else
pattern="^$matchpath :"
fi
verbose "Attempting to find \"$matchpath\""
matches=`egrep "$pattern" "$UNSHUFFLE_LIST"`
if ! [ "x${matches}" = "x" ] ; then
verbose "Got matches: [$matches]"
break;
fi
if ! echo "$matchpath" | egrep '.*/.*' > /dev/null ; then
break;
fi
done
# Rewrite the line, if we have a match
if ! [ "x${matches}" = "x" ] ; then
shuffled="`echo "$matches" | sed -e s@' : .*'@@g -e s@'^[a-z]*\/'@@`"
unshuffled="`echo "$matches" | sed -e s@'.* : '@@g -e s@'^[a-z]*\/'@@`"
if [ "${what}" = "shuffle" ] ; then
newline="`echo "$line" | sed -e s@"$unshuffled"@"$shuffled"@g`"
else
newline="`echo "$line" | sed -e s@"$shuffled"@"$unshuffled"@g`"
fi
verbose "Rewriting to \"$newline\""
echo "$newline" >> $output
else
echo "WARNING: no match found for $path"
echo "$line" >> $output
fi
}
while IFS= read -r line
do
if echo "$line" | egrep '^diff|^\-\-\-|^\+\+\+' > /dev/null ; then
unshuffle "$line"
else
printf "%s\n" "$line" >> $output
fi
done < "$input"

559
make/CompileJavaModules.gmk Normal file
View File

@ -0,0 +1,559 @@
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# This must be the first rule
default: all
include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
include SetupJava.gmk
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, , CompileJavaModules.gmk))
################################################################################
# Module specific build settings
java.activation_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
################################################################################
java.base_COPY := .icu .dat .spp content-types.properties
java.base_CLEAN := intrinsic.properties
java.base_EXCLUDES += java/lang/doc-files
# Exclude BreakIterator classes that are just used in compile process to generate
# data files and shouldn't go in the product
java.base_EXCLUDE_FILES += sun/text/resources/BreakIteratorRules.java
ifeq ($(OPENJDK_TARGET_OS), macosx)
JAVA_BASE_UNIX_DIR := $(JDK_TOPDIR)/src/java.base/unix/classes
# TODO: make JavaCompilation handle overrides automatically instead of excluding here
# These files are overridden in macosx
java.base_EXCLUDE_FILES += \
$(JAVA_BASE_UNIX_DIR)/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java \
$(JAVA_BASE_UNIX_DIR)/java/net/DefaultInterface.java \
$(JAVA_BASE_UNIX_DIR)/java/lang/ClassLoaderHelper.java \
$(JAVA_BASE_UNIX_DIR)/sun/nio/ch/DefaultSelectorProvider.java \
#
# This is just skipped on macosx
java.base_EXCLUDE_FILES += $(JAVA_BASE_UNIX_DIR)/sun/nio/fs/GnomeFileTypeDetector.java
endif
ifneq ($(OPENJDK_TARGET_OS), solaris)
java.base_EXCLUDE_FILES += \
SolarisLoginModule.java \
SolarisSystem.java \
#
endif
ifeq ($(filter $(OPENJDK_TARGET_OS), solaris macosx aix), )
#
# only solaris, macosx and aix
#
java.base_EXCLUDE_FILES += sun/nio/fs/PollingWatchService.java
endif
ifeq ($(OPENJDK_TARGET_OS), windows)
java.base_EXCLUDE_FILES += \
sun/nio/ch/AbstractPollSelectorImpl.java \
sun/nio/ch/PollSelectorProvider.java \
sun/nio/ch/SimpleAsynchronousFileChannelImpl.java \
#
endif
################################################################################
java.desktop_COPY := .gif .png .wav .txt .xml .css flavormap.properties
java.desktop_CLEAN := iio-plugin.properties
java.desktop_EXCLUDES += \
java/awt/doc-files \
javax/swing/doc-files \
javax/swing/text/doc-files \
javax/swing/plaf/synth/doc-files \
javax/swing/undo/doc-files \
sun/awt/X11/doc-files \
#
# The exception handling of swing beaninfo
# These resources violates the convention of having code and resources together under
# $(JDK_TOPDIR)/src/.../classes directories
$(eval $(call SetupCopyFiles,COPY_BEANINFO, \
SRC := $(JDK_TOPDIR)/make/data/swingbeaninfo/images, \
DEST := $(JDK_OUTPUTDIR)/modules/java.desktop/javax/swing/beaninfo/images, \
FILES := $(wildcard $(JDK_TOPDIR)/make/data/swingbeaninfo/images/*.gif)))
java.desktop_COPY_EXTRA += $(COPY_BEANINFO)
java.desktop_EXCLUDE_FILES += \
javax/swing/plaf/nimbus/InternalFrameTitlePanePainter.java \
javax/swing/plaf/nimbus/OptionPaneMessageAreaPainter.java \
javax/swing/plaf/nimbus/ScrollBarPainter.java \
javax/swing/plaf/nimbus/SliderPainter.java \
javax/swing/plaf/nimbus/SpinnerPainter.java \
javax/swing/plaf/nimbus/SplitPanePainter.java \
javax/swing/plaf/nimbus/TabbedPanePainter.java \
sun/awt/resources/security-icon-bw16.png \
sun/awt/resources/security-icon-bw24.png \
sun/awt/resources/security-icon-bw32.png \
sun/awt/resources/security-icon-bw48.png \
sun/awt/resources/security-icon-interim16.png \
sun/awt/resources/security-icon-interim24.png \
sun/awt/resources/security-icon-interim32.png \
sun/awt/resources/security-icon-interim48.png \
sun/awt/resources/security-icon-yellow16.png \
sun/awt/resources/security-icon-yellow24.png \
sun/awt/resources/security-icon-yellow32.png \
sun/awt/resources/security-icon-yellow48.png \
sun/awt/X11/java-icon16.png \
sun/awt/X11/java-icon24.png \
sun/awt/X11/java-icon32.png \
sun/awt/X11/java-icon48.png \
.template \
#
ifeq ($(OPENJDK_TARGET_OS), macosx)
# exclude all X11 on Mac.
java.desktop_EXCLUDES += sun/awt/X11
java.desktop_EXCLUDE_FILES += \
$(JDK_TOPDIR)/src/java.desktop/unix/classes/sun/java2d/BackBufferCapsProvider.java \
#
else
# TBD: figure out how to eliminate this long list
java.desktop_EXCLUDE_FILES += \
sun/awt/X11/ScreenFormat.java \
sun/awt/X11/XArc.java \
sun/awt/X11/XChar2b.java \
sun/awt/X11/XCharStruct.java \
sun/awt/X11/XClassHint.java \
sun/awt/X11/XComposeStatus.java \
sun/awt/X11/XExtCodes.java \
sun/awt/X11/XFontProp.java \
sun/awt/X11/XFontSetExtents.java \
sun/awt/X11/XFontStruct.java \
sun/awt/X11/XGCValues.java \
sun/awt/X11/XHostAddress.java \
sun/awt/X11/XIMCallback.java \
sun/awt/X11/XIMHotKeyTrigger.java \
sun/awt/X11/XIMHotKeyTriggers.java \
sun/awt/X11/XIMPreeditCaretCallbackStruct.java \
sun/awt/X11/XIMPreeditDrawCallbackStruct.java \
sun/awt/X11/XIMPreeditStateNotifyCallbackStruct.java \
sun/awt/X11/XIMStatusDrawCallbackStruct.java \
sun/awt/X11/XIMStringConversionCallbackStruct.java \
sun/awt/X11/XIMStringConversionText.java \
sun/awt/X11/XIMStyles.java \
sun/awt/X11/XIMText.java \
sun/awt/X11/XIMValuesList.java \
sun/awt/X11/XImage.java \
sun/awt/X11/XKeyboardControl.java \
sun/awt/X11/XKeyboardState.java \
sun/awt/X11/XOMCharSetList.java \
sun/awt/X11/XOMFontInfo.java \
sun/awt/X11/XOMOrientation.java \
sun/awt/X11/XPoint.java \
sun/awt/X11/XRectangle.java \
sun/awt/X11/XSegment.java \
sun/awt/X11/XStandardColormap.java \
sun/awt/X11/XTextItem.java \
sun/awt/X11/XTextItem16.java \
sun/awt/X11/XTextProperty.java \
sun/awt/X11/XTimeCoord.java \
sun/awt/X11/XWindowChanges.java \
sun/awt/X11/XdbeSwapInfo.java \
sun/awt/X11/XmbTextItem.java \
sun/awt/X11/XwcTextItem.java
endif
ifeq ($(OPENJDK_TARGET_OS), windows)
java.desktop_EXCLUDES += com/sun/java/swing/plaf/gtk
endif
ifdef BUILD_HEADLESS_ONLY
java.desktop_EXCLUDES += sun/applet
endif
# Why is this in the open source tree?
ifdef OPENJDK
java.desktop_EXCLUDES += sun/dc
endif
# Used on windows and macosx
ifeq ($(filter $(OPENJDK_TARGET_OS), windows macosx), )
java.desktop_EXCLUDE_FILES += sun/awt/AWTCharset.java
endif
# These files do not appear in the build result of the old build. This
# is because they are generated sources, but the AUTO_JAVA_FILES won't
# pick them up since they aren't generated when the source dirs are
# searched and they aren't referenced by any other classes so they won't
# be picked up by implicit compilation. On a rebuild, they are picked up
# and compiled. Exclude them here to produce the same rt.jar as the old
# build does when building just once.
java.desktop_EXCLUDE_FILES += \
javax/swing/plaf/nimbus/InternalFrameTitlePanePainter.java \
javax/swing/plaf/nimbus/OptionPaneMessageAreaPainter.java \
javax/swing/plaf/nimbus/ScrollBarPainter.java \
javax/swing/plaf/nimbus/SliderPainter.java \
javax/swing/plaf/nimbus/SpinnerPainter.java \
javax/swing/plaf/nimbus/SplitPanePainter.java \
javax/swing/plaf/nimbus/TabbedPanePainter.java \
#
ifeq ($(OPENJDK_TARGET_OS), macosx)
# These files are duplicated in MACOSX_SRC_DIRS
java.desktop_EXCLUDE_FILES += \
$(JDK_TOPDIR)/src/java.desktop/unix/classes/sun/java2d/BackBufferCapsProvider.java \
#
endif
################################################################################
java.sql_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
################################################################################
java.sql.rowset_CLEAN_FILES := $(wildcard \
$(JDK_TOPDIR)/src/java.sql.rowset/share/classes/com/sun/rowset/*.properties \
$(JDK_TOPDIR)/src/java.sql.rowset/share/classes/javax/sql/rowset/*.properties)
################################################################################
# Exclude building of IIOP transport for RMI Connector
java.management_EXCLUDES := com/sun/jmx/remote/protocol/iiop
# Why is this in the open source tree?
ifdef OPENJDK
java.management_EXCLUDES := \
com/sun/jmx/snmp \
sun/management/snmp \
#
endif
ifeq ($(RMICONNECTOR_IIOP), false)
java.management_EXCLUDES += com/sun/jmx/remote/protocol/iiop
endif
################################################################################
java.rmi_CLEAN_FILES := $(wildcard \
$(JDK_TOPDIR)/src/java.rmi/share/classes/sun/rmi/registry/resources/*.properties \
$(JDK_TOPDIR)/src/java.rmi/share/classes/sun/rmi/server/resources/*.properties)
################################################################################
java.corba_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
java.corba_COPY := .prp
java.corba_CLEAN := .properties
java.corba_EXCLUDES := \
com/sun/corba/se/PortableActivationIDL \
com/sun/tools/corba/se/logutil \
#
java.corba_EXCLUDE_FILES := \
com/sun/corba/se/impl/presentation/rmi/JNDIStateFactoryImpl.java \
com/sun/corba/se/spi/presentation/rmi/StubWrapper.java \
com/sun/org/omg/CORBA/IDLTypeOperations.java \
com/sun/org/omg/CORBA/IRObjectOperations.java \
org/omg/PortableInterceptor/UNKNOWN.java \
com/sun/tools/corba/se/idl/ResourceBundleUtil.java \
com/sun/corba/se/impl/presentation/rmi/jndi.properties \
#
################################################################################
java.xml_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
java.xml_CLEAN := .properties
################################################################################
java.xml.bind_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
java.xml.bind_CLEAN := .properties
################################################################################
java.xml.soap_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
java.xml.soap_CLEAN := .properties
################################################################################
java.xml.ws_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
java.xml.ws_COPY := .xml
java.xml.ws_CLEAN := .properties
################################################################################
java.naming_CLEAN := jndiprovider.properties
################################################################################
java.security.saaj_CLEAN := .properties
################################################################################
java.xml.crypto_COPY := .dtd .xml
java.xml.crypto_CLEAN := .properties
################################################################################
jdk.charsets_COPY := .dat
################################################################################
jdk.compiler_COPY := javax.tools.JavaCompilerTool
################################################################################
jdk.jcmd_COPY := _options
################################################################################
jdk.javadoc_COPY := .xml .css .js
################################################################################
jdk.rmic_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
jdk.rmic_CLEAN := .properties
################################################################################
# No SCTP implementation on Mac OS X or AIX. These classes should be excluded.
SCTP_IMPL_CLASSES = \
$(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/AssociationChange.java \
$(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/AssociationImpl.java \
$(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/PeerAddrChange.java \
$(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/ResultContainer.java \
$(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpChannelImpl.java \
$(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java \
$(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpNet.java \
$(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpNotification.java \
$(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java \
$(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SendFailed.java \
$(JDK_TOPDIR)/src/jdk.sctp/unix/classes/sun/nio/ch/sctp/Shutdown.java
ifeq ($(OPENJDK_TARGET_OS), macosx)
jdk.sctp_EXCLUDE_FILES := $(SCTP_IMPL_CLASSES)
endif
ifeq ($(OPENJDK_TARGET_OS),aix)
# These files are duplicated in AIX_SRC_DIRS
jdk.sctp_EXCLUDE_FILES := $(SCTP_IMPL_CLASSES)
endif
################################################################################
jdk.jconsole_COPY := .gif .png
jdk.jconsole_CLEAN_FILES := $(wildcard \
$(JDK_TOPDIR)/src/jdk.jconsole/share/classes/sun/tools/jconsole/resources/*.properties)
################################################################################
jdk.compiler_CLEAN_FILES := $(wildcard \
$(patsubst %, $(JDK_TOPDIR)/src/jdk.compiler/share/classes/%/*.properties, \
sun/tools/serialver/resources))
################################################################################
jdk.jdi_EXCLUDES := \
com/sun/tools/example/debug/bdi \
com/sun/tools/example/debug/event \
com/sun/tools/example/debug/gui \
com/sun/jdi/doc-files \
#
jdk.jdi_EXCLUDE_FILES += jdi-overview.html
################################################################################
jdk.dev_CLEAN_FILES := $(wildcard \
$(patsubst %, $(JDK_TOPDIR)/src/jdk.dev/share/classes/%/*.properties, \
com/sun/tools/script/shell))
jdk.dev_COPY := .js oqlhelp.html .txt
################################################################################
ifneq ($(OPENJDK_TARGET_OS), solaris)
jdk.attach_EXCLUDE_FILES += \
sun/tools/attach/SolarisAttachProvider.java \
sun/tools/attach/SolarisVirtualMachine.java \
#
endif
ifneq ($(OPENJDK_TARGET_OS), linux)
jdk.attach_EXCLUDE_FILES += \
sun/tools/attach/LinuxAttachProvider.java \
sun/tools/attach/LinuxVirtualMachine.java \
#
endif
ifneq ($(OPENJDK_TARGET_OS), macosx)
jdk.attach_EXCLUDE_FILES += \
sun/tools/attach/BsdAttachProvider.java \
sun/tools/attach/BsdVirtualMachine.java \
#
endif
ifneq ($(OPENJDK_TARGET_OS),aix)
jdk.attach_EXCLUDE_FILES += \
sun/tools/attach/AixAttachProvider.java \
sun/tools/attach/AixVirtualMachine.java \
#
endif
################################################################################
jdk.jvmstat_COPY := aliasmap
################################################################################
jdk.xml.bind_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
jdk.xml.bind_CLEAN := .properties
jdk.xml.bind_COPY := .xsd JAXBContextFactory.java ZeroOneBooleanAdapter.java
################################################################################
jdk.xml.ws_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
jdk.xml.ws_CLEAN := .properties
################################################################################
sun.charsets_COPY := .dat
################################################################################
jdk.localedata_COPY := _dict _th
# Exclude BreakIterator classes that are just used in compile process to generate
# data files and shouldn't go in the product
jdk.localedata_EXCLUDE_FILES := sun/text/resources/th/BreakIteratorRules_th.java
################################################################################
# Setup the compilation of each module
#
# Do not include nashorn src here since it needs to be compiled separately due
# to nasgen.
#
# Order src dirs in order of override with the most important first. Generated
# source before static source and platform specific source before shared.
#
# To use this variable, use $(call ALL_SRC_DIRS,module) with no space.
GENERATED_SRC_DIRS += \
$(JDK_OUTPUTDIR)/gensrc/$1 \
$(LANGTOOLS_OUTPUTDIR)/gensrc/$1 \
$(CORBA_OUTPUTDIR)/gensrc/$1 \
$(JDK_OUTPUTDIR)/gensrc_no_srczip/$1 \
#
OS_SRC_DIRS += $(JDK_TOPDIR)/src/$1/$(OPENJDK_TARGET_OS)/classes
ifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_API_DIR))
OS_API_SRC_DIRS += $(JDK_TOPDIR)/src/$1/$(OPENJDK_TARGET_OS_API_DIR)/classes
endif
SHARE_SRC_DIRS += \
$(JDK_TOPDIR)/src/$1/share/classes \
$(LANGTOOLS_TOPDIR)/src/$1/share/classes \
$(CORBA_TOPDIR)/src/$1/share/classes \
$(JAXP_TOPDIR)/src/$1/share/classes \
$(JAXWS_TOPDIR)/src/$1/share/classes \
#
ALL_SRC_DIRS = \
$(GENERATED_SRC_DIRS) \
$(OS_SRC_DIRS) \
$(OS_API_SRC_DIRS) \
$(SHARE_SRC_DIRS) \
#
# Find all modules with java sources. Filter out nashorn since it needs to be
# compiled separately.
ALL_JAVA_MODULES := $(filter-out jdk.scripting.nashorn, $(call FindJavaModules))
JAVA_MODULES := $(ALL_JAVA_MODULES)
# The JDK_USER_DEFINED_FILTER is a poor man's incremental build: by specifying
# JDK_FILTER at the make command line, only a subset of the JDK java files will
# be recompiled. If multiple paths are separated by comma, convert that into a
# space separated list.
JDK_USER_DEFINED_FILTER := $(strip $(subst $(COMMA),$(SPACE), $(JDK_FILTER)))
# This macro sets up compilation of a module and declares dependencies for it.
# Param 1 - module name
define SetupModuleCompilation
# Find the module dependencies by parsing modules.list file
$1_DEPS := $$(call FindDepsForModule, $1)
$1_CLASSPATH := $$(addprefix $(JDK_OUTPUTDIR)/modules/,$$($1_DEPS))
ifeq ($1, jdk.hotspot.agent)
## The source of this module is compiled elsewhere, hotspot, and imported.
## Service types are required in the classpath when compiing module-info
$1_CLASSPATH := $$($1_CLASSPATH) $$(addprefix $(JDK_OUTPUTDIR)/modules/,jdk.hotspot.agent)
endif
$1_CLASSPATH := $$(subst $$(SPACE),$$(PATH_SEP),$$($1_CLASSPATH))
$1_JAVAC_FLAGS := -bootclasspath "$$($1_CLASSPATH)"
$$(eval $$(call SetupJavaCompilation,$1, \
SETUP := $$(if $$($1_SETUP), $$($1_SETUP), GENERATE_JDKBYTECODE), \
SRC := $$(wildcard $$(call ALL_SRC_DIRS,$1)), \
INCLUDES:=$(JDK_USER_DEFINED_FILTER),\
BIN := $(JDK_OUTPUTDIR)/modules/$1, \
HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers/$1, \
ADD_JAVAC_FLAGS := $$($1_JAVAC_FLAGS)))
$1: $$($1) $$($1_COPY_EXTRA)
# Declare dependencies between java compilation of different modules.
# Since not all modules have been declared yet, or might be declared
# in different invocations of this file, use the macro to find the
# correct target file to depend on.
# Only the javac compilation actually depends on other modules so limit
# dependency declaration to that by using the *_COMPILE_TARGET variable.
$$($1_COMPILE_TARGETS): $$(foreach d,$$($1_DEPS), \
$$(call SetupJavaCompilationCompileTarget, $$d, $(JDK_OUTPUTDIR)/modules/$$d))
endef
# Setup compilation for each module
$(foreach m,$(JAVA_MODULES),$(eval $(call SetupModuleCompilation,$m)))
################################################################################
# Copy zh_HK properties files from zh_TW
$(JDK_OUTPUTDIR)/modules/%_zh_HK.properties: $(JDK_OUTPUTDIR)/modules/%_zh_TW.properties
$(install-file)
define CreateHkTargets
$(patsubst $(JDK_TOPDIR)/src/%, $(JDK_OUTPUTDIR)/modules/%, \
$(subst /share/classes,, \
$(subst _zh_TW,_zh_HK, $(filter %_zh_TW.properties, $1))))
endef
java.sql.rowset: $(call CreateHkTargets, $(java.sql.rowset_CLEAN_FILES))
java.rmi: $(call CreateHkTargets, $(java.rmi_CLEAN_FILES))
all: $(JAVA_MODULES)
.PHONY: all $(JAVA_MODULES)

43
make/Install.gmk Normal file
View File

@ -0,0 +1,43 @@
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
default: install
include $(SPEC)
BINARIES := $(notdir $(wildcard $(JDK_IMAGE_DIR)/bin/*))
INSTALLDIR := openjdk-$(RELEASE)
# Install the jdk image, in a very crude way. Not taking into
# account, how to install properly on macosx or windows etc.
install:
echo Installing jdk image into $(INSTALL_PREFIX)/jvm/$(INSTALLDIR)
echo and creating $(words $(BINARIES)) links from $(INSTALL_PREFIX)/bin into the jdk.
$(MKDIR) -p $(INSTALL_PREFIX)/jvm/$(INSTALLDIR)
$(RM) -r $(INSTALL_PREFIX)/jvm/$(INSTALLDIR)/*
$(CP) -rp $(JDK_IMAGE_DIR)/* $(INSTALL_PREFIX)/jvm/$(INSTALLDIR)
$(MKDIR) -p $(INSTALL_PREFIX)/bin
$(RM) $(addprefix $(INSTALL_PREFIX)/bin/, $(BINARIES))
$(foreach b, $(BINARIES), $(LN) -s $(INSTALL_PREFIX)/jvm/$(INSTALLDIR)/bin/$b $(INSTALL_PREFIX)/bin/$b &&) true

View File

@ -41,18 +41,11 @@ include NON_CORE_PKGS.gmk
.SUFFIXES: .java
#
# Definitions for $(DOCSDIR), $(MKDIR), $(BINDIR), etc.
# Definitions for directories
#
DOCSDIR=$(OUTPUT_ROOT)/docs
TEMPDIR=$(OUTPUT_ROOT)/docstemp
JDK_SHARE_SRC=$(JDK_TOPDIR)/src/share
JDK_SHARE_CLASSES=$(JDK_SHARE_SRC)/classes
JDK_IMPSRC = $(JDK_OUTPUTDIR)/impsrc
JDK_GENSRC = $(JDK_OUTPUTDIR)/gensrc
DOCSDIR := $(OUTPUT_ROOT)/docs
TEMPDIR := $(OUTPUT_ROOT)/docstemp
HOTSPOT_DOCS_IMPORT_PATH=$(HOTSPOT_OUTPUTDIR)/docs
@ -143,16 +136,19 @@ $(FULL_COMPANY_NAME) in the US and other countries.
# Otherwise, you get "No packages or classes specified." due
# to $(PATH_SEP) being interpreted as an end of
# command (newline or shell ; character)
ALL_SOURCE_DIRS = $(JDK_SHARE_CLASSES) \
$(JDK_IMPSRC) \
$(JDK_GENSRC) \
$(JDK_OUTPUTDIR)/gendocsrc_rmic \
$(JDK_TOPDIR)/src/solaris/classes \
$(JDK_TOPDIR)/src/windows/classes \
$(JDK_SHARE_SRC)/doc/stub
# List of directories that actually exist
ALL_EXISTING_SOURCE_DIRS := $(wildcard $(ALL_SOURCE_DIRS))
ALL_SOURCE_DIRS := $(wildcard \
$(JDK_TOPDIR)/src/*/share/classes \
$(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_API_DIR)/classes \
$(LANGTOOLS_TOPDIR)/src/*/share/classes \
$(CORBA_TOPDIR)/src/*/share/classes \
$(JAXP_TOPDIR)/src/*/share/classes \
$(JAXWS_TOPDIR)/src/*/share/classes \
$(JDK_OUTPUTDIR)/gensrc/j* \
$(JDK_OUTPUTDIR)/gendocsrc_rmic \
$(CORBA_OUTPUTDIR)/gensrc/j* \
$(JDK_TOPDIR)/src/*/share/doc/stub \
) \
#
# List with classpath separator between them
EMPTY:=
@ -176,7 +172,7 @@ endef
$(eval $(call FillCacheFind, $(ALL_SOURCE_DIRS)))
define PackageDependencies
$(call CacheFind, $(foreach p, $(subst .,/,$1), $(addsuffix /$p, $(ALL_SOURCE_DIRS))))
$(call CacheFind, $(wildcard $(foreach p, $(subst .,/,$1), $(addsuffix /$p, $(ALL_SOURCE_DIRS)))))
endef
# Given a list of packages, add packages that exist to $@, print summary
@ -382,7 +378,7 @@ COREAPI_HEADER = \
<strong>Java$(TRADEMARK)&nbsp;Platform<br>Standard&nbsp;Ed.&nbsp;$(JDK_MINOR_VERSION)</strong>
# Overview file for core apis
COREAPI_OVERVIEW = $(JDK_SHARE_CLASSES)/overview-core.html
COREAPI_OVERVIEW = $(JDK_TOPDIR)/src/java.base/share/classes/overview-core.html
# The index.html, options, and packages files
COREAPI_INDEX_FILE = $(COREAPI_DOCSDIR)/index.html
@ -534,7 +530,7 @@ $(TAGLETAPI_OPTIONS_FILE):
# Create a file with the package names in it
$(TAGLETAPI_PACKAGES_FILE): $(call PackageDependencies,$(TAGLETAPI_PKGS))
$(prep-target)
@($(ECHO) "$(JDK_IMPSRC)/$(TAGLETAPI_FILE)" ) > $@
@($(ECHO) "$(LANGTOOLS_TOPDIR)/src/jdk.javadoc/share/classes/$(TAGLETAPI_FILE)" ) > $@
#############################################################
#
@ -614,7 +610,7 @@ JDI_DOCTITLE := Java$(TRADEMARK) Debug Interface
JDI_WINDOWTITLE := Java Debug Interface
JDI_HEADER := <strong>Java Debug Interface</strong>
JDI_BOTTOM := $(call CommonBottom,$(JDI_FIRST_COPYRIGHT_YEAR))
JDI_OVERVIEW := $(JDK_SHARE_CLASSES)/jdi-overview.html
JDI_OVERVIEW := $(JDK_TOPDIR)/src/jdk.jdi/share/classes/jdi-overview.html
# JDI_PKGS is located in NON_CORE_PKGS.gmk
# The index.html, options, and packages files
@ -703,7 +699,7 @@ JAAS_WINDOWTITLE := Java Authentication and Authorization Service
JAAS_HEADER := <strong>Java Authentication and Authorization Service</strong>
JAAS_BOTTOM := $(call CommonBottom,$(JAAS_FIRST_COPYRIGHT_YEAR))
# JAAS_PKGS is located in NON_CORE_PKGS.gmk
JAAS_OVERVIEW := $(JDK_SHARE_CLASSES)/com/sun/security/auth/jaas-overview.html
JAAS_OVERVIEW := $(JDK_TOPDIR)/src/jdk.security.auth/share/classes/jaas-overview.html
# The index.html, options, and packages files
JAAS_INDEX_FILE = $(JAAS_DOCDIR)/index.html
@ -756,7 +752,7 @@ JGSS_DOCTITLE := Java$(TRADEMARK) GSS-API Utilities
JGSS_WINDOWTITLE := Java GSS-API Utilities
JGSS_HEADER := <strong>Java GSS-API Utilities</strong>
JGSS_BOTTOM := $(call CommonBottom,$(JGSS_FIRST_COPYRIGHT_YEAR))
JGSS_OVERVIEW := $(JDK_SHARE_CLASSES)/com/sun/security/jgss/jgss-overview.html
JGSS_OVERVIEW := $(JDK_TOPDIR)/src/java.security.jgss/share/classes/jgss-overview.html
# JGSS_PKGS is located in NON_CORE_PKGS.gmk
# The index.html, options, and packages files
@ -913,12 +909,12 @@ ALL_OTHER_TARGETS += mgmtdocs
MGMT_DOCDIR := $(JRE_API_DOCSDIR)/management/extension
MGMT2COREAPI := ../../$(JDKJRE2COREAPI)
JVM_MIB_NAME := JVM-MANAGEMENT-MIB.mib
JVM_MIB_SRC := $(JDK_TOPDIR)/src/closed/share/classes/sun/management/snmp/$(JVM_MIB_NAME)
JVM_MIB_SRC := $(JDK_TOPDIR)/src/closed/jdk.snmp/share/classes/sun/management/snmp/$(JVM_MIB_NAME)
MGMT_DOCTITLE := Monitoring and Management Interface for the Java$(TRADEMARK) Platform
MGMT_WINDOWTITLE := Monitoring and Management Interface for the Java Platform
MGMT_HEADER := <strong>Monitoring and Management Interface for the Java Platform</strong>
MGMT_BOTTOM := $(call CommonBottom,$(MGMT_FIRST_COPYRIGHT_YEAR))
MGMT_OVERVIEW := $(JDK_SHARE_CLASSES)/com/sun/management/mgmt-overview.html
MGMT_OVERVIEW := $(JDK_TOPDIR)/src/java.management/share/classes/mgmt-overview.html
# MGMT_PKGS is located in NON_CORE_PKGS.gmk
# The index.html, options, and packages files

View File

@ -52,7 +52,6 @@ endif
# This target must be called in the context of a SPEC file
jprt_bundle: $(JPRT_ARCHIVE_BUNDLE)
@$(call CheckIfMakeAtEnd)
# This target must be called in the context of a SPEC file
$(JPRT_ARCHIVE_BUNDLE): bundles
@ -66,8 +65,7 @@ SRC_JDK_BUNDLE_DIR := $(JDK_BUNDLE_DIR)
SRC_JRE_BUNDLE_DIR := $(JRE_BUNDLE_DIR)
# Bundle up the images
bundles: all bundles-only
bundles-only: start-make
bundles: all
@$(call TargetEnter)
$(MKDIR) -p $(BUILD_OUTPUT)/bundles
$(CD) $(SRC_JDK_IMAGE_DIR) && $(ZIP) -y -q -r $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip .
@ -78,8 +76,7 @@ bundles-only: start-make
@$(call TargetExit)
# Copy images to one unified location regardless of platform etc.
final-images: all final-images-only
final-images-only: start-make
final-images: all
@$(call TargetEnter)
$(RM) -r $(BUILD_OUTPUT)/final-images
$(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JDK_IMAGE_SUBDIR)
@ -97,4 +94,4 @@ final-images-only: start-make
###########################################################################
# Phony targets
.PHONY: jprt_bundle bundles bundles-only final-images final-images-only
.PHONY: jprt_bundle bundles final-images

View File

@ -23,165 +23,201 @@
# questions.
#
### This is the main part of the Makefile, for the normal case with SPEC specifying a single existing spec.gmk file.
################################################################################
# This is the main makefile containing most actual top level targets. It needs
# to be called with a SPEC file defined.
# Declare default target
default:
# Now load the spec
include $(SPEC)
include $(SRC_ROOT)/make/MakeHelpers.gmk
# Load the vital tools for all the makefiles.
include $(SRC_ROOT)/make/common/MakeBase.gmk
# Load common profile names definitions
include $(JDK_TOPDIR)/make/ProfileNames.gmk
# Declare ALL_TARGETS as an immediate variable. This variable is a list of all
# valid top level targets. It's used to declare them all as PHONY and to
# generate the -only targets.
ALL_TARGETS :=
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, , Main.gmk))
### Clean up from previous run
# All modules for the current target platform.
# Manually add jdk.hotspot.agent for now.
ALL_MODULES := $(call FindAllModules) jdk.hotspot.agent
# Remove any build.log from a previous run, if they exist
ifneq (,$(BUILD_LOG))
ifneq (,$(BUILD_LOG_PREVIOUS))
# Rotate old log
$(shell $(RM) $(BUILD_LOG_PREVIOUS) 2> /dev/null)
$(shell $(MV) $(BUILD_LOG) $(BUILD_LOG_PREVIOUS) 2> /dev/null)
else
$(shell $(RM) $(BUILD_LOG) 2> /dev/null)
endif
$(shell $(RM) $(OUTPUT_ROOT)/build-trace-time.log 2> /dev/null)
endif
# Remove any javac server logs and port files. This
# prevents a new make run to reuse the previous servers.
ifneq (,$(SJAVAC_SERVER_DIR))
$(shell $(MKDIR) -p $(SJAVAC_SERVER_DIR) && $(RM) -rf $(SJAVAC_SERVER_DIR)/*)
endif
################################################################################
################################################################################
#
# Recipes for all targets. Only recipes, dependencies are declared later.
#
################################################################################
# Reset the build timers.
$(eval $(call ResetAllTimers))
################################################################################
# Interim/build tools targets, compiling tools used during the build
# Setup number of jobs to use. -jN is unfortunately not available for us to parse from the command line,
# hence this workaround.
MAKE_ARGS:=$(MAKE_ARGS) -j$(JOBS)
interim-langtools:
+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
### Main targets
interim-corba:
+($(CD) $(CORBA_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileCorba.gmk)
default: jdk
@$(call CheckIfMakeAtEnd)
interim-rmic:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
all: images docs
@$(call CheckIfMakeAtEnd)
build-tools-jdk:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk java-tools)
# Setup a rule for SPEC file that fails if executed. This check makes sure the configuration
# is up to date after changes to configure
$(SPEC): $(wildcard $(SRC_ROOT)/common/autoconf/*)
@$(ECHO) "ERROR: $(SPEC) is not up to date."
@$(ECHO) "Please rerun configure! Easiest way to do this is by running"
@$(ECHO) "'make reconfigure'."
@if test "x$(IGNORE_OLD_CONFIG)" != "xtrue"; then exit 1; fi
ALL_TARGETS += interim-langtools interim-corba build-tools-jdk
start-make: $(SPEC)
@$(call AtMakeStart)
################################################################################
# Special targets for certain modules
langtools: langtools-only
langtools-only: start-make
@$(call TargetEnter)
@($(CD) $(LANGTOOLS_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildLangtools.gmk)
@$(call TargetExit)
import-hotspot:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Import.gmk)
corba: langtools corba-only
corba-only: start-make
@$(call TargetEnter)
@($(CD) $(CORBA_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildCorba.gmk)
@$(call TargetExit)
unpack-sec:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)
jaxp: langtools jaxp-only
jaxp-only: start-make
@$(call TargetEnter)
@($(CD) $(JAXP_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJaxp.gmk)
@$(call TargetExit)
policy-jars:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CreatePolicyJars.gmk)
jaxws: langtools jaxp jaxws-only
jaxws-only: start-make
@$(call TargetEnter)
@($(CD) $(JAXWS_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJaxws.gmk)
@$(call TargetExit)
ALL_TARGETS += import-hotspot unpack-sec policy-jars
################################################################################
# Gensrc targets, generating source before java compilation can be done
JDK_GENSRC_MODULES := $(call FindModulesWithMakefileFor, gensrc, Gensrc)
LANGTOOLS_GENSRC_MODULES := jdk.compiler.tools
CORBA_GENSRC_MODULES := java.corba
GENSRC_MODULES := $(JDK_GENSRC_MODULES) $(LANGTOOLS_GENSRC_MODULES) \
$(CORBA_GENSRC_MODULES)
JDK_GENSRC_TARGETS := $(addsuffix -gensrc, $(JDK_GENSRC_MODULES))
LANGTOOLS_GENSRC_TARGETS := $(addsuffix -gensrc, $(LANGTOOLS_GENSRC_MODULES))
CORBA_GENSRC_TARGETS := $(addsuffix -gensrc, $(CORBA_GENSRC_MODULES))
GENSRC_TARGETS := $(addsuffix -gensrc, $(GENSRC_MODULES))
jdk.compiler.tools-gensrc:
+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f GensrcLangtools.gmk)
java.corba-gensrc:
+($(CD) $(CORBA_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f GensrcCorba.gmk)
# Declare recipes for all jdk <module>-gensrc targets
$(foreach m, $(JDK_GENSRC_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
$m, gensrc, gensrc, Gensrc)))
ALL_TARGETS += $(GENSRC_TARGETS)
################################################################################
# Generate data targets
GENDATA_MODULES := $(call FindModulesWithMakefileFor, gendata, Gendata)
GENDATA_TARGETS := $(addsuffix -gendata, $(GENDATA_MODULES))
# Declare recipes for all <module>-gendata targets
$(foreach m, $(GENDATA_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
$m, gendata, gendata, Gendata)))
$(foreach m, $(GENDATA_MODULES), $(eval $(call DeclareGendataRecipe,$m)))
ALL_TARGETS += $(GENDATA_TARGETS)
################################################################################
# Copy files targets
COPY_MODULES := $(call FindModulesWithMakefileFor, copy, Copy)
COPY_TARGETS := $(addsuffix -copy, $(COPY_MODULES))
# Declare recipes for all <module>-copy targets
$(foreach m, $(COPY_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
$m, copy, copy, Copy)))
ALL_TARGETS += $(COPY_TARGETS)
################################################################################
# Targets for compiling all java modules. Nashorn is treated separately.
JAVA_MODULES := $(call FindJavaModules)
JAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES))
define DeclareCompileJavaRecipe
$1-java:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f CompileJavaModules.gmk \
$1 JAVA_MODULES=$1)
endef
$(foreach m, $(filter-out jdk.scripting.nashorn, $(JAVA_MODULES)), \
$(eval $(call DeclareCompileJavaRecipe,$m)))
# Build nashorn. Needs to be compiled separately from the rest of the modules
# due to nasgen.
jdk.scripting.nashorn-java:
+($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk compile)
ALL_TARGETS += $(JAVA_TARGETS)
################################################################################
# Targets for running rmic.
RMIC_MODULES := $(call FindModulesWithMakefileFor, rmic, Rmic)
RMIC_TARGETS := $(addsuffix -rmic, $(RMIC_MODULES))
# Declare recipes for all <module>-rmic targets
$(foreach m, $(RMIC_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
$m, rmic, rmic, Rmic)))
ALL_TARGETS += $(RMIC_TARGETS)
################################################################################
# Targets for compiling native libraries
ALL_LIB_MODULES := $(call FindModulesWithMakefileFor, lib, Lib)
LIB_MODULES := $(filter $(ALL_MODULES), $(ALL_LIB_MODULES))
LIB_TARGETS := $(addsuffix -libs, $(LIB_MODULES))
# Declare recipes for all <module>-libs targets
$(foreach m, $(LIB_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
$m, libs, lib, Lib)))
ALL_TARGETS += $(LIB_TARGETS)
################################################################################
# Targets for compiling native executables
ALL_LAUNCHER_MODULES := $(call FindModulesWithMakefileFor, launcher, Launcher)
LAUNCHER_MODULES := $(filter $(ALL_MODULES), $(ALL_LAUNCHER_MODULES))
LAUNCHER_TARGETS := $(addsuffix -launchers, $(LAUNCHER_MODULES))
# Declare recipes for all <module>-launchers targets
$(foreach m, $(LAUNCHER_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
$m, launchers, launcher, Launcher)))
ALL_TARGETS += $(LAUNCHER_TARGETS)
################################################################################
# Build hotspot target
ifeq ($(BUILD_HOTSPOT),true)
hotspot: hotspot-only
hotspot-only: start-make
@$(call TargetEnter)
@($(CD) $(SRC_ROOT)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
@$(call TargetExit)
hotspot:
($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk)
endif
jdk: langtools hotspot corba jaxp jaxws jdk-only
jdk-only: start-make
@$(call TargetEnter)
@($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk $(JDK_TARGET))
@$(call TargetExit)
ALL_TARGETS += hotspot
nashorn: jdk nashorn-only
nashorn-only: start-make
@$(call TargetEnter)
@($(CD) $(NASHORN_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk)
@$(call TargetExit)
################################################################################
# Build demos and samples targets
demos: jdk demos-only
demos-only: start-make
@$(call TargetEnter)
@($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk demos)
@$(call TargetExit)
demos:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileDemos.gmk)
# Note: This double-colon rule is intentional, to support
# custom make file integration.
images:: source-tips demos nashorn images-only
images-only: start-make
@$(call TargetEnter)
@($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk images)
@$(call TargetExit)
samples:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopySamples.gmk)
overlay-images: source-tips demos overlay-images-only
overlay-images-only: start-make
@$(call TargetEnter)
@($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk overlay-images)
@$(call TargetExit)
ALL_TARGETS += demos samples
profiles: profiles-oscheck source-tips jdk hotspot profiles-only
profiles-only: start-make
@$(call TargetEnter)
@($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk profiles)
@$(call TargetExit)
profiles-oscheck:
ifneq ($(OPENJDK_TARGET_OS), linux)
@echo "Error: The Java SE 8 Compact Profiles are only implemented for Linux at this time" && exit 1
endif
install: images install-only
install-only: start-make
@$(call TargetEnter)
@($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk install)
@$(call TargetExit)
docs: jdk docs-only
docs-only: start-make
@$(call TargetEnter)
@($(CD) $(SRC_ROOT)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
@$(call TargetExit)
sign-jars: jdk sign-jars-only
sign-jars-only: start-make
@$(call TargetEnter)
@($(CD) $(JDK_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) -f BuildJdk.gmk sign-jars)
@$(call TargetExit)
bootcycle-images: images bootcycle-images-only
bootcycle-images-only: start-make
@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
@($(CD) $(SRC_ROOT) && $(BUILD_LOG_WRAPPER) $(MAKE) SPEC=$(dir $(SPEC))bootcycle-spec.gmk images)
test: images test-only
test-only: start-make
@$(call TargetEnter)
@($(CD) $(SRC_ROOT)/test && $(BUILD_LOG_WRAPPER) $(MAKE) -j1 -k MAKEFLAGS= JT_HOME=$(JT_HOME) PRODUCT_HOME=$(JDK_IMAGE_DIR) ALT_OUTPUTDIR=$(OUTPUT_ROOT) CONCURRENCY=$(JOBS) $(TEST)) || true
@$(call TargetExit)
################################################################################
# Image targets
# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
# used to track the exact sources used to build that image.
@ -191,52 +227,313 @@ $(OUTPUT_ROOT)/source_tips: FRC
@$(RM) $@
@$(call GetSourceTips)
security-jars:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CreateSecurityJars.gmk)
nashorn-jar:
+($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk all)
# Creates the jar files (rt.jar resources.jar etc)
main-jars:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CreateJars.gmk)
# Creates the images (j2sdk-image j2re-image etc)
images:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk)
ifeq ($(OPENJDK_TARGET_OS), macosx)
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk)
endif
# Create Compact Profile jars
PROFILE_JARS_TARGETS := $(addsuffix -jars, $(ALL_PROFILES))
$(PROFILE_JARS_TARGETS):
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE=$(@:%-jars=%) -f CreateJars.gmk)
# Create Compact Profile images
PROFILE_IMAGES_TARGETS := $(addsuffix -images, $(ALL_PROFILES))
$(PROFILE_IMAGES_TARGETS):
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE=$(@:%-images=%) \
JRE_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/j2re-$(word $(call profile_number,$(@:%-images=%)),$(PROFILE_NAMES))-image \
-f Images.gmk profile-image)
profiles-oscheck:
ifneq ($(OPENJDK_TARGET_OS), linux)
@echo "Error: The Java SE 8 Compact Profiles are only implemented for Linux at this time" && exit 1
endif
bootcycle-images:
@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
+$(MAKE) $(MAKE_ARGS) -f Main.gmk SPEC=$(dir $(SPEC))bootcycle-spec.gmk images
ALL_TARGETS += source-tips security-jars nashorn-jar main-jars images \
$(PROFILE_JARS_TARGETS) $(PROFILE_IMAGES_TARGETS) profiles-oscheck \
bootcycle-images
################################################################################
# Docs targets
docs-javadoc:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk docs)
docs-jvmtidoc:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Javadoc.gmk jvmtidocs)
ALL_TARGETS += docs-javadoc docs-jvmtidoc
################################################################################
# Test target
test:
($(CD) $(SRC_ROOT)/test && $(MAKE) $(MAKE_ARGS) -j1 -k MAKEFLAGS= \
JT_HOME=$(JT_HOME) PRODUCT_HOME=$(JDK_OUTPUT_DIR) \
ALT_OUTPUTDIR=$(OUTPUT_ROOT) CONCURRENCY=$(JOBS) $(TEST)) || true
test-make:
($(CD) $(SRC_ROOT)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET))
ALL_TARGETS += test test-make
################################################################################
# Verification targets
# generate modules.xml in the exploded image
modules-xml:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f ModulesXml.gmk gen-modules-xml)
verify-modules:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f ModulesXml.gmk checkdeps)
ALL_TARGETS += modules-xml verify-modules
################################################################################
# Install targets
install:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Install.gmk)
ALL_TARGETS += install
################################################################################
#
# Dependency declarations between targets.
#
# These are declared in two groups. First all dependencies between targets that
# have recipes above as these dependencies may be disabled. Then the aggregator
# targets that do not have recipes of their own, which will never have their
# dependencies disabled.
#
################################################################################
# Targets with recipes above
# If running an *-only target, parallel execution and dependencies between
# recipe targets are disabled. This makes it possible to run a select set of
# recipe targets in order. It's the responsibility of the user to make sure
# all prerequisites are fulfilled.
ifneq ($(findstring -only, $(MAKECMDGOALS)), )
.NOTPARALLEL:
else
interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)
build-tools-jdk: interim-langtools
$(CORBA_GENSRC_TARGETS): interim-langtools
$(JDK_GENSRC_TARGETS): interim-langtools build-tools-jdk
interim-corba: $(CORBA_GENSRC_TARGETS)
$(GENDATA_TARGETS): interim-langtools build-tools-jdk
interim-rmic: interim-langtools
$(RMIC_TARGETS): interim-langtools interim-corba interim-rmic
import-hotspot: hotspot
$(LIB_TARGETS): import-hotspot
$(LAUNCHER_TARGETS): java.base-libs
demos: $(JAVA_TARGETS)
# Declare dependency from <module>-java to <module>-gensrc
$(foreach m, $(GENSRC_MODULES), $(eval $m-java: $m-gensrc))
# Declare dependencies between java modules
$(foreach m, $(JAVA_MODULES), \
$(eval $m-java: $(addsuffix -java, $(filter $(JAVA_MODULES), \
$(call FindDepsForModule,$m)))))
# Declare dependencies between <module>-rmic to <module>-java
$(foreach m, $(RMIC_MODULES), $(eval $m-rmic: $m-java))
# Declare dependencies from <module>-lib to <module>-java
# Skip jdk.jdwp.agent as it contains no java code.
$(foreach m, $(filter-out jdk.jdwp.agent, $(LIB_MODULES)), $(eval $m-libs: $m-java))
# Declare dependencies from all other <module>-lib to java.base-lib
$(foreach t, $(filter-out java.base-libs, $(LIB_TARGETS)), \
$(eval $t: java.base-libs))
# Declare the special case dependency for jdk.deploy.osx where libosx
# links against libosxapp.
jdk.deploy.osx-libs: java.desktop-libs
# This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a
# header file used by jdk.jdwp libs.
jdk.jdwp-libs: jdk.jdi-gensrc
# Explicitly add dependencies for special targets
java.base-java: unpack-sec
security-jars: java
nashorn-jar: jdk.scripting.nashorn-java
main-jars: java rmic security-jars nashorn-jar policy-jars import-hotspot
# On windows, the jars target needs to wait for jgss libs to be built.
# Should ideally split out the sec-bin zip file generation to avoid
# this dependency.
ifeq ($(OPENJDK_TARGET_OS), windows)
main-jars: java.security.jgss-libs
endif
images: jars demos samples exploded-image source-tips
bootcycle-images: images
# Need to depend on jars as otherwise there will a race between all the
# invocations of CreateJars.gmk.
$(PROFILE_JARS_TARGETS): jars profiles-oscheck
$(PROFILE_IMAGES_TARGETS): demos samples exploded-image source-tips
# Declare dependencies from <profile>-images to <profile>-jars
$(foreach p, $(ALL_PROFILES), $(eval $p-images: $p-jars))
docs-javadoc: $(GENSRC_TARGETS) rmic
docs-jvmtidoc: hotspot
test: exploded-image
modules-xml: build-tools-jdk java
verify-modules: exploded-image modules-xml
endif
################################################################################
# Virtual targets without recipes
gensrc: $(GENSRC_TARGETS)
gendata: $(GENDATA_TARGETS)
copy: $(COPY_TARGETS)
java: $(JAVA_TARGETS)
rmic: $(RMIC_TARGETS)
libs: $(LIB_TARGETS)
launchers: $(LAUNCHER_TARGETS)
# Explicitly add dependencies for these special targets
java.base: import-hotspot policy-jars
# Declare dependencies from <module> to all the individual targets specific
# to that module <module>-*.
$(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
$(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
$(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
$(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic))
$(foreach m, $(LIB_MODULES), $(eval $m: $m-libs))
$(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
$(foreach m, $(COPY_MODULES), $(eval $m: $m-copy))
ALL_MODULE_TARGETS := $(sort $(GENSRC_MODULES) $(JAVA_MODULES) \
$(GENDATA_MODULES) $(LIB_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES))
exploded-image: $(ALL_MODULE_TARGETS) modules-xml
jars: main-jars nashorn-jar security-jars policy-jars
# Make each profile name a target that depends on it's images target.
$(foreach p, $(ALL_PROFILES), $(eval $(p): $(p)-images $(p)-jars))
profiles: $(ALL_PROFILES)
docs: docs-javadoc docs-jvmtidoc
ALL_TARGETS += gensrc gendata copy java rmic libs launchers \
$(ALL_MODULE_TARGETS) exploded-image jars \
$(ALL_PROFILES) profiles docs
################################################################################
all: images docs verify-modules
default: exploded-image
ALL_TARGETS += default all
################################################################################
################################################################################
#
# Clean targets
#
################################################################################
# If running a clean target, disable parallel execution
ifneq ($(findstring clean, $(MAKECMDGOALS)), )
.NOTPARALLEL:
endif
CLEAN_COMPONENTS += langtools corba hotspot jdk nashorn images \
bootcycle-build docs docstemp test
CLEAN_TARGETS := $(addprefix clean-, $(CLEAN_COMPONENTS))
# Remove everything, except the output from configure.
clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-nashorn clean-images clean-overlay-images clean-bootcycle-build clean-docs clean-test
@($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*)
@$(ECHO) Cleaned all build artifacts.
clean: $(CLEAN_TARGETS)
($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*)
$(ECHO) Cleaned all build artifacts.
$(CLEAN_TARGETS):
$(call CleanComponent,$(patsubst clean-%, %, $@))
clean-docs: clean-docstemp
# Remove everything, including configure configuration.
# If the output directory was created by configure and now becomes empty, remove it as well.
# FIXME: tmp should not be here, fix ResetTimers instead. And remove spec.sh!
dist-clean: clean
@($(CD) $(OUTPUT_ROOT) && $(RM) -r *spec.gmk config.* configure-arguments Makefile compare.sh spec.sh tmp javacservers)
@$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
($(CD) $(OUTPUT_ROOT) && $(RM) -r *spec.gmk config.* configure-arguments \
Makefile compare.sh spec.sh tmp javacservers)
$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
$(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
else \
($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" && $(RM) -r $(OUTPUT_ROOT)) \
($(CD) $(SRC_ROOT) && $(ECHO) "Removing configuration directory for '$(CONF_NAME)'" \
&& $(RM) -r $(OUTPUT_ROOT)) \
fi \
)
@$(ECHO) Cleaned everything, you will have to re-run configure.
$(ECHO) Cleaned everything, you will have to re-run configure.
ALL_TARGETS += clean dist-clean $(CLEAN_TARGETS)
################################################################################
# Setup a rule for SPEC file that fails if executed. This check makes sure the
# configuration is up to date after changes to configure.
ifeq ($(findstring reconfigure, $(MAKECMDGOALS)), )
$(SPEC): $(wildcard $(SRC_ROOT)/common/autoconf/*)
@$(ECHO) "ERROR: $(SPEC) is not up to date."
@$(ECHO) "Please rerun configure! Easiest way to do this is by running"
@$(ECHO) "'make reconfigure'."
@$(ECHO) "It may also be ignored by setting IGNORE_OLD_CONFIG=true"
@if test "x$(IGNORE_OLD_CONFIG)" != "xtrue"; then exit 1; fi
endif
clean-langtools:
$(call CleanComponent,langtools)
clean-corba:
$(call CleanComponent,corba)
clean-jaxp:
$(call CleanComponent,jaxp)
clean-jaxws:
$(call CleanComponent,jaxws)
clean-hotspot:
$(call CleanComponent,hotspot)
clean-jdk:
$(call CleanComponent,jdk)
clean-nashorn:
$(call CleanComponent,nashorn)
clean-images:
$(call CleanComponent,images)
clean-overlay-images:
$(call CleanComponent,overlay-images)
clean-bootcycle-build:
$(call CleanComponent,bootcycle-build)
clean-docs:
$(call CleanComponent,docs)
$(call CleanComponent,docstemp)
clean-test:
$(call CleanComponent,testoutput)
reconfigure:
ifneq ($(CONFIGURE_COMMAND_LINE), )
@$(ECHO) "Re-running configure using arguments '$(CONFIGURE_COMMAND_LINE)'"
@ -245,12 +542,18 @@ reconfigure:
endif
@( cd $(OUTPUT_ROOT) && $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) )
.PHONY: langtools corba jaxp jaxws hotspot jdk nashorn images overlay-images install test docs
.PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only nashorn-only images-only overlay-images-only install-only test-only docs-only
.PHONY: default all clean dist-clean bootcycle-images start-make
.PHONY: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-nashorn clean-images clean-docs clean-test clean-overlay-images clean-bootcycle-build
.PHONY: profiles profiles-only profiles-oscheck
ALL_TARGETS += reconfigure
include $(root_dir)/make/Jprt.gmk
################################################################################
# Declare *-only targets for each normal target
$(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
ALL_TARGETS += $(addsuffix -only, $(ALL_TARGETS))
################################################################################
.PHONY: $(ALL_TARGETS)
include $(SRC_ROOT)/make/Jprt.gmk
FRC: # Force target

View File

@ -40,7 +40,7 @@ _MAKEHELPERS_GMK := 1
# Find out which variables were passed explicitely on the make command line. These
# will be passed on to sub-makes, overriding spec.gmk settings.
MAKE_ARGS=$(foreach var,$(subst =command,,$(filter %=command,$(foreach var,$(.VARIABLES),$(var)=$(firstword $(origin $(var)))))),$(var)=$($(var)))
MAKE_ARGS=$(foreach var,$(subst =command,,$(filter %=command,$(foreach var,$(.VARIABLES),$(var)=$(firstword $(origin $(var)))))),$(var)="$($(var))")
list_alt_overrides_with_origins=$(filter ALT_%=environment ALT_%=command,$(foreach var,$(.VARIABLES),$(var)=$(firstword $(origin $(var)))))
list_alt_overrides=$(subst =command,,$(subst =environment,,$(list_alt_overrides_with_origins)))
@ -112,7 +112,8 @@ endef
# Do not indent this function, this will add whitespace at the start which the caller won't handle
define GetRealTarget
$(strip $(if $(MAKECMDGOALS),$(MAKECMDGOALS),default))
$(strip $(if $(findstring main-wrapper, $(MAKECMDGOALS)), $(MAIN_TARGETS), \
$(if $(MAKECMDGOALS),$(MAKECMDGOALS),default)))
endef
# Do not indent this function, this will add whitespace at the start which the caller won't handle
@ -131,24 +132,23 @@ endef
# Hook to be called when starting to execute a top-level target
define TargetEnter
$(BUILD_LOG_WRAPPER) $(PRINTF) "## Starting $(patsubst %-only,%,$@)\n"
$(PRINTF) "## Starting $(patsubst %-only,%,$@)\n"
$(call RecordStartTime,$(patsubst %-only,%,$@))
endef
# Hook to be called when finish executing a top-level target
define TargetExit
$(call RecordEndTime,$(patsubst %-only,%,$@))
$(BUILD_LOG_WRAPPER) $(PRINTF) "## Finished $(patsubst %-only,%,$@) (build time %s)\n\n" \
$(PRINTF) "## Finished $(patsubst %-only,%,$@) (build time %s)\n\n" \
"`$(CAT) $(BUILDTIMESDIR)/build_time_diff_$(patsubst %-only,%,$@) | $(CUT) -f 1 -d ' '`"
$(call CheckIfMakeAtEnd)
endef
# Hook to be called as the very first thing when running a normal build
define AtMakeStart
$(if $(findstring --jobserver,$(MAKEFLAGS)),$(error make -j is not supported, use make JOBS=n))
$(call CheckEnvironment)
@$(PRINTF) $(LOG_INFO) "Running make as '$(MAKE) $(MFLAGS) $(MAKE_ARGS)'\n"
@$(PRINTF) "Building $(PRODUCT_NAME) for target '$(call GetRealTarget)' in configuration '$(CONF_NAME)'\n\n"
$(BUILD_LOG_WRAPPER) $(PRINTF) $(LOG_INFO) "Running make as '$(MAKE) $(MFLAGS) $(MAKE_ARGS)'\n"
$(BUILD_LOG_WRAPPER) $(PRINTF) "Building $(PRODUCT_NAME) for target '$(call GetRealTarget)' in configuration '$(CONF_NAME)'\n\n"
$(call StartGlobalTimer)
endef
@ -157,7 +157,7 @@ define AtMakeEnd
[ -f $(SJAVAC_SERVER_DIR)/server.port ] && echo Stopping sjavac server && $(TOUCH) $(SJAVAC_SERVER_DIR)/server.port.stop; true
$(call StopGlobalTimer)
$(call ReportBuildTimes)
@$(PRINTF) "Finished building $(PRODUCT_NAME) for target '$(call GetRealTarget)'\n"
@$(PRINTF) "\nFinished building $(PRODUCT_NAME) for target '$(call GetRealTarget)'\n"
$(call CheckEnvironment)
endef
@ -298,7 +298,7 @@ endef
# Cleans the component given as $1
define CleanComponent
@$(PRINTF) "Cleaning $1 build artifacts ..."
@$(PRINTF) "Cleaning $(strip $1) build artifacts ..."
@($(CD) $(OUTPUT_ROOT) && $(RM) -r $1)
@$(PRINTF) " done\n"
endef

View File

@ -35,6 +35,9 @@
# of removing duplicates. It is actually this side effect that is
# desired whenever sort is used below!
ifndef _JAVA_COMPILATION_GMK
_JAVA_COMPILATION_GMK := 1
ifeq (,$(_MAKEBASE_GMK))
$(error You must include MakeBase.gmk prior to including JavaCompilation.gmk)
endif
@ -105,8 +108,8 @@ define SetupArchive
# On windows, a lot of includes/excludes risk making the command line too long, so
# writing the grep patterns to files.
ifneq (,$$($1_INCLUDES))
$1_GREP_INCLUDE_PATTERNS:=$$(foreach src,$$($1_SRCS), \
$$(addprefix $$(src)/,$$($1_INCLUDES)))
$1_GREP_INCLUDE_PATTERNS:=$$(call EscapeDollar, \
$$(foreach src,$$($1_SRCS), $$(addprefix $$(src)/,$$($1_INCLUDES))))
# If there are a lot of include patterns, output to file to shorten command lines
ifeq ($$(word 20,$$($1_GREP_INCLUDE_PATTERNS)),)
$1_GREP_INCLUDES:=| $(GREP) $$(patsubst %,$(SPACE)-e$(SPACE)$(DQUOTE)%$(DQUOTE),$$($1_GREP_INCLUDE_PATTERNS))
@ -118,8 +121,9 @@ define SetupArchive
endif
endif
ifneq (,$$($1_EXCLUDES)$$($1_EXCLUDE_FILES))
$1_GREP_EXCLUDE_PATTERNS:=$$(foreach src,$$($1_SRCS),$$(addprefix $$(src)/, \
$$($1_EXCLUDES) $$($1_EXCLUDE_FILES)))
$1_GREP_EXCLUDE_PATTERNS:=$$(call EscapeDollar, \
$$(foreach src,$$($1_SRCS),$$(addprefix $$(src)/, \
$$($1_EXCLUDES) $$($1_EXCLUDE_FILES))))
# If there are a lot of include patterns, output to file to shorten command lines
ifeq ($$(word 20,$$($1_GREP_EXCLUDE_PATTERNS)),)
$1_GREP_EXCLUDES:=| $(GREP) -v $$(patsubst %,$(SPACE)-e$(SPACE)$(DQUOTE)%$(DQUOTE),$$($1_GREP_EXCLUDE_PATTERNS))
@ -154,9 +158,9 @@ define SetupArchive
ifneq (,$$($1_GREP_EXCLUDE_PATTERNS))
$1_DEPS:=$$(filter-out $$(addsuffix %,$$($1_GREP_EXCLUDE_PATTERNS)),$$($1_DEPS))
endif
# The subst of \ is needed because $ has to be escaped with \ in EXTRA_FILES for the command
# lines, but not here for use in make dependencies.
$1_DEPS+=$$(subst \,,$$(foreach src,$$($1_SRCS),$$(addprefix $$(src)/,$$($1_EXTRA_FILES))))
# Look for EXTRA_FILES in all SRCS dirs and as absolute paths.
$1_DEPS+=$$(wildcard $$(foreach src, $$($1_SRCS), \
$$(addprefix $$(src)/, $$($1_EXTRA_FILES))) $$($1_EXTRA_FILES))
ifeq (,$$($1_SKIP_METAINF))
$1_DEPS+=$$(call CacheFind,$$(wildcard $$(addsuffix /META-INF,$$($1_SRCS))))
endif
@ -168,44 +172,69 @@ define SetupArchive
# Utility macros, to make the shell script receipt somewhat easier to decipher.
# Capture extra files is the same for both CAPTURE_CONTENTS and SCAPTURE_CONTENTS so
# only define it once to avoid duplication.
# The list of extra files might be long, so need to use ListPathsSafely to print
# them out to a separte file. Then process the contents of that file to rewrite
# into -C <dir> <file> lines.
# The EXTRA_FILES_RESOLVED varible must be set in the macro so that it's evaluated
# in the recipe when the files are guaranteed to exist.
$1_CAPTURE_EXTRA_FILES=\
$(RM) $$($1_BIN)/_the.$$($1_JARNAME)_contents.extra $$(NEWLINE) \
$$(eval $1_EXTRA_FILES_RESOLVED:=$$(call DoubleDollar, $$(call DoubleDollar, \
$$(wildcard $$(foreach src, $$($1_SRCS), \
$$(addprefix $$(src)/, $$($1_EXTRA_FILES))) $$($1_EXTRA_FILES))))) \
$$(if $$($1_EXTRA_FILES_RESOLVED), \
$$(call ListPathsSafely,$1_EXTRA_FILES_RESOLVED,\n, \
>> $$($1_BIN)/_the.$$($1_JARNAME)_contents.extra) $$(NEWLINE) \
$(SED) $$(foreach src,$$($1_SRCS), -e 's|$$(src)/|-C $$(src) |g') \
$$($1_BIN)/_the.$$($1_JARNAME)_contents.extra \
>> $$($1_BIN)/_the.$$($1_JARNAME)_contents $$(NEWLINE))
# The capture contents macro finds all files (matching the patterns, typically
# .class and .prp) that are newer than the jar-file, ie the new content to be put into the jar.
# NOTICE: please leave the parentheses space separated otherwise the AIX build will break!
$1_CAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS), \
( ( $(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) -a -newer $$@ $$($1_GREP_INCLUDES) \
$$($1_GREP_EXCLUDES) | $(SED) 's|$$(src)/||g' && \
$(ECHO) $$(subst $$(src)/,,$$($1_EXTRA_FILES) ) ) > \
$$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE) )
$1_CAPTURE_CONTENTS=\
$(RM) $$($1_BIN)/_the.$$($1_JARNAME)_contents $$(NEWLINE) \
$$(foreach src,$$($1_SRCS), \
$(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) -a -newer $$@ $$($1_GREP_INCLUDES) \
$$($1_GREP_EXCLUDES) | $(SED) 's|$$(src)/|-C $$(src) |g' \
>> $$($1_BIN)/_the.$$($1_JARNAME)_contents $$(NEWLINE)) \
$$($1_CAPTURE_EXTRA_FILES)
# The capture metainf macro finds all files below the META-INF directory that are newer than the jar-file.
ifeq (,$$($1_SKIP_METAINF))
$1_CAPTURE_METAINF =$$(foreach src,$$($1_SRCS),($(FIND) $$(src)/META-INF -type f -a -newer $$@ 2> /dev/null | $(SED) 's|$$(src)/||g' >> $$(src)/_the.$$($1_JARNAME)_contents ) $$(NEWLINE))
$1_CAPTURE_METAINF =$$(foreach src,$$($1_SRCS), \
( $(FIND) $$(src)/META-INF -type f -a -newer $$@ 2> /dev/null | $(SED) 's|$$(src)/|-C $$(src) |g' >> \
$$($1_BIN)/_the.$$($1_JARNAME)_contents ) $$(NEWLINE) )
endif
# The capture deletes macro finds all deleted files and concatenates them. The resulting file
# tells us what to remove from the jar-file.
$1_CAPTURE_DELETES=$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.deleted -newer $$@ -exec $(SED) 's|$$(src)||g' \{\} >> $$($1_DELETES_FILE) \;) $$(NEWLINE))
$1_CAPTURE_DELETES=$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.deleted -newer $$@ \
-exec $(SED) 's|$$(src)||g' \{\} >> $$($1_DELETES_FILE) \;) $$(NEWLINE))
# The update contents macro updates the jar file with the previously capture contents.
# Use 'wc -w' to see if the contents file is empty.
$1_UPDATE_CONTENTS=$$(foreach src,$$($1_SRCS), \
(cd $$(src) && \
if [ "`$(WC) -w _the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'`" -gt "0" ]; then \
$(ECHO) " updating" `$(WC) -l _the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'` files && \
$(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @_the.$$($1_JARNAME)_contents; \
fi) $$(NEWLINE))
$1_UPDATE_CONTENTS=\
if [ "`$(WC) -l $$($1_BIN)/_the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'`" -gt "0" ]; then \
$(ECHO) " updating" `$(WC) -l $$($1_BIN)/_the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'` files && \
$(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents; \
fi $$(NEWLINE)
# The s-variants of the above macros are used when the jar is created from scratch.
# NOTICE: please leave the parentheses space separated otherwise the AIX build will break!
$1_SCAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS), \
( ( $(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) \
$$($1_GREP_EXCLUDES) | $(SED) 's|$$(src)/||g' && \
$$(subst $$(src)/,,$(ECHO) $$($1_EXTRA_FILES) ) ) > \
$$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE) )
$1_SCAPTURE_CONTENTS=\
$(RM) $$($1_BIN)/_the.$$($1_JARNAME)_contents $$(NEWLINE) \
$$(foreach src,$$($1_SRCS), \
$(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) \
$$($1_GREP_EXCLUDES) | $(SED) 's|$$(src)/|-C $$(src) |g' \
>> $$($1_BIN)/_the.$$($1_JARNAME)_contents $$(NEWLINE)) \
$$($1_CAPTURE_EXTRA_FILES)
ifeq (,$$($1_SKIP_METAINF))
$1_SCAPTURE_METAINF=$$(foreach src,$$($1_SRCS), \
($(FIND) $$(src)/META-INF -type f 2> /dev/null | $(SED) 's|$$(src)/||g' >> \
$$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE))
( $(FIND) $$(src)/META-INF -type f 2> /dev/null | $(SED) 's|$$(src)/|-C $$(src) |g' >> \
$$($1_BIN)/_the.$$($1_JARNAME)_contents) $$(NEWLINE) )
endif
$1_SUPDATE_CONTENTS=$$(foreach src,$$($1_SRCS), \
(cd $$(src) && $(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @$$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE))
$1_SUPDATE_CONTENTS=$(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @$$($1_BIN)/_the.$$($1_JARNAME)_contents $$(NEWLINE)
# Use a slightly shorter name for logging, but with enough path to identify this jar.
$1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_JAR))
@ -327,14 +356,19 @@ define add_file_to_copy
$2_TARGET:=$2
# Remove the source prefix.
$$(foreach i,$$($1_SRC),$$(eval $$(call remove_string,$$i,$2_TARGET)))
# Now we can setup the depency that will trigger the copying.
$$($1_BIN)$$($2_TARGET) : $2
# To allow for automatic overrides, do not create a rule for a target file that
# already has one
ifeq ($$(findstring $$($2_TARGET), $$($1_COPY_LIST)), )
$1_COPY_LIST += $$($2_TARGET)
# Now we can setup the depency that will trigger the copying.
$$($1_BIN)$$($2_TARGET) : $2
$(MKDIR) -p $$(@D)
$(CP) $$< $$@
$(CHMOD) -f ug+w $$@
# And do not forget this target
$1_ALL_COPY_TARGETS += $$($1_BIN)$$($2_TARGET)
# And do not forget this target
$1_ALL_COPY_TARGETS += $$($1_BIN)$$($2_TARGET)
endif
endef
@ -431,8 +465,9 @@ define SetupJavaCompilation
# Add all source roots to the find cache since we are likely going to run find
# on these more than once. The cache will only be updated if necessary.
$$(eval $$(call FillCacheFind,$$($1_SRC)))
# Find all files in the source trees.
$1_ALL_SRCS += $$(filter-out $(OVR_SRCS),$$(call CacheFind,$$($1_SRC)))
# Find all files in the source trees. Preserve order of source roots for overrides to
# work correctly. CacheFind does not preserve order so need to call it for each root.
$1_ALL_SRCS += $$(filter-out $(OVR_SRCS),$$(foreach s,$$($1_SRC),$$(call CacheFind,$$(s))))
# Extract the java files.
ifneq ($$($1_EXCLUDE_FILES),)
$1_EXCLUDE_FILES_PATTERN:=$$(addprefix %,$$($1_EXCLUDE_FILES))
@ -462,10 +497,12 @@ define SetupJavaCompilation
$1_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS))
endif
# All files below META-INF are always copied.
$1_ALL_COPIES := $$(filter $$(addsuffix /META-INF%,$$($1_SRC)),$$($1_ALL_SRCS))
# Find all files to be copied from source to bin.
ifneq (,$$($1_COPY)$$($1_COPY_FILES))
# Search for all files to be copied.
$1_ALL_COPIES := $$(filter $$(addprefix %,$$($1_COPY)),$$($1_ALL_SRCS))
$1_ALL_COPIES += $$(filter $$(addprefix %,$$($1_COPY)),$$($1_ALL_SRCS))
# Copy these explicitly
$1_ALL_COPIES += $$($1_COPY_FILES)
# Copy must also respect filters.
@ -479,14 +516,12 @@ define SetupJavaCompilation
$1_ALL_COPIES := $$(filter-out $$($1_EXCLUDE_FILES_PATTERN),$$($1_ALL_COPIES))
endif
endif
# All files below META-INF are always copied.
$1_ALL_COPIES += $$(filter $$(addsuffix /META-INF%,$$($1_SRC)),$$($1_ALL_SRCS))
ifneq (,$$($1_ALL_COPIES))
# Yep, there are files to be copied!
$1_ALL_COPY_TARGETS:=
$$(foreach i,$$($1_ALL_COPIES),$$(eval $$(call add_file_to_copy,$1,$$i)))
# Now we can depend on $$($1_ALL_COPY_TARGETS) to copy all files!
endif
ifneq (,$$($1_ALL_COPIES))
# Yep, there are files to be copied!
$1_ALL_COPY_TARGETS:=
$$(foreach i,$$($1_ALL_COPIES),$$(eval $$(call add_file_to_copy,$1,$$i)))
# Now we can depend on $$($1_ALL_COPY_TARGETS) to copy all files!
endif
# Find all property files to be copied and cleaned from source to bin.
ifneq (,$$($1_CLEAN)$$($1_CLEAN_FILES))
@ -529,7 +564,7 @@ define SetupJavaCompilation
endif
# Using sjavac to compile.
$1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_BIN)/javac_state
$1_COMPILE_TARGETS := $$($1_BIN)/javac_state
# Create SJAVAC variable form JAVAC variable. Expects $1_JAVAC to be
# "bootclasspathprepend -cp .../javac.jar com.sun.tools.javac.Main"
@ -545,7 +580,7 @@ define SetupJavaCompilation
$(ECHO) Compiling $1
($$($1_JVM) $$($1_SJAVAC) \
$$($1_REMOTE) \
-j $(JOBS) \
-j 1 \
--permit-unidentified-artifacts \
--permit-sources-without-package \
--compare-found-sources $$($1_BIN)/_the.$1_batch.tmp \
@ -555,9 +590,11 @@ define SetupJavaCompilation
$$($1_HEADERS_ARG) \
-d $$($1_BIN) && \
$(MV) $$($1_BIN)/_the.$1_batch.tmp $$($1_BIN)/_the.$1_batch)
# sjavac doesn't touch this if nothing has changed
$(TOUCH) $$@
else
# Using plain javac to batch compile everything.
$1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_BIN)/_the.$1_batch
$1_COMPILE_TARGETS := $$($1_BIN)/_the.$1_batch
# When building in batch, put headers in a temp dir to filter out those that actually
# changed before copying them to the real header dir.
@ -566,15 +603,18 @@ define SetupJavaCompilation
$$($1_HEADERS)/_the.$1_headers: $$($1_BIN)/_the.$1_batch
$(MKDIR) -p $$(@D)
for f in `ls $$($1_HEADERS).$1.tmp`; do \
if [ ! -f "$$($1_HEADERS)/$$$$f" ] || [ "`$(DIFF) $$($1_HEADERS)/$$$$f $$($1_HEADERS).$1.tmp/$$$$f`" != "" ]; then \
if [ -d "$$($1_HEADERS).$1.tmp" ]; then \
for f in `ls $$($1_HEADERS).$1.tmp`; do \
if [ ! -f "$$($1_HEADERS)/$$$$f" ] \
|| [ "`$(DIFF) $$($1_HEADERS)/$$$$f $$($1_HEADERS).$1.tmp/$$$$f`" != "" ]; then \
$(CP) -f $$($1_HEADERS).$1.tmp/$$$$f $$($1_HEADERS)/$$$$f; \
fi; \
done
done; \
fi
$(RM) -r $$($1_HEADERS).$1.tmp
$(TOUCH) $$@
$1 += $$($1_HEADERS)/_the.$1_headers
$1_HEADER_TARGETS := $$($1_HEADERS)/_the.$1_headers
endif
# When not using sjavac, pass along all sources to javac using an @file.
@ -590,6 +630,10 @@ define SetupJavaCompilation
endif
# Add all targets to main variable
$1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_COMPILE_TARGETS) \
$$($1_HEADER_TARGETS)
# Check if a jar file was specified, then setup the rules for the jar.
ifneq (,$$($1_JAR))
# If no suffixes was explicitly set for this jar file.
@ -630,3 +674,14 @@ define SetupJavaCompilation
$1 += $$($1_SRCZIP)
endif
endef
# Use this macro to find the correct target to depend on when the original
# SetupJavaCompilation is declared in a different makefile, to avoid having
# to declare and evaluate it again.
# param 1 is for example BUILD_MYPACKAGE
# param 2 is the output directory (BIN)
define SetupJavaCompilationCompileTarget
$(if $(findsring yes, $(ENABLE_SJAVAC)), $(strip $2)/javac_state, \
$(strip $2)/_the.$(strip $1)_batch)
endef
endif

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -33,6 +33,18 @@
ifndef _MAKEBASE_GMK
_MAKEBASE_GMK := 1
################################################################################
# This macro translates $ into \$ to protect the $ from expansion in the shell.
# To make this macro resilient against already escaped strings, first remove
# any present escapes before escaping so that no double escapes are added.
EscapeDollar = $(subst $$,\$$,$(subst \$$,$$,$(strip $1)))
################################################################################
# This macro translates $ into $$ to protect the string from make itself.
DoubleDollar = $(subst $$,$$$$,$(strip $1))
################################################################################
# If the variable that you want to send to stdout for piping into a file or otherwise,
# is potentially long, for example the a list of file paths, eg a list of all package directories.
# Then you need to use ListPathsSafely, which optimistically splits the output into several shell
@ -57,7 +69,7 @@ endef
define ListPathsSafely_Printf
$(if $(strip $($1_LPS$4)),$(if $(findstring $(LOG_LEVEL),trace),,@)printf \
-- "$(strip $($1_LPS$4))\n" | $(decompress_paths) $3)
-- "$(strip $(call EscapeDollar, $($1_LPS$4)))\n" | $(decompress_paths) $3)
endef
# Receipt example:
@ -410,15 +422,19 @@ else ifeq ($(OPENJDK_TARGET_OS),macosx)
if [ -n "`$(XATTR) -l '$@'`" ]; then $(XATTR) -c '$@'; fi
endef
else
# Running mkdir and cp in the same shell speeds up copy intensive tasks in Cygwin
# significantly.
define install-file
$(MKDIR) -p $(@D)
$(CP) -fP '$<' '$@'
$(MKDIR) -p $(@D) && $(CP) -fP '$<' '$@'
endef
endif
# Convenience functions for working around make's limitations with $(filter ).
containing = $(foreach v,$2,$(if $(findstring $1,$v),$v))
not-containing = $(foreach v,$2,$(if $(findstring $1,$v),,$v))
containing = $(strip $(foreach v,$(strip $2),$(if $(findstring $(strip $1),$v),$v)))
not-containing = $(strip $(foreach v,$(strip $2),$(if $(findstring $(strip $1),$v),,$v)))
# Filter out duplicate sub strings while preserving order. Keeps the first occurance.
uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
ifneq ($(DISABLE_CACHE_FIND), true)
################################################################################
@ -457,6 +473,8 @@ ifneq ($(DISABLE_CACHE_FIND), true)
# Otherwise reverts to shell find. This is safe to call on all platforms, even if
# cache is deactivated.
#
# $1 can be either a directory or a file. If it's a directory, make
# sure we have exactly one trailing slash before the wildcard.
# The extra - is needed when FIND_CACHE_DIRS is empty but should be harmless.
#
# Param 1 - Dirs to find in
@ -464,8 +482,9 @@ ifneq ($(DISABLE_CACHE_FIND), true)
define CacheFind
$(if $(filter-out $(addsuffix /%,- $(FIND_CACHE_DIRS)) $(FIND_CACHE_DIRS),$1), \
$(shell $(FIND) $1 \( -type f -o -type l \) $2), \
$(filter $(addsuffix %,$1),$(FIND_CACHE)))
$(filter $(addsuffix /%,$(patsubst %/,%,$1)) $1,$(FIND_CACHE)))
endef
else
# If CacheFind is disabled, just run the find command.
# Param 1 - Dirs to find in
@ -477,4 +496,110 @@ endif
################################################################################
define AddFileToCopy
# Helper macro for SetupCopyFiles
# 1 : Source file
# 2 : Dest file
# 3 : Variable to add targets to
# 4 : Macro to call for copy operation
$2: $1
$(ECHO) $(LOG_INFO) Copying $$(patsubst $(OUTPUT_ROOT)/%,%,$$@)
$$($$(strip $4))
$3 += $2
endef
define SetupCopyFiles
# param 1 is for example COPY_MYFILES
# param 2,3,4,5 are named args.
# SRC : Source root dir
# DEST : Dest root dir
# FILES : List of files to copy with absolute paths, or path relative to SRC. Must be in SRC.
# FLATTEN : Set to flatten the directory structure in the DEST dir.
# MACRO : Optionally override the default macro used for making the copy. Default is 'install-file'
$(foreach i,2 3 4 5 6, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
$(call LogSetupMacroEntry,SetupCopyFiles($1),$2,$3,$4,$5,$6)
$(if $(7),$(error Internal makefile error: Too many arguments to SetupCopyFiles))
ifeq ($$($1_MACRO), )
$1_MACRO := install-file
endif
$$(foreach f, $$(patsubst $$($1_SRC)/%,%,$$($1_FILES)), \
$$(eval $$(call AddFileToCopy, $$($1_SRC)/$$f, \
$$($1_DEST)/$$(if $$($1_FLATTEN),$$(notdir $$f),$$f), $1, $$($1_MACRO))))
endef
################################################################################
# Module list macros
ALL_TOP_SRC_DIRS := \
$(JDK_TOPDIR)/src \
$(LANGTOOLS_TOPDIR)/src \
$(CORBA_TOPDIR)/src \
$(JAXP_TOPDIR)/src \
$(JAXWS_TOPDIR)/src \
$(NASHORN_TOPDIR)/src \
#
# There are snmp classes in the open but they are not included in OpenJDK
JAVA_MODULES_FILTER := jdk.snmp
# Find all modules with java sources by looking in the source dirs
define FindJavaModules
$(filter-out $(JAVA_MODULES_FILTER), $(sort $(notdir \
$(patsubst %/,%, $(dir $(patsubst %/,%, $(dir $(patsubst %/,%, $(dir \
$(wildcard $(patsubst %,%/*/share/classes/*, $(ALL_TOP_SRC_DIRS)) \
$(patsubst %,%/*/$(OPENJDK_TARGET_OS_API_DIR)/classes/*, $(ALL_TOP_SRC_DIRS)) \
$(patsubst %,%/*/$(OPENJDK_TARGET_OS)/classes/*, $(ALL_TOP_SRC_DIRS))))))))))))
endef
MODULES_LIST_FILE := $(SRC_ROOT)/make/common/modules.list
# Param 1: Module to find deps for
define FindDepsForModule
$(if $(filter-out java.base, $1), java.base $(filter-out jdk.scripting.nashorn, $(filter-out java.base, $(wordlist 2, 100, $(shell $(GREP) '^$(strip $1):' $(MODULES_LIST_FILE))))))
endef
# Find all modules with source for the target platform.
define FindAllModules
$(sort $(filter-out closed demo sample, $(notdir $(patsubst %/,%, $(dir \
$(wildcard $(patsubst %, %/*/share, $(ALL_TOP_SRC_DIRS)) \
$(patsubst %, %/*/$(OPENJDK_TARGET_OS), $(ALL_TOP_SRC_DIRS)) \
$(patsubst %, %/*/$(OPENJDK_TARGET_OS_API_DIR), $(ALL_TOP_SRC_DIRS))))))))
endef
################################################################################
MAKE_DIR_LIST := $(JDK_TOPDIR)/make
# Find all modules that has a makefile for a certain build phase
# Param 1: Make subdir to look in
# Param 2: File prefix to look for
FindModulesWithMakefileFor = $(sort $(foreach d, $(MAKE_DIR_LIST), \
$(patsubst $d/$(strip $1)/$(strip $2)-%.gmk,%, \
$(wildcard $d/$(strip $1)/$(strip $2)-*.gmk))))
# Declare a recipe for calling such a makefile
# Param 1: Module name
# Param 2: Suffix for rule
# Param 3: Make subdir
# Param 4: Makefile prefix
define DeclareRecipeForModuleMakefile
$$(strip $1)-$$(strip $2):
+($(CD) $$(dir $$(firstword $$(wildcard $$(addsuffix /$$(strip $3)/$$(strip $4)-$$(strip $1).gmk, \
$(MAKE_DIR_LIST))))) \
&& $(MAKE) $(MAKE_ARGS) \
-f $$(strip $4)-$$(strip $1).gmk \
$$(addprefix -I, $$(wildcard $(MAKE_DIR_LIST) \
$$(addsuffix /$$(strip $3), $(MAKE_DIR_LIST)))))
endef
################################################################################
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, , common/MakeBase.gmk))
endif # _MAKEBASE_GMK

View File

@ -27,6 +27,9 @@
# of removing duplicates. It is actually this side effect that is
# desired whenever sort is used below!
ifndef _NATIVE_COMPILATION_GMK
_NATIVE_COMPILATION_GMK := 1
ifeq (,$(_MAKEBASE_GMK))
$(error You must include MakeBase.gmk prior to including NativeCompilation.gmk)
endif
@ -284,7 +287,8 @@ define SetupNativeCompilation
$1_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_SRCS))
endif
ifneq ($$($1_EXCLUDES),)
$1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
$1_SRC_EXCLUDES := $$(addsuffix /%,$$($1_EXCLUDES))
$1_SRC_EXCLUDES += $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
$1_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_SRCS))
endif
@ -549,3 +553,5 @@ define SetupNativeCompilation
endif
endef
endif # _NATIVE_COMPILATION_GMK

88
make/common/SetupJava.gmk Normal file
View File

@ -0,0 +1,88 @@
#
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
ifndef _SETUP_GMK
_SETUP_GMK := 1
include JavaCompilation.gmk
DISABLE_WARNINGS := -Xlint:all,-deprecation,-unchecked,-rawtypes,-cast,-serial,-dep-ann,-static,-fallthrough,-try,-varargs,-empty,-finally
# To build with all warnings enabled, do the following:
# make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000"
JAVAC_WARNINGS := -Xlint:all,-deprecation -Werror
# Any java code executed during a JDK build to build other parts of the JDK must be
# executed by the bootstrap JDK (probably with -Xbootclasspath/p: ) and for this
# purpose must be built with -target PREVIOUS for bootstrapping purposes, which
# requires restricting to language level and api of previous JDK.
#
# The generate old bytecode javac setup uses the new compiler to compile for the
# boot jdk to generate tools that need to be run with the boot jdk.
# Thus we force the target bytecode to the previous JDK version.
$(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \
JVM := $(JAVA_SMALL), \
JAVAC := $(NEW_JAVAC), \
FLAGS := $(BOOT_JDK_SOURCETARGET) -bootclasspath $(BOOT_RTJAR) $(DISABLE_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
# The generate new bytecode javac setup uses the new compiler to compile for the
# new jdk. This new bytecode might only be possible to run using the new jvm.
$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \
JVM := $(JAVA), \
JAVAC := $(NEW_JAVAC), \
FLAGS := -source 9 -target 9 \
-encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS) \
$(GENERATE_JDKBYTECODE_EXTRA_FLAGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
# The generate new bytecode javac setup uses the new compiler to compile for the
# new jdk. This new bytecode might only be possible to run using the new jvm.
$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE_NOWARNINGS, \
JVM := $(JAVA), \
JAVAC := $(NEW_JAVAC), \
FLAGS := -source 9 -target 9 \
-encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS) \
$(GENERATE_JDKBYTECODE_EXTRA_FLAGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
JDK_BOOTCLASSPATH := $(subst $(SPACE),$(PATH_SEP),\
$(filter-out $(JDK_OUTPUTDIR)/modules/_%, $(wildcard $(JDK_OUTPUTDIR)/modules/*)))
# After the jdk is built, we want to build demos using only the recently
# generated jdk classes and nothing else, no jdk source, etc etc.
# I.e. the rt.jar, but since rt.jar has not yet been generated
# (it will be in "make images") therefore we use classes instead.
$(eval $(call SetupJavaCompiler,GENERATE_USINGJDKBYTECODE, \
JVM := $(JAVA_SMALL), \
JAVAC := $(NEW_JAVAC), \
FLAGS := -bootclasspath "$(JDK_BOOTCLASSPATH)" $(DISABLE_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
endif # _SETUP_GMK

54
make/common/modules.list Normal file
View File

@ -0,0 +1,54 @@
java.base:
java.logging: java.base
java.security.sasl: java.logging java.base
java.naming: java.security.sasl java.base
java.security.acl: java.base
jdk.charsets: java.base
java.scripting: java.base
java.xml: java.base
java.sql: java.xml java.logging java.base
jdk.scripting.nashorn: java.scripting java.logging java.base
java.rmi: java.logging java.base
java.prefs: java.xml java.base
java.desktop: jdk.charsets java.prefs java.xml java.logging java.base
java.corba: java.naming java.rmi java.desktop java.logging java.base
java.compiler: java.logging java.base
jdk.compiler: java.compiler java.base
jdk.javadoc: java.compiler java.xml jdk.compiler java.base
jdk.rmic: java.corba jdk.compiler jdk.javadoc java.base
jdk.jvmstat: java.rmi java.base
jdk.attach: jdk.jvmstat java.base
jdk.jcmd: jdk.jvmstat jdk.attach java.base
jdk.jdi: jdk.attach java.base
jdk.hotspot.agent: java.rmi java.scripting java.desktop java.base jdk.jdi
jdk.hprof.agent: java.base
java.management: java.naming java.rmi java.logging java.base
jdk.jconsole: java.management jdk.jvmstat java.rmi jdk.attach java.desktop java.logging java.base
java.activation: java.desktop java.logging java.base
java.xml.bind: java.activation java.compiler java.xml java.desktop java.logging java.base
jdk.xml.bind: java.activation java.compiler java.xml.bind java.xml java.desktop java.logging jdk.compiler java.base
jdk.httpserver: java.logging java.base
java.annotations.common: java.base
java.xml.soap: java.activation java.xml.bind java.xml java.desktop java.logging java.base
java.xml.ws: java.activation java.management jdk.httpserver java.rmi java.annotations.common java.xml.bind java.xml java.desktop java.logging java.xml.soap java.base
jdk.xml.ws: jdk.xml.bind java.compiler java.rmi java.xml.ws java.xml.bind java.xml java.logging java.base
java.sql.rowset: java.naming java.sql java.xml java.logging java.base
java.instrument: java.base
java.security.jgss: java.naming java.security.sasl java.logging java.base
java.xml.crypto: java.xml java.logging java.base
jdk.localedata: java.base
jdk.crypto.ec: java.base
jdk.crypto.pkcs11: jdk.crypto.ec java.base
jdk.crypto.mscapi: java.base
jdk.naming.rmi: java.naming java.rmi java.base
jdk.zipfs: java.base
jdk.naming.dns: java.naming java.base
java.smartcardio: java.base
jdk.dev: jdk.xml.bind jdk.xml.ws java.scripting jdk.rmic java.xml jdk.compiler java.base
jdk.snmp: java.management java.security.acl java.logging java.base
jdk.jdwp.agent: java.base
jdk.security.auth: java.naming java.security.jgss java.base
jdk.sctp: java.base
jdk.runtime: java.desktop java.base
jdk.jfr: java.management java.xml java.base
jdk.deploy.osx: java.scripting java.desktop java.base

View File

@ -1 +1 @@
$(subst com,X01,$(subst org,X02,$(subst sun,X03,$(subst java,X04,$(subst javax,X05,$(subst sun/io,X06,$(subst com/sun,X07,$(subst java/io,X08,$(subst org/omg,X09,$(subst org/w3c,X10,$(subst org/xml,X11,$(subst sun/awt,X12,$(subst sun/net,X13,$(subst sun/nio,X14,$(subst sun/rmi,X15,$(subst java/awt,X16,$(subst java/net,X17,$(subst java/nio,X18,$(subst java/rmi,X19,$(subst META-INF,X20,$(subst sun/font,X21,$(subst sun/misc,X22,$(subst sun/text,X23,$(subst sun/util,X24,$(subst java/lang,X25,$(subst java/math,X26,$(subst java/text,X27,$(subst java/util,X28,$(subst javax/jws,X29,$(subst javax/net,X30,$(subst javax/rmi,X31,$(subst javax/xml,X32,$(subst sun/corba,X33,$(subst sun/print,X34,$(subst sun/swing,X35,$(subst java/beans,X36,$(subst javax/lang,X37,$(subst sun/applet,X38,$(subst sun/java2d,X39,$(subst java/applet,X40,$(subst javax/print,X41,$(subst javax/sound,X42,$(subst javax/swing,X43,$(subst javax/tools,X44,$(subst jdk/classes,X45,$(subst org/relaxng,X46,$(subst sun/reflect,X47,$(subst javax/crypto,X48,$(subst javax/naming,X49,$(subst jaxp/classes,X50,$(subst sun/security,X51,$(subst corba/classes,X52,$(subst java/security,X53,$(subst javax/imageio,X54,$(subst jdk/btclasses,X55,$(subst javax/activity,X56,$(subst javax/security,X57,$(subst jdk/newclasses,X58,$(subst sun/instrument,X59,$(subst sun/management,X60,$(subst corba/btclasses,X61,$(subst jdk/democlasses,X62,$(subst javax/activation,X63,$(subst javax/annotation,X64,$(subst javax/management,X65,$(subst javax/transaction,X66,$(subst jaxws/jaf_classes,X67,$(subst langtools/classes,X68,$(subst META-INF/services,X69,$(subst jdk/newdemoclasses,X70,$(subst javax/accessibility,X71,$(subst jaxws/jaxws_classes,X72,
$(subst share/classes,X01,$(subst internal,X02,$(subst com/sun/org,X03,$(subst java,X04,$(subst javax,X05,$(subst sun/io,X06,$(subst com/sun,X07,$(subst java/io,X08,$(subst org/omg,X09,$(subst org/w3c,X10,$(subst org/xml,X11,$(subst sun/awt,X12,$(subst sun/net,X13,$(subst sun/nio,X14,$(subst sun/rmi,X15,$(subst java/awt,X16,$(subst java/net,X17,$(subst java/nio,X18,$(subst java/rmi,X19,$(subst META-INF,X20,$(subst sun/font,X21,$(subst sun/misc,X22,$(subst sun/text,X23,$(subst sun/util,X24,$(subst java/lang,X25,$(subst java/math,X26,$(subst java/text,X27,$(subst java/util,X28,$(subst javax/jws,X29,$(subst javax/net,X30,$(subst javax/rmi,X31,$(subst javax/xml,X32,$(subst sun/corba,X33,$(subst sun/print,X34,$(subst sun/swing,X35,$(subst java/beans,X36,$(subst javax/lang,X37,$(subst sun/applet,X38,$(subst sun/java2d,X39,$(subst java/applet,X40,$(subst javax/print,X41,$(subst javax/sound,X42,$(subst javax/swing,X43,$(subst javax/tools,X44,$(subst jdk/classes,X45,$(subst org/relaxng,X46,$(subst sun/reflect,X47,$(subst javax/crypto,X48,$(subst javax/naming,X49,$(subst jaxp/classes,X50,$(subst sun/security,X51,$(subst corba/classes,X52,$(subst java/security,X53,$(subst javax/imageio,X54,$(subst jdk/btclasses,X55,$(subst javax/activity,X56,$(subst javax/security,X57,$(subst jdk/newclasses,X58,$(subst sun/instrument,X59,$(subst sun/management,X60,$(subst corba/btclasses,X61,$(subst jdk/democlasses,X62,$(subst javax/activation,X63,$(subst javax/annotation,X64,$(subst javax/management,X65,$(subst javax/transaction,X66,$(subst jaxws/jaf_classes,X67,$(subst langtools/classes,X68,$(subst META-INF/services,X69,$(subst jdk/newdemoclasses,X70,$(subst javax/accessibility,X71,$(subst jaxws/jaxws_classes,X72,

View File

@ -1,6 +1,6 @@
s|X01|com|g
s|X02|org|g
s|X03|sun|g
s|X01|share/classes|g
s|X02|internal|g
s|X03|com/sun/org|g
s|X04|java|g
s|X05|javax|g
s|X06|sun/io|g

View File

@ -79,8 +79,9 @@ jprt.jbb.options=-Djava.awt.headless=true
# Configure args common to all builds
# Also allows for additional, testset specific configure arguments to be set
jprt.build.configure.args= \
--with-boot-jdk=$ALT_BOOTDIR \
--with-jobs=$ALT_PARALLEL_COMPILE_JOBS \
--with-output-sync=recurse \
--with-boot-jdk=$ALT_BOOTDIR \
--with-jobs=$ALT_PARALLEL_COMPILE_JOBS \
${my.additional.build.configure.args.${jprt.test.set}}
# i586 is often cross-compiled from 64-bit machines, so need to set target bits explicitly

1816
modules.xml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,218 @@
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
default: all
include $(SPEC)
include MakeBase.gmk
include JavaCompilation.gmk
THIS_FILE := $(SRC_ROOT)/test/make/TestJavaCompilation.gmk
DEPS := $(THIS_FILE) \
$(SRC_ROOT)/make/common/MakeBase.gmk \
$(SRC_ROOT)/make/common/JavaCompilation.gmk \
#
OUTPUT_DIR := $(TESTMAKE_OUTPUTDIR)/java-compilation
################################################################################
# Test: jar1
# Creates a simple jar file and unzips it to verify that the files have not
# changed.
JAR1_SRC_ROOT := $(OUTPUT_DIR)/jar1src
JAR1_UNZIP := $(OUTPUT_DIR)/jar1unzip
JAR1_FILE := $(OUTPUT_DIR)/jar1.jar
JAR1_MANIFEST := $(OUTPUT_DIR)/jar1_manifest
clean-jar1:
$(RM) -r $(OUTPUT_DIR)/_jar1* $(OUTPUT_DIR)/jar1*
$(OUTPUT_DIR)/_jar1_created: $(DEPS)
$(RM) -r $(JAR1_SRC_ROOT)
$(RM) $(JAR1_FILE)
$(RM) -r $(JAR1_UNZIP)
$(MKDIR) -p $(JAR1_SRC_ROOT)
$(MKDIR) -p $(JAR1_SRC_ROOT)/dir1
$(MKDIR) -p $(JAR1_SRC_ROOT)/dir2
$(MKDIR) -p $(JAR1_SRC_ROOT)/META-INF
$(TOUCH) $(JAR1_SRC_ROOT)/dir1/file1.class
$(TOUCH) $(JAR1_SRC_ROOT)/dir2/file2.class
$(TOUCH) $(JAR1_SRC_ROOT)/META-INF/metafile
$(ECHO) "Test-Attribute: value" > $(JAR1_MANIFEST)
$(TOUCH) $@
$(eval $(call SetupArchive,BUILD_JAR1, \
$(OUTPUT_DIR)/_jar1_created, \
SRCS := $(JAR1_SRC_ROOT), \
MANIFEST := $(JAR1_MANIFEST), \
JAR := $(JAR1_FILE)))
$(OUTPUT_DIR)/_jar1_verified: $(BUILD_JAR1)
$(RM) -r $(JAR1_UNZIP)
$(MKDIR) -p $(JAR1_UNZIP)
$(CD) $(JAR1_UNZIP) && $(UNZIP) $(JAR1_FILE) $(LOG_DEBUG)
$(DIFF) -r $(JAR1_SRC_ROOT)/dir1 $(JAR1_UNZIP)/dir1
$(DIFF) -r $(JAR1_SRC_ROOT)/dir2 $(JAR1_UNZIP)/dir2
$(DIFF) -r $(JAR1_SRC_ROOT)/META-INF/metafile $(JAR1_UNZIP)/META-INF/metafile
if [ "`$(GREP) 'Test-Attribute: value' $(JAR1_MANIFEST)`" = "" ]; then \
$(ECHO) "Could not find Test-Attribute in manifest of $(JAR1_FILE)"; \
exit 1; \
fi
$(TOUCH) $@
create-jar2: $(OUTPUT_DIR)/_jar1_verified
TEST_TARGETS += $(OUTPUT_DIR)/_jar1_verified
# Change a source file and call this makefile again to force the jar to be
# updated.
$(OUTPUT_DIR)_jar1_updated: $(OUTPUT_DIR)/_jar1_verified
$(ECHO) updated > $(JAR1_SRC_ROOT)/dir1/file1.class
$(ECHO) updated > $(JAR1_SRC_ROOT)/META-INF/metafile
$(TOUCH) $(OUTPUT_DIR)/_jar1_created
+$(MAKE) -f $(THIS_FILE) $(OUTPUT_DIR)/_jar1_verified
$(TOUCH) $@
update-jar1: $(OUTPUT_DIR)_jar1_updated
TEST_TARGETS += $(OUTPUT_DIR)_jar1_updated
.PHONY: clean-jar1 create-jar1 update-jar1
################################################################################
# Test: jar2
# Creates a jar file based on 2 source roots
JAR2_SRC_ROOT1 := $(OUTPUT_DIR)/jar2src1
JAR2_SRC_ROOT2 := $(OUTPUT_DIR)/jar2src2
JAR2_UNZIP := $(OUTPUT_DIR)/jar2unzip
JAR2_FILE := $(OUTPUT_DIR)/jar2.jar
clean-jar2:
$(RM) -r $(OUTPUT_DIR)/_jar2* $(OUTPUT_DIR)/jar2*
$(OUTPUT_DIR)/_jar2_created: $(DEPS)
$(RM) -r $(JAR2_SRC_ROOT1)
$(RM) -r $(JAR2_SRC_ROOT2)
$(RM) $(JAR2_FILE)
$(RM) -r $(JAR2_UNZIP)
$(MKDIR) -p $(JAR2_SRC_ROOT1)/dir1
$(MKDIR) -p $(JAR2_SRC_ROOT2)/dir2
$(TOUCH) $(JAR2_SRC_ROOT1)/dir1/file1.class
$(TOUCH) $(JAR2_SRC_ROOT2)/dir2/file2.class
$(TOUCH) $@
$(eval $(call SetupArchive,BUILD_JAR2, \
$(OUTPUT_DIR)/_jar2_created, \
SRCS := $(JAR2_SRC_ROOT1) $(JAR2_SRC_ROOT2), \
JAR := $(JAR2_FILE)))
$(OUTPUT_DIR)/_jar2_verified: $(BUILD_JAR2)
$(RM) -r $(JAR2_UNZIP)
$(MKDIR) -p $(JAR2_UNZIP)
$(CD) $(JAR2_UNZIP) && $(UNZIP) $(JAR2_FILE) $(LOG_DEBUG)
$(DIFF) -r $(JAR2_SRC_ROOT1)/dir1 $(JAR2_UNZIP)/dir1
$(DIFF) -r $(JAR2_SRC_ROOT2)/dir2 $(JAR2_UNZIP)/dir2
$(TOUCH) $@
create-jar2: $(OUTPUT_DIR)/_jar2_verified
TEST_TARGETS += $(OUTPUT_DIR)/_jar2_verified
$(OUTPUT_DIR)_jar2_updated: $(OUTPUT_DIR)/_jar2_verified
$(ECHO) updated > $(JAR2_SRC_ROOT1)/dir1/file1.class
$(TOUCH) $(OUTPUT_DIR)/_jar2_created
+$(MAKE) -f $(THIS_FILE) $(OUTPUT_DIR)/_jar2_verified
$(TOUCH) $@
update-jar2: $(OUTPUT_DIR)_jar2_updated
TEST_TARGETS += $(OUTPUT_DIR)_jar2_updated
.PHONY: clean-jar2 create-jar2 update-jar2
################################################################################
# Test: jar3
# Creates a jar file based on 2 source roots with an extra file
JAR3_SRC_ROOT1 := $(OUTPUT_DIR)/jar3src1
JAR3_SRC_ROOT2 := $(OUTPUT_DIR)/jar3src2
JAR3_UNZIP := $(OUTPUT_DIR)/jar3unzip
JAR3_FILE := $(OUTPUT_DIR)/jar3.jar
clean-jar3:
$(RM) -r $(OUTPUT_DIR)/_jar3* $(OUTPUT_DIR)/jar3*
$(OUTPUT_DIR)/_jar3_created: $(DEPS)
$(RM) -r $(JAR3_SRC_ROOT1)
$(RM) -r $(JAR3_SRC_ROOT2)
$(RM) $(JAR3_FILE)
$(RM) -r $(JAR3_UNZIP)
$(MKDIR) -p $(JAR3_SRC_ROOT1)/dir1
$(MKDIR) -p $(JAR3_SRC_ROOT2)/dir2
$(TOUCH) $(JAR3_SRC_ROOT1)/dir1/file1\$$foo.class
$(TOUCH) $(JAR3_SRC_ROOT2)/dir2/file2.class
$(TOUCH) $(JAR3_SRC_ROOT2)/extra-file
$(TOUCH) $(JAR3_SRC_ROOT2)/extra-file-abs
$(TOUCH) $(JAR3_SRC_ROOT2)/dir2/file\$$foo.dollar
$(TOUCH) $@
$(eval $(call SetupArchive,BUILD_JAR3, \
$(OUTPUT_DIR)/_jar3_created, \
SRCS := $(JAR3_SRC_ROOT1) $(JAR3_SRC_ROOT2), \
EXTRA_FILES := extra-file \
dir2/file$$$$foo.dollar \
$(JAR3_SRC_ROOT2)/extra-file-abs, \
EXCLUDE_FILES := dir1/file1$$$$foo.class, \
JAR := $(JAR3_FILE)))
$(OUTPUT_DIR)/_jar3_verified: $(BUILD_JAR3)
$(RM) -r $(JAR3_UNZIP)
$(MKDIR) -p $(JAR3_UNZIP)
$(CD) $(JAR3_UNZIP) && $(UNZIP) $(JAR3_FILE) $(LOG_DEBUG)
if [ -d "$(JAR3_UNZIP)/dir1" ]; then \
echo Should not be included $(JAR3_UNZIP)/dir1; \
exit 1; \
fi
$(DIFF) -r $(JAR3_SRC_ROOT2)/dir2 $(JAR3_UNZIP)/dir2
$(DIFF) -r $(JAR3_SRC_ROOT2)/extra-file $(JAR3_UNZIP)/extra-file
$(TOUCH) $@
create-jar3: $(OUTPUT_DIR)/_jar3_verified
TEST_TARGETS += $(OUTPUT_DIR)/_jar3_verified
$(OUTPUT_DIR)_jar3_updated: $(OUTPUT_DIR)/_jar3_verified
$(ECHO) updated > $(JAR3_SRC_ROOT2)/extra-file
$(TOUCH) $(OUTPUT_DIR)/_jar3_created
+$(MAKE) -f $(THIS_FILE) $(OUTPUT_DIR)/_jar3_verified
$(TOUCH) $@
update-jar3: $(OUTPUT_DIR)_jar3_updated
TEST_TARGETS += $(OUTPUT_DIR)_jar3_updated
.PHONY: clean-jar3 create-jar3 update-jar3
################################################################################
all: $(TEST_TARGETS)
.PHONY: default all

39
test/make/TestMake.gmk Normal file
View File

@ -0,0 +1,39 @@
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
default: all
include $(SPEC)
make-base:
+$(MAKE) -f TestMakeBase.gmk $(TEST_SUBTARGET)
java-compilation:
+$(MAKE) -f TestJavaCompilation.gmk $(TEST_SUBTARGET)
all: make-base java-compilation
.PHONY: default all make-base java-compilation

View File

@ -0,0 +1,60 @@
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
default: all
include $(SPEC)
include MakeBase.gmk
THIS_FILE := $(SRC_ROOT)/test/make/TestMakeBase.gmk
DEPS := $(THIS_FILE) \
$(SRC_ROOT)/make/common/MakeBase.gmk \
#
OUTPUT_DIR := $(TESTMAKE_OUTPUTDIR)/make-base
################################################################################
# Escape $
ifneq ($(call EscapeDollar, foo$$bar), foo\$$bar)
$(error EscapeDollar failed $(call EscapeDollar, foo$$bar) foo\$$bar)
endif
ESCAPE_DOLLAR_DIR := $(OUTPUT_DIR)/escape-dollar
$(ESCAPE_DOLLAR_DIR)/_escape_dollar: $(DEPS)
$(RM) -r $(@D)
$(MKDIR) -p $(@D)
$(ECHO) foo\$$bar > $(@D)/file1
$(ECHO) $(call EscapeDollar, foo$$bar) > $(@D)/file2
$(ECHO) $(call EscapeDollar, foo\$$bar) > $(@D)/file3
$(DIFF) $(@D)/file1 $(@D)/file2
$(DIFF) $(@D)/file1 $(@D)/file3
$(TOUCH) $@
TEST_TARGETS += $(ESCAPE_DOLLAR_DIR)/_escape_dollar
################################################################################
all: $(TEST_TARGETS)