## simple makefile to compile xtoys

## these are set up for Linux, on other machines just make all and
## put things where you want them.
DESTDIR = 
BINDIR = $(DESTDIR)/usr/bin
DOCDIR = $(DESTDIR)/usr/share/doc/xtoys
MANDIR = $(DESTDIR)/usr/share/man/man1

PROGS = xising xpotts xfires xsand xautomalab xwaves schrodinger
DOCS = readme.txt xfires.txt xpotts.txt xwaves.txt\
       xautomalab.txt xising.txt xsand.txt xtoys.html xtoys.1

CC = cc
CFLAGS = -O2 -Wall
#CFLAGS = -Wall -g
LIBS = -lm -lX11

## If the X includes or libraries are not being found, fix this appropriately:
INCLUDES = -I/usr/openwin/include -I/usr/X11R6/include\
           -L/usr/openwin/lib -L/usr/X11R6/lib
## if you still have problems, rename this file to "Imakefile",
## comment out the INCLUDES above, and run "xmkmf" and then "make"
## the openwin includes are there for sun's; they are ignored with linux

all: $(PROGS)

clean:
	rm -f $(PROGS)

install: all
	cp $(PROGS) $(BINDIR)
	if [ ! -d $(DOCDIR) ] ; then mkdir -p $(DOCDIR); fi
	cp $(DOCS) $(DOCDIR)
	cp xtoys.1 $(MANDIR)

uninstall: 
	cd $(BINDIR)
	rm -rf $(PROGS)
	cd $(DOCDIR)
	rm $(DOCS)
	cd $(MANDIR)
	rm xtoys.1

tarfile: 
	tar -cvf xtoys.tar *.c Makefile $(DOCS) makedeb

% : %.c
	$(CC) $(CFLAGS) $(INCLUDES) -o $@ $< $(LIBS)
	chmod 755 $@

