#	$eterna: Makefile,v 1.17 2004/03/25 13:06:55 mrg Exp $

PROG=	bozohttpd
MAN=	bozohttpd.8

WARNS=	3

check:
	cd $(.CURDIR)/testsuite; $(MAKE) check

clean:
	cd $(.CURDIR)/testsuite; $(MAKE) clean

CRYPTOLIBS=	-lcrypto -lssl
CRYPTODEPS=	$(LIBCRYPTO) $(LIBSSL)

NROFF?=		nroff

# example of creating a smaller bozohttpd
UNIFDEF?=	unifdef
SMALLCFLAGS=	-DNO_USER_SUPPORT \
		-DNO_CGIBIN_SUPPORT \
		-DNO_DIRINDEX_SUPPORT \
		-DNO_DAEMON_MODE \
		-DNO_DYNAMIC_CONTENT \
		-DNO_SSL_SUPPORT \
		-UDEBUG \
		-UDO_HTPASSWD
CLEANCFLAGS=	-UNO_USER_SUPPORT \
		-UNO_CGIBIN_SUPPORT \
		-UNO_DIRINDEX_SUPPORT \
		-UNO_DAEMON_MODE \
		-UNO_DYNAMIC_CONTENT \
		-UNO_SSL_SUPPORT \
		-DDEBUG \
		-DDO_HTPASSWD

# if not defining -DNO_SSL_SUPPORT
LDADD=	$(CRYPTOLIBS)
DPADD=	$(CRYPTODEPS)

bozohttpd.small.c: bozohttpd.c
	-$(UNIFDEF) $(SMALLCFLAGS) $> > $@

bozohttpd.clean.c: bozohttpd.c
	-$(UNIFDEF) $(CLEANCFLAGS) $> > $@

PREHTMLFROB=	sed \
		    -e 's/&/\&amp;/' \
		    -e 's/</\&lt;/' \
		    -e 's/>/\&gt;/'

HTMLFROB=	sed \
		    -e 's/\([MC] "[^"]*\)<dd>$$/\1<b>"<\/b><dd>/' \
		    -e 's/'"''"'/\&rdquo;/' \
		    -e 's/""/\&ldquo;/' \
		    -e 's/<a href="\.\.\/html[^>]*>\(.*\)<\/a>/\1/'

bozohttpd.8.html: bozohttpd.8
	$(PREHTMLFROB) $> | $(NROFF) -mdoc2html | $(HTMLFROB) > $@

CLEANFILES+=	bozohttpd.small.c bozohttpd.clean.c bozohttpd.8.html

.include <bsd.prog.mk>
