From 293ea440feadbd7d5c52b03e991cff3874e574f0 Mon Sep 17 00:00:00 2001 From: "frankm%eng.sun.com" Date: Mon, 14 Jun 1999 21:51:52 +0000 Subject: [PATCH] Add "fast" make target, to compile only changed files. git-svn-id: svn://10.0.0.236/trunk@35196 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/js/rhino/Makefile | 9 +++++++ .../js/rhino/org/mozilla/javascript/Makefile | 24 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/mozilla/js/rhino/Makefile b/mozilla/js/rhino/Makefile index 56dd3c1121b..2177130a36a 100644 --- a/mozilla/js/rhino/Makefile +++ b/mozilla/js/rhino/Makefile @@ -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) \ diff --git a/mozilla/js/rhino/org/mozilla/javascript/Makefile b/mozilla/js/rhino/org/mozilla/javascript/Makefile index 1c20af064b4..fc78f3bd79c 100644 --- a/mozilla/js/rhino/org/mozilla/javascript/Makefile +++ b/mozilla/js/rhino/org/mozilla/javascript/Makefile @@ -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 \