1#
2#	Makefile	(CWI)	1.1	85/03/01
3#
4# BINDIR is the place where ideal will be installed
5BINDIR = /usr/local
6# DESTDIR is the destination where we want to move the thing (temporarily)
7DESTDIR =
8# LIBDIR is the place where we expect the the things we need and is
9# is therefore hardwired in. Since it is all local, we use BINDIR as well
10LIBDIR = ${BINDIR}/lib/ideal/lib/
11CFLAGS = -O -DLIBDIR=\"${LIBDIR}\"
12
13SOURCES = ideal.h ideal.c util.c memut.c bldds.c simul.c exprn.c\
14	action.c piece.c opaque.c inter.c opqpoly.c idlex.l idyac.y
15OBJECTS = y.tab.o lex.yy.o ideal.o util.o memut.o bldds.o simul.o\
16	exprn.o action.o piece.o opaque.o opqpoly.o inter.o
17ADMIXTURE = y.tab.c lex.yy.c ideal.c util.c memut.c bldds.c simul.c\
18	exprn.c action.c piece.c opaque.c opqpoly.c inter.c
19
20SUBDIR = idfilt lib
21
22all: ideal ideal.sh ${SUBDIR}
23
24${SUBDIR}: /tmp
25	cd $@; make ${MFLAGS} DESTDIR=${DESTDIR}
26
27# ideal is a shell file. It needs to know where it can find the real binary
28ideal.sh: ideal.cmd
29	sed "s#IDDIR=.*#IDDIR=${LIBDIR}#" < ideal.cmd > ideal.sh
30
31ideal:	$(OBJECTS)
32	cc -o ideal $(OBJECTS) -ll -lm
33
34$(OBJECTS):	ideal.h
35
36ideal.h:	stdas.h
37
38lex.yy.c:	idlex.l
39	lex idlex.l
40
41y.tab.c:	idyac.y
42	yacc -d idyac.y
43
44install: all $(LIBDIR)
45	install -s ideal ${DESTDIR}/${LIBDIR}/ideal
46	install -m 755 ideal.sh ${DESTDIR}/${BINDIR}/ideal
47	install -c -m 644 ideal.1 ${DESTDIR}/usr/man/manl/ideal.1
48	cd idfilt; make DESTDIR=${DESTDIR} install
49	cd lib; make DESTDIR=${DESTDIR} install
50
51$(LIBDIR):
52	mkdir ${BINDIR}/lib/ideal
53	mkdir${BINDIR}/lib/ideal/lib
54list:
55	pr $(SOURCES)
56
57lint:
58	lint $(ADMIXTURE) -lm
59
60clean:
61	rm -f *.o y.tab.c lex.yy.c y.tab.h
62	for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} clean); done
63
64