# This Makefile is just really a conveniance.  I find myself grepping
# in this directory so much, on the command line, that it's driving me
# nuts to move up and back from the main Makefile above.
#
# Normally, this Makefile is not used.  It just forwards some select
# targets back to the root, above.

JWILLETTS_TARGET := jwillett
#JWILLETTS_TARGET := sprint_qcif
#JWILLETTS_TARGET := sprint_qvga_large
#JWILLETTS_TARGET := tmo_qcif_wide
#JWILLETTS_TARGET := sprint_subqcif
#JWILLETTS_TARGET := att_qcif_lowheap
#JWILLETTS_TARGET := att_qcif_lowheap_connected

# Enough to stress, only play some MIDIs but not all:
#
#JWILLETTS_HEAP   += 700000
JWILLETTS_HEAP   += 1000000

#JWILLETTS_TARGET := att_subqcif
#JWILLETTS_HEAP   += 275000

#JWILLETTS_TARGET := att_128h
#JWILLETTS_HEAP   := 614400

JWILLETTS_ARGS   += -Dtarget=$(JWILLETTS_TARGET)
JWILLETTS_ARGS   += -Dotadest=jwillett
JWILLETTS_ARGS   += -Demulation.debug.heapsize=$(JWILLETTS_HEAP)
JWILLETTS_ARGS   += -Demulation.run.heapsize=$(JWILLETTS_HEAP)

PASS_THROUGH_ANT_COMMANDS := build qa_build run run_only
.PHONY: $(PASS_THROUGH_ANT_COMMANDS)
$(PASS_THROUGH_ANT_COMMANDS): cl
#	cd ..; rm -rf temp final; ant $@ $(JWILLETTS_ARGS)
	cd ..; ant $@ $(JWILLETTS_ARGS)

.PHONY: run2
run2: build
	cd ..; ant $(JWILLETTS_ARGS) run_only & ant $(JWILLETTS_ARGS) run_only

.PHONY: upload
#upload: build
upload:
	cd ..; ant $(JWILLETTS_ARGS) upload_sprint_signed

# These targets all forward to the "parent" Makefile:
PASS_THROUGH_COMMANDS :=
PASS_THROUGH_COMMANDS += watchjcis 
PASS_THROUGH_COMMANDS += areyou
.PHONY: $(PASS_THROUGH_COMMANDS)
$(PASS_THROUGH_COMMANDS): cl
	cd ..; $(MAKE) $@

# "make cl" is not the same as the global one: this one just grooms
# the directory, eliminating temp files and other cruft from the
# editor so my "ls" and "grep" commands can be cleaner.
.PHONY: cl
cl:
	rm -f *~
	rm -f \#*\#
	chmod -xxx *.java Makefile
	chmod 644 *.java Makefile
	chown $(USERNAME).None *.java Makefile

.PHONY: friggin-antenna
friggin-antenna:
	$(MAKE) -D ~/antenna-src-1.0.2 push-it

PG_JIKES += jikes
PG_JIKES += -sourcepath src 
PG_JIKES += -d classes
PG_JIKES += -cp c:/jdk1.6.0_07/jre/lib/rt.jar
.PHONY: friggin-proguard
friggin-proguard:
	cd ~/proguard4.2;
	cd ~/proguard4.2; \
	  ls -l
	cd ~/proguard4.2; \
	  mkdir -p classes
	cd ~/proguard4.2; \
	  $(PG_JIKES) src/proguard/ProGuard.java 
	cd ~/proguard4.2; \
	  $(PG_JIKES) src/proguard/retrace/ReTrace.java 
	cd ~/proguard4.2; \
	  $(PG_JIKES) src/proguard/gui/ProGuardGUI.java 
	cd ~/proguard4.2; \
	  $(PG_JIKES) -classpath lib/ant.jar src/proguard/ant/ProGuardTask.java
	cd ~/proguard4.2; \
	  $(PG_JIKES) -classpath wtklib/kenv.zip \
	    src/proguard/wtk/ProGuardObfuscator.java
	find ~/proguard4.2/classes | more
#	cd ~/proguard4.2; \
#	  cp ~/proguard4.2/dist/antenna-bin-1.0.2.jar \
#	     ~/guitarhero4/ant-script/lib/proguard.jar
