Makefile revision 1.34
1#	$NetBSD: Makefile,v 1.34 2025/04/06 23:03:06 rillig Exp $
2#
3#	$eterna: Makefile,v 1.30 2010/07/11 00:34:27 mrg Exp $
4#
5# berkeley (netbsd) makefile.  see Makefile.boot for other systems.
6
7# compile-time options are:
8#	NO_DEBUG		/* don't include debugging support */
9#	NO_USER_SUPPORT		/* don't support /~user requests */
10#	NO_CGIBIN_SUPPORT	/* don't support cgi-bin requests */
11#	NO_DIRINDEX_SUPPORT	/* don't support directory indexing */
12#	NO_DAEMON_MODE		/* don't support daemon mode */
13#	NO_DYNAMIC_CONTENT	/* don't support dynamic content updates */
14#	NO_SSL_SUPPORT		/* don't support ssl (https) */
15#	DO_HTPASSWD		/* support .htpasswd files */
16#	NO_LUA_SUPPORT		/* don't support Lua for dynamic content */
17#	NO_BLOCKLIST_SUPPORT	/* don't support blocklist */
18#
19# other system specific defines:
20#	HAVE_NBUTIL_H		/* netbsd compat is in <nbutil.h>
21#				(don't forget to also enable -lnbutil)
22#
23# these are usually set via the "COPTS" variable, or some other method
24# for setting CFLAGS relevant to your make, eg
25#   % make COPTS="-DDO_HTPASSWD"
26
27COPTS+=	-DDO_HTPASSWD
28PROG=	bozohttpd
29LINKS=	${BINDIR}/bozohttpd ${BINDIR}/httpd
30MAN=	bozohttpd.8
31MLINKS+=bozohttpd.8 httpd.8
32SRCS=	bozohttpd.c ssl-bozo.c auth-bozo.c cgi-bozo.c daemon-bozo.c \
33	tilde-luzah-bozo.c dir-index-bozo.c content-bozo.c lua-bozo.c
34SRCS+=	main.c
35
36COPTS.ssl-bozo.c+=-Wno-error=deprecated-declarations
37
38LDADD=	-lblocklist -lcrypt -llua -lm
39DPADD=	${LIBBLOCKLIST} ${LIBCRYPT} ${LIBLUA} ${LIBM}
40
41WARNS?=	4
42LINTFLAGS+=	-X 193	# statement not reached
43LINTFLAGS+=	-X 239	# constant operand to '!'
44
45.if defined(.OS.MAKE)
46OPSYS=	${.OS.MAKE}
47.else
48OPSYS:=	${:!uname -s!:S/-//g:S/\///g}
49.endif
50
51.if ${OPSYS} == "QNX"
52CPPFLAGS+=	-DHAVE_NBUTIL_H
53LDADD+=		-lnbutil
54.endif
55
56LDADD+=	-lssl -lcrypto
57DPADD+=	${LIBSSL} ${LIBCRYPTO}
58
59#
60# Build release things.
61#
62NROFF?=		nroff
63
64PREHTMLFROB=	sed \
65		    -e 's/&/\&amp;/' \
66		    -e 's/</\&lt;/' \
67		    -e 's/>/\&gt;/'
68
69HTMLFROB=	sed \
70		    -e 's/\([MC] "[^"]*\)<dd>$$/\1<b>"<\/b><dd>/' \
71		    -e 's/'"''"'/\&rdquo;/' \
72		    -e 's/""/\&ldquo;/' \
73		    -e 's/<a href="\.\.\/html[^>]*>\(.*\)<\/a>/\1/'
74
75TXTFROB=	col -b
76
77bozohttpd.8.html: bozohttpd.8
78	$(PREHTMLFROB) $> | $(NROFF) -mdoc2html | $(HTMLFROB) > $@
79
80bozohttpd.8.txt: bozohttpd.8
81	$(NROFF) -mdoc -Tascii $> | $(TXTFROB) > $@
82
83CLEANFILES+=	bozohttpd.8.html bozohttpd.8.txt
84
85check:
86	cd ${.CURDIR}/testsuite && ${MAKE} check
87
88.if empty(BOZOVER)
89BOZOVER!=	sed -n \
90		    -e s/\"$$// -e \
91		    's/\#define[ 	]*SERVER_SOFTWARE[ 	]*\"bozohttpd\///p'  ${.PARSEDIR}/bozohttpd.c
92.endif
93
94# Create a distfile: uses /tmp
95BASE=bozohttpd-${BOZOVER}
96TAR=${BASE}.tar
97export-distfile:
98	dir=`mktemp -d /tmp/bozo-export-XXXXXX`; \
99	cd "$${dir}" || exit; \
100	mkdir ${BASE}; \
101	( cd ${BASE} || exit; \
102	  cp -r "${.CURDIR}/." "."; \
103	  find . -name .CVS | xargs rm -r; \
104	); \
105	pax -wf ${TAR} ${BASE}; \
106	gzip -nc9 ${TAR} > ${TAR}.gz; \
107	bzip2 -9 ${TAR}; \
108	echo "Exported two files in $${dir}:"; \
109	echo ${TAR}.gz; \
110	echo ${TAR}.bz2
111
112.include <bsd.prog.mk>
113