0N/A#
239N/A# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A#
0N/A# This code is free software; you can redistribute it and/or modify it
0N/A# under the terms of the GNU General Public License version 2 only, as
157N/A# published by the Free Software Foundation. Oracle designates this
0N/A# particular file as subject to the "Classpath" exception as provided
157N/A# by Oracle in the LICENSE file that accompanied this code.
0N/A#
0N/A# This code is distributed in the hope that it will be useful, but WITHOUT
0N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A# version 2 for more details (a copy is included in the LICENSE file that
0N/A# accompanied this code).
0N/A#
0N/A# You should have received a copy of the GNU General Public License version
0N/A# 2 along with this work; if not, write to the Free Software Foundation,
0N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A#
157N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
157N/A# or visit www.oracle.com if you need additional information or have any
157N/A# questions.
0N/A#
0N/A
0N/A#
0N/A#
0N/A# Rules shared by all Java makefiles.
0N/A#
113N/A
0N/A# Make sure the default rule is all
0N/Arules_default_rule: all
0N/A
0N/A#
0N/A# Directory set up. (Needed by deploy workspace)
0N/A#
193N/A$(CLASSDESTDIR) $(OUTPUTDIR) $(TEMPDIR) $(EXTDIR):
0N/A $(MKDIR) -p $@
0N/A
0N/A#
0N/A# All source tree areas for java/properties files
0N/A#
0N/AALL_CLASSES_SRC = $(SHARE_SRC)/classes $(PLATFORM_SRC)/classes
0N/A
0N/A#
0N/A# If AUTO_FILES_PROPERTIES_DIRS used, automatically find properties files
0N/A#
0N/Aifdef AUTO_FILES_PROPERTIES_DIRS
117N/A AUTO_FILES_PROPERTIES_FILTERS1 = $(SCM_DIRs) 'X-*' '*-X-*' ',*'
117N/A AUTO_FILES_PROPERTIES_FILTERS1 += $(AUTO_PROPERTIES_PRUNE)
117N/A FILES_properties_find_filters1 = $(AUTO_FILES_PROPERTIES_FILTERS1:%=-name % -prune -o)
117N/A FILES_properties_auto1 := \
117N/A $(shell \
117N/A for dir in $(ALL_CLASSES_SRC) ; do \
117N/A if [ -d $$dir ] ; then \
117N/A ( $(CD) $$dir; \
117N/A for sdir in $(AUTO_FILES_PROPERTIES_DIRS); do \
117N/A if [ -d $$sdir ] ; then \
117N/A $(FIND) $$sdir $(FILES_properties_find_filters1) \
117N/A -name '*.properties' -print ; \
117N/A fi ; \
117N/A done \
117N/A ); \
117N/A fi; \
117N/A done \
117N/A )
0N/Aelse
0N/A FILES_properties_auto1 =
0N/Aendif # AUTO_FILES_PROPERTIES_DIRS
0N/A
0N/A# Add any automatically found properties files to the properties file list
0N/AFILES_properties += $(FILES_properties_auto1)
0N/A
0N/A#
0N/A# Get Resources help
0N/A#
0N/Ainclude $(TOPDIR)/make/common/internal/Resources.gmk
0N/A
0N/A#
0N/A# Compiling .java files.
0N/A#
0N/A
0N/A#
0N/A# Automatically add to FILES_java if AUTO_FILES_JAVA_DIRS is defined
0N/A#
0N/A# There are two basic types of sources, normal source files and the
0N/A# generated ones. The Normal sources will be located in:
0N/A# $(ALL_CLASSES_SRC)
0N/A# The generated sources, which might show up late to dinner, are at:
0N/A# $(GENSRCDIR)
0N/A# and since they could be generated late, we need to be careful that
0N/A# we look for these sources late and not use the ':=' assignment which
0N/A# might miss their generation.
0N/A
0N/Aifdef AUTO_FILES_JAVA_DIRS
117N/A # Filter out these files or directories
117N/A AUTO_FILES_JAVA_SOURCE_FILTERS1 = $(SCM_DIRs) 'X-*' '*-X-*' '*-template.java' ',*'
117N/A AUTO_FILES_JAVA_SOURCE_FILTERS2 =
117N/A AUTO_FILES_JAVA_SOURCE_FILTERS1 += $(AUTO_JAVA_PRUNE)
117N/A AUTO_FILES_JAVA_SOURCE_FILTERS2 += $(AUTO_JAVA_PRUNE)
0N/A
117N/A # First list is the normal sources that should always be there,
117N/A # by using the ':=', which means we do this processing once.
117N/A FILES_java_find_filters1 = $(AUTO_FILES_JAVA_SOURCE_FILTERS1:%=-name % -prune -o)
117N/A FILES_java_auto1 := \
117N/A $(shell \
117N/A for dir in $(ALL_CLASSES_SRC) ; do \
117N/A if [ -d $$dir ] ; then \
117N/A ( $(CD) $$dir; \
117N/A for sdir in $(AUTO_FILES_JAVA_DIRS); do \
117N/A if [ -d $$sdir ] ; then \
117N/A $(FIND) $$sdir $(FILES_java_find_filters1) \
117N/A -name '*.java' -print ; \
117N/A fi ; \
117N/A done \
117N/A ); \
117N/A fi; \
117N/A done \
117N/A )
0N/A # Second list is the generated sources that should be rare, but will likely
0N/A # show up late and we need to look for them at the last minute, so we
0N/A # cannot use the ':=' assigment here. But if this gets expanded multiple
0N/A # times, the if tests should make them relatively cheap.
117N/A FILES_java_find_filters2 = $(AUTO_FILES_JAVA_SOURCE_FILTERS2:%=-name % -prune -o)
117N/A FILES_java_auto2 = \
117N/A $(shell \
117N/A for dir in $(GENSRCDIR); do \
117N/A if [ -d $$dir ] ; then \
117N/A ( $(CD) $$dir; \
117N/A for sdir in $(AUTO_FILES_JAVA_DIRS); do \
117N/A if [ -d $$sdir ] ; then \
117N/A $(FIND) $$sdir $(FILES_java_find_filters2) \
117N/A -name '*.java' -print ; \
117N/A fi ; \
117N/A done \
117N/A ); \
117N/A fi; \
117N/A done \
117N/A )
0N/Aelse
0N/A FILES_java_auto1 =
0N/A FILES_java_auto2 =
0N/Aendif
0N/A
0N/A# Add all found java sources to FILES_java macro (if AUTO_FILES_JAVA_DIRS used)
0N/AFILES_java += $(FILES_java_auto1) $(FILES_java_auto2)
0N/A
0N/A# File that will hold java source names that need compiling
0N/AJAVA_SOURCE_LIST=$(TEMPDIR)/.classes.list
0N/A
0N/A# Add a java source to the list
0N/Adefine add-java-file
0N/A$(ECHO) "$?" >> $(JAVA_SOURCE_LIST)
0N/Aendef
0N/A
0N/A$(CLASSDESTDIR)/%.class: $(GENSRCDIR)/%.java
0N/A @$(add-java-file)
0N/A$(CLASSDESTDIR)/%.class: $(PLATFORM_SRC)/classes/%.java
0N/A @$(add-java-file)
0N/A$(CLASSDESTDIR)/%.class: $(SHARE_SRC)/classes/%.java
0N/A @$(add-java-file)
0N/A
0N/A# List of class files needed
0N/AFILES_class = $(FILES_java:%.java=$(CLASSDESTDIR)/%.class)
0N/A
0N/A# Construct list of java sources we need to compile
0N/Asource_list_prime:
0N/A @$(MKDIR) -p $(TEMPDIR)
0N/A# Note that we slip resources in so that compiled properties files get created:
0N/A$(JAVA_SOURCE_LIST) : source_list_prime resources $(FILES_class)
0N/A @$(TOUCH) $@
0N/A
0N/A.delete.classlist:
0N/A @$(RM) $(JAVA_SOURCE_LIST)
0N/A
0N/A# Make sure all newer sources are compiled (in a batch)
0N/Aclasses : $(CLASSES_INIT) .delete.classlist .compile.classlist
0N/A
55N/A# Use this javac option to force it to favor the sourcepath file classes
55N/A# rather than any bootclasspath classes.
55N/AJAVAC_PREFER_SOURCE = -Xprefer:source
55N/A
0N/A.compile.classlist : $(JAVA_SOURCE_LIST)
0N/A @$(MKDIR) -p $(CLASSDESTDIR)
113N/A if [ -s $(JAVA_SOURCE_LIST) ] ; then \
117N/A $(CAT) $(JAVA_SOURCE_LIST); \
55N/A $(JAVAC_CMD) $(JAVAC_PREFER_SOURCE) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$(JAVA_SOURCE_LIST); \
0N/A fi
0N/A @$(java-vm-cleanup)
0N/A
0N/Aclobber clean::
0N/A $(RM) $(JAVA_SOURCE_LIST)
0N/A
0N/Aifndef DONT_CLOBBER_CLASSES
0N/A ifndef PACKAGE
0N/A DONT_CLOBBER_CLASSES = true
0N/A else
0N/A DONT_CLOBBER_CLASSES = false
0N/A endif
0N/Aendif
0N/A
0N/Apackages.clean:
0N/Aifeq ($(DONT_CLOBBER_CLASSES),false)
0N/A ifdef AUTO_FILES_JAVA_DIRS
113N/A $(RM) -r $(patsubst %, $(CLASSDESTDIR)/%, $(AUTO_FILES_JAVA_DIRS))
0N/A else
0N/A $(RM) -r $(CLASSDESTDIR)/$(PKGDIR)
0N/A endif
0N/Aendif
0N/A
0N/Aclasses.clean: packages.clean
0N/A $(RM) $(JAVA_SOURCE_LIST)
0N/A
193N/Aclean clobber:: classes.clean .delete.classlist
0N/A
0N/A#
0N/A# Default dependencies
0N/A#
0N/A
0N/Aall: build
0N/A
193N/Abuild: classes
0N/A
0N/Adefault: all
0N/A
0N/A.PHONY: all build clean clobber \
0N/A .delete.classlist classes .compile.classlist classes.clean \
0N/A batch_compile
0N/A