#
# @(#)GNUmakefile	1.8 98/08/19
#
# Makefile for building javac. First build javac with the bootstrap
# compiler. Then rebuild everything that might have been compiled with
# a bootstrap compiler with the current compiler.
#

BUILDDIR = ../..
PRODUCT = sun
PACKAGE = sun.tools.javac
PROGRAM = javac
include $(BUILDDIR)/Platform.gmk
include $(BUILDDIR)/makefiles/Defs.gmk

#
# Files to compile.
#
include $(MINCLUDES)sun_javac.jmk

#
# Rules.
#
JAVA_ARGS = "{ \"-J-ms8m\", \"sun.tools.javac.Main\" }"
include $(BUILDDIR)/makefiles/Program.gmk

#
# Resources (must be made before .recompile).
#
RESOURCE_DEST_DIR = $(CLASSBINDIR)/sun/tools/javac/resources
RESOURCE_FILES    = javac.properties javac_ja.properties
RESOURCE_SRC_DIR  = $(SHARE_SRC)/classes/sun/tools/javac/resources
include $(BUILDDIR)/makefiles/Resources.gmk

#
# Extra dependencies.
#
OPTIMIZED += .recompile
DEBUG     += .recompile

clean:: .recompile.clean
	$(RM) -r $(CLASSBINDIR)/sun/tools/java $(CLASSBINDIR)/sun/tools/asm \
		 $(CLASSBINDIR)/sun/tools/tree

#
# We still haven't bootstrapped. This override must be done at this
# point -- we must be sure that any indirect inclusion of Defs.gmk
# doesn't interfere with this.
#
JAVAC_CMD = $(JAVAC_BOOT_CMD)

#
# Re-compile .java files compiled with BOOT_CMD with the current
# compiler in the workspace. So we always ship .class files generated
# by the latest compiler.
#
.recompile .recompile.clean:
	@echo ">>>Recursively making "$@" @ `date` ..."; \
	cd recompile; $(MAKE) RELEASE=$(RELEASE) FULL_VERSION=$(FULL_VERSION) $@\
        || exit 1; cd ..; \
	echo "<<<Finished Recursively making "$@" @ `date`." ; \

.PHONY: .recompile .recompile.clean
