# Makefile for Prescribble
#
# (Adapted by Kent Dahl from makefile by Bill Kendrick)

SRC=./src/
TMP=./tmp/


PROJECT=prescribble

all:	host mips

host/Makefile : src/Makefile
	cp src/Makefile host/Makefile

vr3/Makefile : src/Makefile
	cp src/Makefile vr3/Makefile



host:	host/Makefile
	make -C./host/
	cp host/$(PROJECT) ./$(PROJECT).host


mips:	vr3/Makefile
	make -C./vr3/
	cp vr3/$(PROJECT) ./$(PROJECT).mips
	mipsel-linux-strip ./$(PROJECT).mips


CLEAN_FOR_DIST = host/$(PROJECT) vr3/$(PROJECT) \
	 host/*.o vr3/*.o \
	 src/*~ \
	 host/*.dat   host/core \
	 $(PROJECT).host ../$(PROJECT).tar.gz

CLEAN_ALL = $(CLEAN_FOR_DIST) $(PROJECT).mips

clean:
	-rm $(CLEAN_ALL)

distrib: $(PROJECT).mips 
	-rm $(CLEAN_FOR_DIST)
	echo `date +%Y%m%d_%H%M` $$USER > doc/creationtime
	tar cf ../$(PROJECT).tar -C../ $(PROJECT)/
	gzip ../$(PROJECT).tar

rsync :
	echo Trying to rsync using "agenda" as IP
	rsync -z $(PROJECT).mips agenda::vr3/local/bin/$(PROJECT)

install : rsync $(PROJECT).xpm
	echo Pixmap goes to /flash/local/pixmaps/ which needs to exist
	rsync -z $(PROJECT).xpm agenda::vr3/local/pixmaps/

$(PROJECT).mips :
	make mips


#$(PROJECT).host $(PROJECT).mips \
#	 host/$(PROJECT) vr3/$(PROJECT) \
#	 host/*.o vr3/*.o   host/core


# Build the program:
#
#$(TARGET):	$(SRC)$(PROJECT).cpp $(SRC)mm_fltk.cpp 
#	$(CC) $(CFLAGS) \
#		$(SRC)$(PROJECT).cpp $(SRC)mm_fltk.cpp  \
#		$(XLIB) -o $@
#	$(STRIP) $(TARGET)
#	$(STRIP) --remove-section .compact_rel $(TARGET)
#	$(STRIP) --remove-section .note $(TARGET)
#	$(STRIP) --remove-section .comment $(TARGET)
