#
# ~ppr/src/ppr/Makefile
# Copyright 1995, 1996, 1997, Trinity College Computing Center.
# Written by David Chappell.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted, provided
# that the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation.  This software is provided "as is" without express or
# implied warranty.
#
# Last modified 28 March 1997.
#

include ../include/global.mk

# Make everything
all: ppr$(DOTEXE) tbcp2bin$(DOTEXE)

# install the program in the bin directory and make it setuid
install: $(HOMEDIR)/bin/ppr$(DOTEXE) $(HOMEDIR)/lib/tbcp2bin$(DOTEXE)

ppr$(DOTEXE): ppr_main.$(OBJ) ppr_infile.$(OBJ) ppr_outfile.$(OBJ) \
		ppr_media.$(OBJ) ppr_rcache.$(OBJ) ppr_req.$(OBJ) \
		ppr_res.$(OBJ) ppr_old2new.$(OBJ) ppr_dscdoc.$(OBJ) \
		ppr_respond.$(OBJ) ppr_split.$(OBJ) ppr_conffile.$(OBJ) \
		ppr_mactt.$(OBJ) ppr_nest.$(OBJ) ppr_things.$(OBJ) \
		../libppr.$(LIBEXT) ../libpprdb.$(LIBEXT) 
	$(CC) $(CFLAGS) -o ppr ppr_main.$(OBJ) ppr_infile.$(OBJ) \
		ppr_outfile.$(OBJ) ppr_media.$(OBJ) ppr_rcache.$(OBJ) \
		ppr_req.$(OBJ) ppr_res.$(OBJ) ppr_old2new.$(OBJ) \
		ppr_dscdoc.$(OBJ) ppr_respond.$(OBJ) ppr_split.$(OBJ) \
		ppr_conffile.$(OBJ) ppr_mactt.$(OBJ) ppr_nest.$(OBJ) \
		ppr_things.$(OBJ) \
		../libppr.$(LIBEXT) $(DBLIBS)
	$(STRIP) ppr$(DOTEXE)
	chmod 4711 ppr$(DOTEXE)

ppr_main.$(OBJ): ppr_main.c ../include/global_defines.h ../include/global_structs.h \
		../include/ppr.h ../include/userdb.h ../include/ppr_exits.h \
		../include/respond.h ../include/version.h ../include/ppr_gab.h
	$(CC) $(CFLAGS) -c ppr_main.c

ppr_infile.$(OBJ): ppr_infile.c ../include/global_defines.h ../include/global_structs.h \
		../include/ppr.h ../include/ppr_exits.h ../include/respond.h \
		../include/ppr_gab.h
	$(CC) $(CFLAGS) $(UNCOMPRESS_OPTS) -c ppr_infile.c

ppr_outfile.$(OBJ): ppr_outfile.c ../include/global_defines.h ../include/global_structs.h \
		../include/ppr.h ../include/ppr_exits.h
	$(CC) $(CFLAGS) -c ppr_outfile.c

ppr_media.$(OBJ): ppr_media.c ../include/global_defines.h ../include/global_structs.h \
		../include/ppr.h ../include/ppr_exits.h ../include/respond.h
	$(CC) $(CFLAGS) -c ppr_media.c

ppr_rcache.$(OBJ): ppr_rcache.c ../include/global_defines.h ../include/global_structs.h \
		../include/ppr.h
	$(CC) $(CFLAGS) -c ppr_rcache.c

ppr_mactt.$(OBJ): ppr_mactt.c ../include/global_defines.h ../include/ppr.h
	$(CC) $(CFLAGS) -c ppr_mactt.c

ppr_req.$(OBJ): ppr_req.c ../include/global_defines.h ../include/global_structs.h \
		../include/ppr.h
	$(CC) $(CFLAGS) -c ppr_req.c

ppr_res.$(OBJ): ppr_res.c ../include/global_defines.h ../include/global_structs.h \
		../include/ppr.h
	$(CC) $(CFLAGS) -c ppr_res.c

ppr_old2new.$(OBJ): ppr_old2new.c ../include/global_defines.h ../include/global_structs.h \
		../include/ppr.h
	$(CC) $(CFLAGS) -c ppr_old2new.c

ppr_dscdoc.$(OBJ): ppr_dscdoc.c ../include/global_defines.h ../include/global_structs.h \
		../include/ppr.h
	$(CC) $(CFLAGS) -c ppr_dscdoc.c

ppr_respond.$(OBJ): ppr_respond.c ../include/global_defines.h ../include/ppr.h \
		../include/respond.h ../include/global_structs.h \
		../include/ppr_exits.h
	$(CC) $(CFLAGS) -c ppr_respond.c

ppr_split.$(OBJ): ppr_split.c ../include/global_defines.h ../include/ppr.h \
		../include/global_structs.h ../include/ppr_exits.h
	$(CC) $(CFLAGS) -c ppr_split.c

ppr_conffile.$(OBJ): ppr_conffile.c ../include/global_defines.h \
		../include/global_structs.h
	$(CC) $(CFLAGS) -c ppr_conffile.c

ppr_nest.$(OBJ): ppr_nest.c ../include/global_defines.h ../include/ppr.h \
		../include/ppr_exits.h ../include/ppr_gab.h
	$(CC) $(CFLAGS) -c ppr_nest.c

ppr_things.$(OBJ): ppr_things.c ../include/global_defines.h ../include/global_structs.h \
		../include/ppr.h
	$(CC) $(CFLAGS) -c ppr_things.c

tbcp2bin$(DOTEXE): tbcp2bin.c
	$(CC) $(CFLAGS) -o tbcp2bin$(DOTEXE) tbcp2bin.c
	$(STRIP) tbcp2bin$(DOTEXE)

$(HOMEDIR)/bin/ppr$(DOTEXE): ppr$(DOTEXE)
	$(RMF) $(HOMEDIR)/bin/ppr$(DOTEXE)
	cp ppr$(DOTEXE) $(HOMEDIR)/bin/ppr$(DOTEXE)
	chmod 4711 $(HOMEDIR)/bin/ppr$(DOTEXE)

$(HOMEDIR)/lib/tbcp2bin$(DOTEXE): tbcp2bin$(DOTEXE)
	$(RMF) $(HOMEDIR)/lib/tbcp2bin$(DOTEXE)
	cp tbcp2bin$(DOTEXE) $(HOMEDIR)/lib/tbcp2bin$(DOTEXE)
	chmod 711 $(HOMEDIR)/lib/tbcp2bin$(DOTEXE)

clean: 
	$(RMF) *.bak *~ *.$(OBJ) ppr$(DOTEXE) tbcp2bin$(DOTEXE)

# end of file
