]> Dogcows Code - chaz/vimcoder/blobdiff - Makefile
do not screw up line endings when reading files
[chaz/vimcoder] / Makefile
index e9f4f770df86a8e4a7789b1c47c9cf3fadc9a275..aceb60e3a8f7c9cfbd7c6fa2542bc8638c351f68 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,21 +1,27 @@
 
-project                := VimCoder
-version                := 0.3
+# Use this file with GNU make to compile and package VimCoder.
+# Supported targets: all clean distclean dist fetch jar
 
-mainclass      = bin/com/dogcows/VimCoder.class
-library                = lib/ContestApplet.jar
-jarfile                = $(project)-$(version).jar
+project         = VimCoder
+version         = 0.3.6
 
-JAVAC          := javac
-JAVACFLAGS     := -d bin -sourcepath src -classpath bin:$(library)
+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)
 
-.PHONY: all clean distclean dist fetch jar
+PROVE           = prove
 
-all: $(library) $(mainclass)
+
+all: $(classes) $(resources:src/%=%)
 
 clean:
-       rm -rf bin build
+       rm -rf com
 
 distclean: clean
        rm -rf lib
@@ -25,20 +31,31 @@ dist:
 
 fetch: $(library)
 
-jar: all $(jarfile)
+jar: $(jarfile)
 
+test: all
+       $(PROVE)
 
-$(library):
-       sh make.sh fetch $@
 
-bin/com/dogcows/%.class: src/com/dogcows/%.java
-       mkdir -p bin/com/dogcows/resources &&\
-$(JAVAC) $(JAVACFLAGS) $< &&\
-cp -R src/com/dogcows/resources bin/com/dogcows/
+$(classes): $(sources) | $(library)
+       $(JAVAC) $(JAVACFLAGS) $^
+
+$(resource_path):
+       mkdir -p "$@"
+
+$(resource_path)/%: src/$(resource_path)/% | $(resource_path)
+       cp "$<" "$@"
+
+
+$(library):
+       mkdir -p lib
+       curl -o $@ http://www.topcoder.com/contest/classes/ContestApplet.jar
 
-$(jarfile): $(mainclass)
-       sh make.sh jar $@
+$(jarfile): all
+       rm -f $@
+       jar cvf $@ COPYING README.md com
 
 
-$(mainclass): src/com/dogcows/Util.java src/com/dogcows/Editor.java
+.PHONY: all clean distclean dist fetch jar test
 
+# vim:noet:ts=8
This page took 0.018719 seconds and 4 git commands to generate.