Add "fast" make target, to compile only changed files.

This commit is contained in:
frankm%eng.sun.com 1999-06-14 21:51:52 +00:00
Родитель 29c1034ee4
Коммит 33b9d6533a
2 изменённых файлов: 33 добавлений и 0 удалений

Просмотреть файл

@ -74,6 +74,7 @@ helpmessage : FORCE
@echo 'Targets include:'
@echo '\tall - make jars, examples'
@echo '\tjars - make js.jar, jstools.jar'
@echo '\tfast - quick-and-dirty "make jars", for development'
@echo '\texamples - build the .class files in the examples directory'
@echo '\tcheck - perform checks on the source.'
@echo '\tclean - remove intermediate files'
@ -87,12 +88,20 @@ all : jars examples
jars : $(JARS)
fast : fast_$(JS_JAR) $(JSTOOLS_JAR)
# Always call the sub-Makefile - which may decide that the jar is up to date.
$(JS_JAR) : FORCE
$(MAKE) -f $(JS_DIR)/Makefile JAR=$(@) $(EXPORTS) \
PATH_PREFIX=$(JS_DIR) \
CLASSPATH=.
fast_$(JS_JAR) :
$(MAKE) -f $(JS_DIR)/Makefile JAR=$(JS_JAR) $(EXPORTS) \
PATH_PREFIX=$(JS_DIR) \
CLASSPATH=. \
fast
$(JSTOOLS_JAR) : $(JS_JAR) $(JSDEBUG_JAR) FORCE
$(MAKE) -f $(JSTOOLS_DIR)/Makefile JAR=$(@) $(EXPORTS) \
PATH_PREFIX=$(JSTOOLS_DIR) \

Просмотреть файл

@ -115,6 +115,10 @@ CLASSES = $(PATH_PREFIX)/*.class $(PATH_PREFIX)/regexp/*.class
# same thing with RESOURCES.)
TLCLASS = $(CLASSDIR)/$(PATH_PREFIX)/*.class
# An empty file, used mainly for timestamp/dependency purposes by
# "fast" builds
FASTTARGET=$(CLASSDIR)/.lastbuild
$(JAR) : $(TLCLASS) $(CLASSDIR)/$(RESOURCES)
cd $(CLASSDIR) ; \
@ -122,12 +126,32 @@ $(JAR) : $(TLCLASS) $(CLASSDIR)/$(RESOURCES)
$(TLCLASS) : $(SOURCES)
- mkdir -p $(CLASSDIR)
echo "" > $(FASTTARGET)
$(JAVAC) $(JFLAGS) -d $(CLASSDIR) $(SOURCES)
$(CLASSDIR)/$(RESOURCES) : $(RESOURCES)
- mkdir -p $(CLASSDIR)/$(RESOURCEDIR)
cp $(RESOURCES) $(CLASSDIR)/$(RESOURCEDIR)
# Since the jar file is a target for regular builds, "fast" builds use a
# dummy file, updated before each compilation to provide a timestamp.
# Even so, using a dummy file is far from foolproof, so we still need
# the regular build.
fast: $(FASTTARGET)
# So that we recompile only the files that have changed, we pretend
# the only real dependencies are the source files, and recopy the
# resources every time. Right now (14 Jun 99), the only resource is
# Messages.properties, so it's a small price to pay.
$(FASTTARGET) : $(SOURCES)
- mkdir -p $(CLASSDIR)/$(RESOURCEDIR)
cp $(RESOURCES) $(CLASSDIR)/$(RESOURCEDIR)
echo "" > $(FASTTARGET)
$(JAVAC) $(JFLAGS) -d $(CLASSDIR) $(?)
cd $(CLASSDIR) ; \
jar cf ../$(JAR) $(CLASSES) $(RESOURCES)
clean :
- cd $(CLASSDIR) && rm $(CLASSES) $(RESOURCES)
- rm $(PATH_PREFIX)/message.ids \