#
# Makefile for UNIX/gcc
#
# Version 1.4: Jan. 1994
#
# Reworked in haste to add kpathsea searching.

# Here we install the binaries:
BINDIR = /usr/local/lib/tex/bin

# Here we install the manual pages:
MANDIR = /usr/local/lib/tex/man/man1

# Built-in path
T1INPUTS = .:/usr/local/lib/tex/ps

# Compiler directives and other goodies
CC = gcc
SYSTEM = UNIX
#CFLAGS = -D$(SYSTEM) -g
CFLAGS = -DKPSE -D$(SYSTEM) -g
T1LIBRARY = libtype1.a
T1HDR =  -I../type1
T1LIB = -L../type1 -ltype1
T1-LIB = ../type1/$(T1LIBRARY)
# Just make sure that a fresh kpathsea.a is already available
# Apologies  for this sloppy start.
# KPSEHDR =	
KPSEHDR = -I../../kpathsea
KPSELIB = kpathsea.a
KPSELIBDIR = ../../kpathsea
CLIB = $(KPSELIBDIR)/$(KPSELIB)
#CLIB =
OLIBS = $(CLIB) -lm

all: ps2pk pk2bm

ps2pk: ps2pk.o encoding.o pkout.o filenames.o $(T1-LIB)
	$(CC) -o ps2pk encoding.o ps2pk.o pkout.o filenames.o $(T1LIB) $(OLIBS)

ps2pk.o: ps2pk.c pkout.h filenames.h
	$(CC) -DT1INPUTS=\"$(T1INPUTS)\" $(CFLAGS) $(T1HDR) $(KPSEHDR) -c ps2pk.c

pk2bm: pk2bm.o pkin.o
	$(CC) -o pk2bm  pk2bm.o pkin.o $(CLIB)

mag: mag.o
	$(CC) -o mag mag.o $(OLIBS)

pfb2pfa: pfb2pfa.o filenames.o
	$(CC) -o pfb2pfa pfb2pfa.o filenames.o $(CLIB)

pktest: pktest.o pkout.o
	$(CC) -o pktest pktest.o pkout.o $(OLIBS)

$(T1-LIB)::
	cd ../type1; make -f Makefile.unx $(T1LIBRARY)
	
t1test: $(T1-LIB)
	cd ../type1; make -f Makefile.unx t1test

install: ps2pk pk2bm
	install -c ps2pk   $(BINDIR)/ps2pk
	install -c pk2bm   $(BINDIR)/pk2bm

install.man:
	install -c -m 644 ../man/ps2pk.1 $(MANDIR)
	install -c -m 644 ../man/pk2bm.1 $(MANDIR)

clean:
	rm -f *.o *.pk pktest ps2pk mag pfb2pfa pk2bm
	cd ../type1; make -f Makefile.unx clean
