# Makefile for grafix-applications  
#	wolf 6/94

include grafix.mk

DEMOS = class-browser hello win-demo edit-demo file-browser cursors calc \
	dir-tree \
	pal-demo lat-demo lat2demo one-dim two-dim clock-demo three-dim replay

PROGS = scrolled_demo 

TOSHAR = window.c window.h lat_win.c lat_man.c reg_man.c lattice.h \
	palette.c palette.h files.c files.h smolark.c smolark.h solver.c \
	animator.h animator.c wave.c three-nxnynz.h \
	icon.h eventnames.h README.txt HOWTO.txt COPYING LOG.txt TODO.txt \
	Makefile grafix.mk \
	calc.icon tree.h tree.c tree_icon.h gccinc \
	$(DEMOS:%=%.c) $(PROGS:%=%.c) 

all:	demos $(PROGS)

demos: 	$(DEMOS)

test: 	clean depend all tgz test-tgz

# make demos = ~ 100 sec P90

# the classes to lattice.h are located in files lat_win, lat_man, reg_man
LATTICE = lat_win.o lat_man.o reg_man.o

libwin.a: window.o palette.o $(LATTICE) 
	$(AR) libwin.a $?
	ranlib libwin.a

hello: 		hello.o window.o
win-demo: 	win-demo.o window.o
edit-demo: 	edit-demo.o window.o
cursors: 	cursors.o window.o
calc: 		calc.o window.o
pal-demo: 	pal-demo.o libwin.a
lat-demo: 	lat-demo.o libwin.a
lat2demo: 	lat2demo.o libwin.a
one-dim: 	one-dim.o solver.o libwin.a
two-dim: 	two-dim.o smolark.o libwin.a
three-dim: 	three-dim.o wave.o animator.o files.o libwin.a
file-browser: 	file-browser.o files.o window.o
clock-demo: 	clock-demo.o window.o
replay: 	replay.o animator.o  files.o libwin.a
tree: 		tree.o window.o files.o
scrolled_demo: 	scrolled_demo.o window.o 
class-browser: 	class-browser.o tree.o window.o files.o
dir-tree: 	dir-tree.o tree.o window.o files.o

clean:
	\rm -f *.o *.a $(DEMOS) $(PROGS)
	\rm -rf ttgz/*

masterproper: clean
	\rm -f .depend

####### make shell archives for comp.sources.misc -> subdir upload #####
shar:
	shar -o Grafix.shar -l 100 -n Grafix  -a -s wolf@first.gmd.de \
	$(TOSHAR)
	cat intro.txt Grafix.shar.01 > tmp; mv -f tmp Grafix.shar.01
	mv *.shar* post/; 

shartest:
	cd post; unshar *shar*; $(MAKE) demos;

###### generate tar-file for uploading to #####
# "make tgz" - generates grafix.tgz file

tgz: 
	$(TAR) -czh -f grafix.tgz $(TOSHAR)
	uuencode grafix.tgz grafix.tgz > grafix.tgz.uu

test-tgz:
	\rm -rf ttgz/*
	cp grafix.tgz ttgz/
	cd ttgz; $(TAR) -xvzf grafix.tgz; $(MAKE) all

# runs all the demos :
demorun: $(DEMOS)
	@for demo in $(DEMOS); do (echo "running $$demo"; $$demo;); done

# make dependencies:
depend:	
	$(CC) -MM $(CFLAGS) *.c > .depend

-include	.depend


