X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fvimcoder;a=blobdiff_plain;f=Makefile;h=aceb60e3a8f7c9cfbd7c6fa2542bc8638c351f68;hp=cb127255a780c50ab06e353eeb2973fdb4541563;hb=HEAD;hpb=fabb7e8d373d2ea2bc6b65b117c9cb0a0a03c114 diff --git a/Makefile b/Makefile index cb12725..aceb60e 100644 --- a/Makefile +++ b/Makefile @@ -2,23 +2,26 @@ # 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 +project = VimCoder +version = 0.3.6 -sources = $(wildcard src/com/dogcows/*.java) -library = lib/ContestApplet.jar -jarfile = $(project)-$(version).jar -resources = $(wildcard src/com/dogcows/resources/*) +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 -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 @@ -30,28 +33,29 @@ fetch: $(library) jar: $(jarfile) +test: all + $(PROVE) + + +$(classes): $(sources) | $(library) + $(JAVAC) $(JAVACFLAGS) $^ + +$(resource_path): + mkdir -p "$@" + +$(resource_path)/%: src/$(resource_path)/% | $(resource_path) + cp "$<" "$@" -$(classes): $(sources) $(library) - $(JAVAC) $(JAVACFLAGS) $< $(library): - @echo "Fetching dependencies..." mkdir -p lib curl -o $@ http://www.topcoder.com/contest/classes/ContestApplet.jar -$(jarfile): $(classes) $(resources) 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." - -META-INF/MANIFEST.MF: - @echo "Generating 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 +.PHONY: all clean distclean dist fetch jar test +# vim:noet:ts=8