Source

placebohttp / Makefile

Full commit
# Makefile for Openstatic.org Placebo HTTP Server
# Please note: I Chose make over ant because of gcj

# Configuration Options
JC=gcj
JAVAC=javac
CLASS_PATH=build:src
JAR=jar
JC_FLAGS=-d build

# Where to begin....
all: placebohttp

# Mac
osx: jvm
	cp -R res/osx_app/PlaceboHTTP/ ./PlaceboHTTP.app/
	mkdir PlaceboHTTP.app/Contents/Resources/placebo/
	cp res/osx_app/core.sh PlaceboHTTP.app/Contents/Resources/placebo/
	cp placebohttp.jar PlaceboHTTP.app/Contents/Resources/placebo/

# Generate Documentation
docs: placebohttp.jar
	javadoc -d doc -sourcepath src org.openstatic.placebo org.openstatic.http org.openstatic.util

# Alternate build using the java vm
jvm:
	mkdir jvm-build
	$(JAVAC) src/*.java src/org/json/*.java src/org/openstatic/http/*.java src/org/openstatic/util/*.java src/org/openstatic/placebo/*.java src/org/openstatic/placebo/plugins/*.java -d jvm-build
	$(JAR) -cvmf res/manifest.mf placebohttp.jar -C jvm-build org -C jvm-build PlaceboBase.class www LICENSE

# Executable Rule for GCJ
# -------------------------------------------------------------------------------

placebohttp: placebohttp.jar
	$(JC) $^ -O2 -fuse-boehm-gc --classpath=placebohttp.jar --main=PlaceboBase -o $@

# Here are all the classes for the project
# -------------------------------------------------------------------------------

build/PlaceboBase.class: src/PlaceboBase.java
	$(JC) $(JC_FLAGS) --classpath=$(CLASS_PATH) -C $<

build/org/openstatic/http/PlaceboHttpServer.class: src/org/openstatic/http/PlaceboHttpServer.java
	$(JC) $(JC_FLAGS) --classpath=$(CLASS_PATH) -C $<

build/org/openstatic/http/PlaceboSession.class: src/org/openstatic/http/PlaceboSession.java
	$(JC) $(JC_FLAGS) --classpath=$(CLASS_PATH) -C $<

build/org/openstatic/http/HttpRequest.class: src/org/openstatic/http/HttpRequest.java
	$(JC) $(JC_FLAGS) --classpath=$(CLASS_PATH) -C $<

build/org/openstatic/http/HttpResponse.class: src/org/openstatic/http/HttpResponse.java
	$(JC) $(JC_FLAGS) --classpath=$(CLASS_PATH) -C $<

build/org/openstatic/http/HttpRequestThread.class: src/org/openstatic/http/HttpRequestThread.java
	$(JC) $(JC_FLAGS) --classpath=$(CLASS_PATH) -C $<

build/org/openstatic/placebo/ControlPanel.class: src/org/openstatic/placebo/ControlPanel.java
	$(JC) $(JC_FLAGS) --classpath=$(CLASS_PATH) -C $<

build/org/openstatic/placebo/PlaceboPlugin.class: src/org/openstatic/placebo/PlaceboPlugin.java
	$(JC) $(JC_FLAGS) --classpath=$(CLASS_PATH) -C $<

build/org/openstatic/placebo/plugins/Clock.class: src/org/openstatic/placebo/plugins/Clock.java
	$(JC) $(JC_FLAGS) --classpath=$(CLASS_PATH) -C $<

build/org/openstatic/placebo/plugins/KeyStore.class: src/org/openstatic/placebo/plugins/KeyStore.java
	$(JC) $(JC_FLAGS) --classpath=$(CLASS_PATH) -C $<

build/org/openstatic/placebo/CoreServer.class: src/org/openstatic/placebo/CoreServer.java
	$(JC) $(JC_FLAGS) --classpath=$(CLASS_PATH) -C $<

build/org/openstatic/util/JTextAreaOutputStream.class: src/org/openstatic/util/JTextAreaOutputStream.java
	$(JC) $(JC_FLAGS) --classpath=$(CLASS_PATH) -C $<

build/org/openstatic/util/PlaceboLogger.class: src/org/openstatic/util/PlaceboLogger.java
	$(JC) $(JC_FLAGS) --classpath=$(CLASS_PATH) -C $<

build/org/openstatic/util/JSONUtil.class: src/org/openstatic/util/JSONUtil.java build/org/json/JSONObject.class build/org/json/JSONArray.class
	$(JC) $(JC_FLAGS) --classpath=$(CLASS_PATH) -C $<

# Org.JSON

build/org/json/JSONArray.class: src/org/json/JSONArray.java build/org/json/JSONObject.class
	$(JC) $(JC_FLAGS) -w --classpath=$(CLASS_PATH) -C $<

build/org/json/JSONException.class: src/org/json/JSONException.java
	$(JC) $(JC_FLAGS) -w --classpath=$(CLASS_PATH) -C $<

build/org/json/JSONObject.class: src/org/json/JSONObject.java build/org/json/JSONException.class build/org/json/JSONTokener.class build/org/json/JSONString.class
	$(JC) $(JC_FLAGS) -w --classpath=$(CLASS_PATH) -C $<

build/org/json/JSONString.class: src/org/json/JSONString.java
	$(JC) $(JC_FLAGS) -w --classpath=$(CLASS_PATH) -C $<

build/org/json/JSONStringer.class: src/org/json/JSONStringer.java
	$(JC) $(JC_FLAGS) -w --classpath=$(CLASS_PATH) -C $<

build/org/json/JSONTokener.class: src/org/json/JSONTokener.java build/org/json/JSONException.class
	$(JC) $(JC_FLAGS) -w --classpath=$(CLASS_PATH) -C $<

build/org/json/JSONWriter.class: src/org/json/JSONWriter.java build/org/json/JSONObject.class
	$(JC) $(JC_FLAGS) -w --classpath=$(CLASS_PATH) -C $<


# Main Builds
# -------------------------------------------------------------------------------

placebohttp.jar: build/org/openstatic/http/PlaceboHttpServer.class build/org/openstatic/http/PlaceboSession.class build/org/openstatic/http/HttpRequest.class build/org/openstatic/http/HttpRequestThread.class build/org/openstatic/http/HttpResponse.class build/PlaceboBase.class build/org/openstatic/placebo/ControlPanel.class build/org/openstatic/placebo/CoreServer.class build/org/openstatic/util/JTextAreaOutputStream.class build/org/openstatic/util/JSONUtil.class build/org/openstatic/util/PlaceboLogger.class build/org/openstatic/placebo/PlaceboPlugin.class build/org/openstatic/placebo/plugins/Clock.class build/org/openstatic/placebo/plugins/KeyStore.class
	$(JAR) -cvmf res/manifest.mf $@ -C build org -C build PlaceboBase.class www LICENSE

clean:
	rm -fR jvm-build
	rm -fR build
	rm -fR doc
	rm -f placebohttp
	rm -f placebohttp.jar
	rm -fR PlaceboHTTP.app
	rm -f *~