From 7db10c9f0c1c4b358ad1a161a41ea1354a5bcecb Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Thu, 23 Jun 2011 11:55:19 -0600 Subject: [PATCH] cleaned up build system --- Makefile | 50 +++++++++++++++++++++++++++++++++----------------- make.sh | 30 ------------------------------ 2 files changed, 33 insertions(+), 47 deletions(-) delete mode 100755 make.sh diff --git a/Makefile b/Makefile index 8442eec..ea84d09 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,22 @@ -project := VimCoder -version := 0.3.1 +# Use this file with ``make'' to compile and package VimCoder. +# Supported targets: all clean distclean dist fetch jar -mainclass = bin/com/dogcows/VimCoder.class +project = VimCoder +version = 0.3.1 + +mainclass = src/com/dogcows/VimCoder.java library = lib/ContestApplet.jar jarfile = $(project)-$(version).jar -JAVAC := javac -JAVACFLAGS := -d bin -sourcepath src -classpath bin:$(library) - +JAVAC = javac +JAVACFLAGS = -d . -sourcepath src -classpath $(library) -.PHONY: all clean distclean dist fetch jar -all: $(library) $(mainclass) +all: $(classobj) clean: - rm -rf bin build + rm -rf META-INF com distclean: clean rm -rf lib @@ -25,20 +26,35 @@ dist: fetch: $(library) -jar: all $(jarfile) +jar: $(jarfile) + + +classobj = $(mainclass:src/%.java=%.class) $(library): - sh make.sh fetch $@ + @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 + rm -f $@ + zip $@ META-INF/MANIFEST.MF COPYING README $$(find com -type f | sort) + @echo "Done." -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/ +$(classobj): $(mainclass) + $(JAVAC) $(JAVACFLAGS) $< -$(jarfile): $(mainclass) - sh make.sh jar $@ +META-INF/MANIFEST.MF: + mkdir -p META-INF + printf "Manifest-Version: 1.0\n\n" >$@ $(mainclass): src/com/dogcows/Util.java src/com/dogcows/Editor.java +$(classobj): $(library) + +.PHONY: all clean distclean dist fetch jar diff --git a/make.sh b/make.sh deleted file mode 100755 index 0bb3d82..0000000 --- a/make.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -action=$1 -shift - -case "$action" -in - - fetch) - echo "Fetching dependencies..." - mkdir -p lib - curl -o $1 http://www.topcoder.com/contest/classes/ContestApplet.jar - ;; - - jar) - echo "Packaging jar file..." - rm -rf build - mkdir -p build/META-INF - printf "Manifest-Version: 1.0\n\n" >build/META-INF/MANIFEST.MF - cp -R bin/com COPYING README build/ - cd build - files=$(find com -type f | sort) - zip $1 META-INF/MANIFEST.MF README COPYING $files - cd .. - mv build/$1 . - rm -rf build - echo "Done." - ;; -esac - -- 2.45.2