######################################################################
# Makefile for Techrep and its forms based interface
# 
######################################################################
CC		=	gcc -Wall

#--- You shouldn't have to edit anything else. ---
BIN	   	=       ../bin
CGIBIN   	=       ../cgi-bin

DEBUG		=	-g
OPTIMIZE	=	
WARNINGS	=	

INC_DIRS	=

CFLAGS		=	$(INC_DIRS) $(DEBUG) $(OPTIMIZE) $(WARNINGS) -fno-builtin -fpcc-struct-return
LDLIBS		=       -lm 


PROGRAM		=	techrep
COM_OBJECTS 	= 	sitespec.o techrep.o make_readme.o com-util.o
WEB_OBJECTS	=	web-util.o masterform.o
SHARED_OBJECTS	=	citation.o util.o
COMPILE.o.c = $(CC) -c $(CFLAGS)

all:	techrep masterform
	
techrep: $(COM_OBJECTS) $(SHARED_OBJECTS)
#	purify $(CC) $(CFLAGS) -o techrep $(COM_OBJECTS) $(SHARED_OBJECTS) $(LDLIBS)
	$(CC) $(CFLAGS) -o techrep $(COM_OBJECTS) $(SHARED_OBJECTS) $(LDLIBS)
	chmod 4550 techrep
	mv -f $(PROGRAM) $(BIN)
	@echo ""

masterform: $(WEB_OBJECTS) $(SHARED_OBJECTS)
	$(CC) $(WEB_OBJECTS) $(SHARED_OBJECTS) -o $(CGIBIN)/masterform

trycit: trycit.c citation.o util.o
	$(CC) trycit.c citation.o util.o -o trycit

change-passwd: change-passwd.o util.o 
	$(CC) change-passwd.o util.o -o $(CGIBIN)/change-passwd

techrep.o: sitespec.o citation.o techrep.c techrep.h
	$(CC) -o techrep.o $(CFLAGS) -c techrep.c 

make_readme.o: make_readme.c make_readme.h citation.o techrep.h
	$(CC) -o make_readme.o $(CFLAGS) -c make_readme.c 

com-util.o: com-util.c com-util.h techrep.h
	$(CC) -o com-util.o $(CFLAGS) -c com-util.c 

citation.o: citation.c citation.h techrep.h
	$(CC) -o citation.o $(CFLAGS) -c citation.c 

sitespec.o: com-conf.h sitespec.c sitespec.h techrep.h
	$(CC) -o sitespec.o $(CFLAGS) -c sitespec.c 

clean:
	rm -f *.o *~ core techrep masterform web-conf.h com-conf.h $(BIN)/techrep

