# httpd script src/ Makefile, reduced to compile the cache script only
# by Reinier Post, modified from the original by Rob McCool

# Usage: type 'make install' after setting CONFIG_FILE and SCRIPT_FILE,
# and possibly some other parameters.  SCRIPT_FILE is only used in the
# cp command that installs the cache script into your cgi-bin directory.
#
# You may need to check the configuration files coming with Lagoon
# and modify your existing ones accordingly, before Lagoon is ready for use.

# $Id: Makefile,v 0.15 1994/05/18 07:56:23 reinpost Exp reinpost $

# The place of your own configuration file; this file can be used to
# override the default values for parameters given in config.h.
# Using this file makes editing of config.h superfluous.

# The default configuration file - you probably use this if running httpd
# from inetd, installing it as superuser.
CONFIG_FILE= "/usr/local/etc/httpd/conf/cache.conf"
SCRIPT_FILE= "/usr/local/etc/httpd/cgi-bin/nph-cache"

# My own value, used for the test server on my own machine - provide
# your own values here if you're running httpd as a normal user!
# CONFIG_FILE= "/home/svin03b/reinpost/etc/httpd/conf/cache.conf"
# SCRIPT_FILE= "/home/svin03b/reinpost/etc/httpd/cgi-bin/nph-cache"

# These are the values used to compile the script for our www.win.tue.nl server
# CONFIG_FILE= "/conf/cache.conf"
# SCRIPT_FILE= "/home/svin01g/gopher/cgi/nph-cache"

# PLEASE CHECK THE AUX_CFLAGS BELOW !

# For gcc
CC= gcc
# For ANSI compilers
#CC= cc

# For optimization and terse logfiles
# CFLAGS= -O2
# For debugging: this will give you gigantic logfiles
# You'll get a load of warnings compiling; don't worry about them
CFLAGS= -g -Wall -DDEBUG

# Use ndbm database support?
# Don't - the code is not working yet!
#
# If you don't want to use ndbm, leave this flag empty:
DBFLAG=
# If you do, and it is present in /usr/include/ndbm.h
# DBFLAG= -DUSE_NDBM

# Place here any extra libraries you may need to link to. You
# shouldn't have to. (see also below for some standard set)
EXTRA_LIBS=

# AUX_CFLAGS are system-specific control flags.
# NOTE: IF YOU DO NOT CHOOSE ONE OF THESE, YOU'LL HAVE TO FIND PROPER
# VALUES FOR SEVERAL VALUES IN YOUR OWN SYSTEM.
# in case of problems, see system.h where these flags are used

# For SunOS 4
AUX_CFLAGS= -DSUNOS4

# For Solaris 2. NOTE: Lots of problems have been identified with compiling
# httpd under Solaris. Some of these may recur in lagoon. Use with caution.
# If you see aberrant behavior with lagoon under Solaris 2, please mail us.
#AUX_CFLAGS= -DSOLARIS2
#EXTRA_LIBS= -lsocket -lnsl

# For SVR4.  Two more libraries: -lc and -lucb to get strcasecmp.
#AUX_CFLAGS= -DSVR4
#EXTRA_LIBS= -lsocket -lnsl -lc -lucb

# For SGI IRIX. Use the EXTRA_LIBS line if you're using NIS and want
# user-supported directories
#AUX_CFLAGS= -DIRIX
#EXTRA_LIBS= -lsun
# For HP-UX
#AUX_CFLAGS= -DHPUX
# For AIX
#AUX_CFLAGS= -DAIX
# For Ultrix
#AUX_CFLAGS= -DULTRIX
# For DEC OSF/1
#AUX_CFLAGS= -DOSF1
# For NeXT
#AUX_CFLAGS= -DNEXT
# For Sequent
#AUX_CFLAGS= -DSEQUENT
# For Linux -m486 ONLY IF YOU HAVE 486 BINARY SUPPORT IN KERNEL
#AUX_CFLAGS= -DLINUX
# For A/UX
#AUX_CFLAGS= -DAUX

# Place here any flags you may need upon linking, such as a flag to
# prevent dynamic linking (if desired)
LFLAGS=


#--- You shouldn't have to edit anything else. ---

REL2ABS_OBJS = util.o html.o nolog.o rel2abs.o system.o

CLEANOUT_OBJS = util.o nolog.o noerror.o config.o database.o cleanup.o \
  cleanout.o system.o

CACHE_OBJS = cache.o util.o html.o network.o mime.o gettime.o error.o \
  log.o config.o database.o cleanup.o system.o

.c.o:
	$(CC) -c $(CFLAGS) $(DBFLAG) -DCACHE_CONF=\"$(CONFIG_FILE)\" $(AUX_CFLAGS) $<

nph-cache: $(CACHE_OBJS)
	$(CC) $(LFLAGS) $(CACHE_OBJS) -o nph-cache $(EXTRA_LIBS)

cleanout: $(CLEANOUT_OBJS)
	$(CC) $(LFLAGS) $(CLEANOUT_OBJS) -o cleanout $(EXTRA_LIBS)

rel2abs: $(REL2ABS_OBJS)
	$(CC) $(LFLAGS) $(REL2ABS_OBJS) -o rel2abs $(EXTRA_LIBS)

clean:
	rm -f *.o nph-cache rel2abs

install: nph-cache
	cp nph-cache $(SCRIPT_FILE)

all: nph-cache rel2abs cleanout

# header dependencies
cache.o: network.h mime.h system.h util.h constants.h html.h Makefile
cache.o: database.h error.h log.h config.h Makefile
cleanout.o: database.h constants.h system.h error.h log.h config.h cleanup.h
cleanup.o: system.h log.h Makefile
config.o: constants.h util.h log.h error.h system.h config.h Makefile
database.o: constants.h config.h error.h log.h util.h system.h Makefile
error.o: constants.h error.h log.h system.h Makefile
html.o: util.h system.h cleanup.h Makefile
log.o: constants.h config.h error.h gettime.h system.h Makefile
mime.o: constants.h util.h system.h gettime.h config.h error.h Makefile
network.o: system.h Makefile
rel2abs.o: constants.h html.h system.h Makefile
util.o: constants.h log.h system.h Makefile
