#	Makefile (UKC) 1.6 31/8/88
#

INSTALL=install
TARGET=/usr/lib/ditroff

CFLAGS= -O
LDFLAGS= -s

DFLAGS= -DBSD
#	-DUQMINMET for hashed character name lookup
#	-DSYSV for Sys 5, -DBSD for BSD4.x (also -DAUSAM, -DUNSW, -DV7)
#	-DVERBOSE to turn on all sorts of garbage

CFILES=tpscript.c pcom.c stringdefs.c spline.c sfont2.c hash.c
LPSOFILES=tpscript.lpso pcom.lpso stringdefs.lpso spline.lpso sfont2.lpso hash.lpso
ALWOFILES=tpscript.alwo pcom.alwo stringdefs.alwo spline.alwo sfont2.alwo hash.alwo

.SUFFIXES:	.c .lpso .alwo

.c.lpso:	; $(CC) -DLPS $(CFLAGS) $(DFLAGS) -c $< ; mv $*.o $*.lpso

.c.alwo:	; $(CC) -DALW $(CFLAGS) $(DFLAGS) -c $< ; mv $*.o $*.alwo

all:	dalw dlps

dalw:	$(ALWOFILES)
	$(CC) $(LDFLAGS) -o dalw $(ALWOFILES)

dlps:	$(LPSOFILES)
	$(CC) $(LDFLAGS) -o dlps $(LPSOFILES)

install:	install-dalw install-dlps

install-dlps:	dlps
	$(INSTALL) -m 711 dlps $(TARGET)/dlps

install-dalw:	dalw
	$(INSTALL) -m 711 dalw $(TARGET)/dalw

lint:	 $(CFILES)
	lint -D$(SYS) $(CFILES) > lint.out

clean:
	rm -f *.alwo *.lpso lint.out

clobber:	clean
	rm dalw dlps stringdefs.h sfont2defs.H

stringdefs.h:	stringdefs.H
	sed -f gendefs.sed stringdefs.H >stringdefs.h

sfont2defs.h:	sfont2defs.H
	sed -f gendefs.sed sfont2defs.H >sfont2defs.h

hash.alwo:		hash.h tpscript.h
pcom.alwo:		pscript.h
sfont2.alwo:		sfont2defs.h tpscript.h
spline.alwo:		tpscript.h
stringdefs.alwo:	hash.h stringdefs.h
tpscript.alwo:		tpscript.h dev.h pscript.h
hash.lpso:		hash.h tpscript.h
pcom.lpso:		pscript.h
sfont2.lpso:		sfont2defs.h tpscript.h
spline.lpso:		tpscript.h
stringdefs.lpso:	hash.h stringdefs.h
tpscript.lpso:		tpscript.h dev.h pscript.h
