-# Use this file with ``make'' to compile and package VimCoder.
+# Use this file with GNU make to compile and package VimCoder.
# Supported targets: all clean distclean dist fetch jar
project = VimCoder
-version = 0.3.2
+version = 0.3.5
-sources = src/com/dogcows/VimCoder.java src/com/dogcows/Util.java src/com/dogcows/Editor.java
+sources = $(wildcard src/com/dogcows/*.java)
+classes = $(sources:src/%.java=%.class)
library = lib/ContestApplet.jar
jarfile = $(project)-$(version).jar
+resource_path = com/dogcows/resources
+resources = $(wildcard src/$(resource_path)/*)
JAVAC = javac
JAVACFLAGS = -d . -sourcepath src -classpath $(library)
-classes = $(sources:src/%.java=%.class)
-all: $(firstword $(classes))
+all: $(classes) $(resources:src/%=%)
clean:
- rm -rf META-INF com
+ rm -rf com
distclean: clean
rm -rf lib
jar: $(jarfile)
+$(classes): $(sources) | $(library)
+ $(JAVAC) $(JAVACFLAGS) $^
+
+$(resource_path):
+ mkdir -p "$@"
+
+$(resource_path)/%: src/$(resource_path)/% | $(resource_path)
+ cp "$<" "$@"
+
+
$(library):
- @echo "Fetching dependencies..."
mkdir -p lib
curl -o $@ http://www.topcoder.com/contest/classes/ContestApplet.jar
-$(jarfile): $(firstword $(classes)) META-INF/MANIFEST.MF
- @echo "Packaging jar file..."
- mkdir -p com/dogcows/resources
- cp src/com/dogcows/resources/* com/dogcows/resources
+$(jarfile): all
rm -f $@
- zip $@ META-INF/MANIFEST.MF COPYING README $$(find com -type f | sort)
- @echo "Done."
-
-$(classes): $(sources) $(library)
- $(JAVAC) $(JAVACFLAGS) $<
-
-META-INF/MANIFEST.MF:
- mkdir -p META-INF
- printf "Manifest-Version: 1.0\n\n" >$@
+ jar cvf $@ COPYING README.md com
.PHONY: all clean distclean dist fetch jar
+# vim:noet:ts=8