CC = gcc
CFLAGS = -g -O2 -D_REENTRANT -Wall -D__EXTENSIONS__ -Wdeprecated-declarations
CFLAGS = -g -O2 -D_REENTRANT -Wall -D__EXTENSIONS__ -Wno-deprecated-declarations
LIBS = -lposix4 -lrt -lposix4 -lpthread 
LIBS_RPC = -lnsl
RANLIB = :
RPCGEN_OPTS = -C

# Following are all the object files to create in the lib/ directory.
CLEANFILES = core core.* *.core *.o temp.* *.out typescript* \
		*.[234]c *.[234]h *.bsdi *.sparc *.uw

# incr_map_anon and incr_dev_zero are not in PORGS since they're
# not on all platforms.

PROGS =	README.ps README.pdf \
		client1 server1 client2 server2 client3 server3 client4 server4 \
		client5 server5 client6 server6 client7 server7 client8 server8 \
		client9 server9 \
		clientintr1 serverintr1 clientintr2 serverintr2 \
		clientintr3 serverintr3 clientintr4 serverintr4 \
		clientfd1 serverfd1 \
		clientunref1 serverunref1 clientunref2 serverunref2 \
		tclient1 tserver1 \
		doorinfo 

all:	${PROGS}

doorinfo:	doorinfo.c
		${CC} ${CFLAGS} -o $@ doorinfo.c ${LIBS} -ldoor

client1:	client1.c
		${CC} ${CFLAGS} -o $@ client1.c ${LIBS} -ldoor

server1:	server1.c
		${CC} ${CFLAGS} -o $@ server1.c ${LIBS} -ldoor

client2:	client2.c
		${CC} ${CFLAGS} -o $@ client2.c ${LIBS} -ldoor

server2:	server2.c
		${CC} ${CFLAGS} -o $@ server2.c ${LIBS} -ldoor

client3:	client3.c
		${CC} ${CFLAGS} -o $@ client3.c ${LIBS} -ldoor

server3:	server3.c
		${CC} ${CFLAGS} -o $@ server3.c ${LIBS} -ldoor

client4:	client4.c
		${CC} ${CFLAGS} -o $@ client4.c ${LIBS} -ldoor

server4:	server4.c
		${CC} ${CFLAGS} -o $@ server4.c ${LIBS} -ldoor

client5:	client5.c
		${CC} ${CFLAGS} -o $@ client5.c ${LIBS} -ldoor

server5:	server5.c
		${CC} ${CFLAGS} -o $@ server5.c ${LIBS} -ldoor

client6:	client6.c
		${CC} ${CFLAGS} -o $@ client6.c ${LIBS} -ldoor

server6:	server6.c
		${CC} ${CFLAGS} -o $@ server6.c ${LIBS} -ldoor

client7:	client7.c
		${CC} ${CFLAGS} -o $@ client7.c ${LIBS} -ldoor

server7:	server7.c
		${CC} ${CFLAGS} -o $@ server7.c ${LIBS} -ldoor -lm

client8:	client8.c
		${CC} ${CFLAGS} -o $@ client8.c ${LIBS} -ldoor

server8:	server8.c
		${CC} ${CFLAGS} -o $@ server8.c ${LIBS} -ldoor -lm

client9:	client9.c
		${CC} ${CFLAGS} -o $@ client9.c ${LIBS} -ldoor

server9:	server9.c
		${CC} ${CFLAGS} -o $@ server9.c ${LIBS} -ldoor -lm

clientunref1:	clientunref1.c
		${CC} ${CFLAGS} -o $@ clientunref1.c ${LIBS} -ldoor

serverunref1:	serverunref1.c
		${CC} ${CFLAGS} -o $@ serverunref1.c ${LIBS} -ldoor -lm

clientunref2:	clientunref2.c
		${CC} ${CFLAGS} -o $@ clientunref2.c ${LIBS} -ldoor

serverunref2:	serverunref2.c
		${CC} ${CFLAGS} -o $@ serverunref2.c ${LIBS} -ldoor -lm

clientintr1:	clientintr1.c
		${CC} ${CFLAGS} -o $@ clientintr1.c ${LIBS} -ldoor

serverintr1:	serverintr1.c
		${CC} ${CFLAGS} -o $@ serverintr1.c ${LIBS} -ldoor -lm

clientintr2:	clientintr2.c
		${CC} ${CFLAGS} -o $@ clientintr2.c ${LIBS} -ldoor

serverintr2:	serverintr2.c
		${CC} ${CFLAGS} -o $@ serverintr2.c ${LIBS} -ldoor -lm

clientintr3:	clientintr3.c
		${CC} ${CFLAGS} -o $@ clientintr3.c ${LIBS} -ldoor

serverintr3:	serverintr3.c
		${CC} ${CFLAGS} -o $@ serverintr3.c ${LIBS} -ldoor -lm

clientintr4:	clientintr4.c
		${CC} ${CFLAGS} -o $@ clientintr4.c ${LIBS} -ldoor

serverintr4:	serverintr4.c
		${CC} ${CFLAGS} -o $@ serverintr4.c ${LIBS} -ldoor -lm

clientfd1:	clientfd1.c
		${CC} ${CFLAGS} -o $@ clientfd1.c ${LIBS} -ldoor

serverfd1:	serverfd1.c
		${CC} ${CFLAGS} -o $@ serverfd1.c ${LIBS} -ldoor

tclient1:	tclient1.c
		${CC} ${CFLAGS} -o $@ tclient1.c ${LIBS} -ldoor

tserver1:	tserver1.c
		${CC} ${CFLAGS} -o $@ tserver1.c ${LIBS} -ldoor

clean:
		rm -f ${PROGS} ${CLEANFILES}


README.ps: README
	a2ps  --prologue=bold -c --columns=1  -R  -L 50 \
	--output=README.ps -B \
	--center-title="1. Prozesse" \
	--right-title="%F" \
	--right-footer="Seite $%.    " \
	--left-footer="  j-p bell" README
README.pdf: README.ps
	ps2pdf -sPAPERSIZE=a4 README.ps README.pdf

