## 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/X11R6/bin
DOCDIR = $(DESTDIR)/usr/doc/xtoys
MANDIR = $(DESTDIR)/usr/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 = -O 
## CFLAGS = -O2 -Wall 
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"

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)

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

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

