# INSTALL=cp
INSTALL=:
I=..
ROOT=
INSDIR=/usr/bin
#	-DUQMINMET for hashed character name lookup
SYS=BSD
VERBOSE=1	# 1 to turn on stuff; 0 to turn off
LOCALSYS=	# for various local mods
CFLAGS= -O
LDFLAGS= -n
DFLAGS= -DUQMINMET -D$(SYS) -DALW -DALWPLUS -DVERBOSE=$(VERBOSE) -DVMSAVE \
-DPSDEBUG
GFLAGS= -DGERMAN -DGUMLAUT
GEMFLAGS= -DGEMPRINT
CFILES=tpscript.c pcom.c stringdefs.c spline.c sfont2.c hash.c call.c
OFILES=tpscript.o pcom.o stringdefs.o spline.o sfont2.o hash.o
GOFILES=pcom.o stringdefs.o spline.o sfont2.o hash.o

.c.o:
	$(CC) $(CFLAGS) $(DFLAGS) -c $<

all: tpscript tpsgem

tpscript: tp1 $(GOFILES)
	$(CC) $(LDFLAGS) -o tpscript $(OFILES)

#	If you choose the target 'tpsgem' keep in mind, that
#	documents that contain Pic-graphics cannot be processed
#	with tpsgem

tpsgem: tp2 $(GOFILES) call.o
	$(CC) $(LDFLAGS) -o tpsgem $(OFILES) call.o

tp1: tpscript.c
	$(CC) $(CFLAGS) $(DFLAGS) -c tpscript.c

tp2: tpscript.c
	$(CC) $(CFLAGS) $(DFLAGS) $(GFLAGS) $(GEMFLAGS) -c tpscript.c

install: tpscript tpsgem
	$(INSTALL) tpscript $(ROOT)$(INSDIR)/dalw
	$(INSTALL) tpsgem $(ROOT)$(INSDIR)/dalwgem
	chown bin $(ROOT)$(INSDIR)/dalw $(ROOT)$(INSDIR)/dalwg\
	$(ROOT)$(INSDIR)/dalwgem
	chgrp bin $(ROOT)$(INSDIR)/dalw $(ROOT)$(INSDIR)/dalwg\
	$(ROOT)$(INSDIR)/dalwgem
	chmod 711 $(ROOT)$(INSDIR)/dalw $(ROOT)$(INSDIR)/dalwg\
	$(ROOT)$(INSDIR)/dalwgem

lint:	tpscript.lint

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

clean:
	rm -f *.o tpscript.lint

clobber:	clean
	rm tpscript tpsgem 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.o:		hash.h tpscript.h
pcom.o:		pscript.h
sfont2.o:	sfont2defs.h tpscript.h
spline.o:	tpscript.h
stringdefs.o:	hash.h stringdefs.h
tpscript.o:	tpscript.h dev.h pscript.h
