]> Dogcows Code - chaz/vimcoder/blobdiff - Makefile
do not screw up line endings when reading files
[chaz/vimcoder] / Makefile
index ea84d09e0eb28f7c3a9994f793096debd08e1f61..aceb60e3a8f7c9cfbd7c6fa2542bc8638c351f68 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,22 +1,27 @@
 
-# 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.1
+project         = VimCoder
+version         = 0.3.6
 
-mainclass      = src/com/dogcows/VimCoder.java
-library                = lib/ContestApplet.jar
-jarfile                = $(project)-$(version).jar
+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)
+JAVAC           = javac
+JAVACFLAGS      = -d . -sourcepath src -classpath $(library)
 
+PROVE           = prove
 
-all: $(classobj)
+
+all: $(classes) $(resources:src/%=%)
 
 clean:
-       rm -rf META-INF com
+       rm -rf com
 
 distclean: clean
        rm -rf lib
@@ -28,33 +33,29 @@ fetch: $(library)
 
 jar: $(jarfile)
 
+test: all
+       $(PROVE)
+
+
+$(classes): $(sources) | $(library)
+       $(JAVAC) $(JAVACFLAGS) $^
+
+$(resource_path):
+       mkdir -p "$@"
 
-classobj       = $(mainclass:src/%.java=%.class)
+$(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): $(classobj) 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."
-
-$(classobj): $(mainclass)
-       $(JAVAC) $(JAVACFLAGS) $<
-
-META-INF/MANIFEST.MF:
-       mkdir -p META-INF
-       printf "Manifest-Version: 1.0\n\n" >$@
-
+       jar cvf $@ COPYING README.md com
 
-$(mainclass): src/com/dogcows/Util.java src/com/dogcows/Editor.java
-$(classobj): $(library)
 
-.PHONY: all clean distclean dist fetch jar
+.PHONY: all clean distclean dist fetch jar test
 
+# vim:noet:ts=8
This page took 0.02426 seconds and 4 git commands to generate.