X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fvimcoder;a=blobdiff_plain;f=Makefile;h=18f8c17a5f5ad32db56b49ba4f813a0e29eaf36b;hp=ea84d09e0eb28f7c3a9994f793096debd08e1f61;hb=c207038cc35932ef12270d1d44f6d3385b998cf4;hpb=7db10c9f0c1c4b358ad1a161a41ea1354a5bcecb diff --git a/Makefile b/Makefile index ea84d09..18f8c17 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,25 @@ -# 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 +version = 0.3.4 -mainclass = src/com/dogcows/VimCoder.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) -all: $(classobj) +all: $(classes) $(resources:src/%=%) clean: - rm -rf META-INF com + rm -rf com distclean: clean rm -rf lib @@ -29,32 +32,25 @@ fetch: $(library) jar: $(jarfile) -classobj = $(mainclass:src/%.java=%.class) +$(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): $(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 +# vim:noet:ts=8