# Build wrapper for Apache 
# $OpenBSD: Makefile.bsd-wrapper,v 1.68 2008/07/11 00:12:35 martynas Exp $

# Our lndir is hacked; specify a full path to avoid potential conflicts
# with the one installed with X11.
LNDIR=	/usr/bin/lndir

.include <bsd.own.mk>

#    OpenBSD Layout
#<Layout OpenBSD>
#    prefix:        /var/www
#    exec_prefix:   /usr
#    bindir:        $exec_prefix/bin
#    sbindir:       $exec_prefix/sbin
#    libexecdir:    $exec_prefix/lib/apache/modules
#    mandir:        $exec_prefix/share/man
#    sysconfdir:    $prefix/conf
#    datadir:       $prefix
#    iconsdir:      $prefix/icons
#    htdocsdir:     $prefix/htdocs
#    manualdir:     $exec_prefix/share/doc/html/httpd
#    cgidir:        $prefix/cgi-bin
#    includedir:    $exec_prefix/lib/apache/include
#    localstatedir: $prefix
#    runtimedir:    $prefix/logs
#    logfiledir:    $prefix/logs
#    proxycachedir: $prefix/proxy
#</Layout>

HTTPD_PREFIX=		/var/www
HTTPD_EXEC_PREFIX=	/usr
HTTPD_BINDIR=		${HTTPD_EXEC_PREFIX}/bin
HTTPD_SBINDIR=		${HTTPD_EXEC_PREFIX}/sbin
HTTPD_LIBEXECDIR=	${HTTPD_EXEC_PREFIX}/lib/apache/modules
HTTPD_SYSCONFDIR=	${HTTPD_PREFIX}/conf
HTTPD_ICONSDIR=		${HTTPD_PREFIX}/icons
HTTPD_HTDOCSDIR=	${HTTPD_PREFIX}/htdocs
HTTPD_MANUALDIR=	${HTTPD_EXEC_PREFIX}/share/doc/html/httpd
HTTPD_INCLUDEDIR=	${HTTPD_EXEC_PREFIX}/lib/apache/include
HTTPD_RUNDIR=		${HTTPD_PREFIX}/logs
HTTPD_LOGDIR=		${HTTPD_PREFIX}/logs

CONFIG_ARGS=	--with-layout="OpenBSD" --enable-module="ssl" \
	--enable-module="keynote" \
	--enable-suexec --suexec-caller="www" \
	--suexec-docroot="${HTTPD_HTDOCSDIR}" \
	--suexec-logfile="/var/log/suexec_log" --suexec-userdir="public_html" \
	--suexec-uidmin="1000" --suexec-gidmin="1000" \
	--suexec-safepath="/usr/bin:/bin:/usr/local/bin" \
	--disable-rule=EXPAT

# This is stupid - to build a DSO module for Apache you not only need to
# --enable-shared, you need to --enable-module or --enable-shared doesn't
# do anything.

DSO_MODULE_ARGS=  \
	--enable-module=so \
	--enable-module=auth_anon \
	--enable-shared=auth_anon \
	--enable-module=expires \
	--enable-shared=expires \
	--enable-module=headers \
	--enable-shared=headers \
	--enable-module=auth_db \
	--enable-shared=auth_db \
	--enable-module=auth_dbm \
	--enable-shared=auth_dbm \
	--enable-module=auth_digest \
	--enable-shared=auth_digest \
	--enable-module=cern_meta \
	--enable-shared=cern_meta \
	--enable-module=define \
	--enable-shared=define \
	--enable-module=digest \
	--enable-shared=digest \
	--enable-module=info \
	--enable-shared=info \
	--enable-module=log_agent \
	--enable-shared=log_agent \
	--enable-module=log_referer \
	--enable-shared=log_referer \
	--enable-module=mime_magic \
	--enable-shared=mime_magic \
	--enable-module=mmap_static \
	--enable-shared=mmap_static \
	--enable-module=proxy \
	--enable-shared=proxy \
	--enable-module=rewrite \
	--enable-shared=rewrite \
	--enable-module=speling \
	--enable-shared=speling \
	--enable-module=unique_id \
	--enable-shared=unique_id \
	--enable-module=usertrack \
	--enable-shared=usertrack \
	--enable-module=vhost_alias \
	--enable-shared=vhost_alias \
	--enable-rule=INET6

INSTALL_MODULES=

# If you support dynamic loading, enable the so module, and build all the
# modules that come with Apache.

.if !defined(NOPIC)
CONFIG_ARGS+=  ${DSO_MODULE_ARGS}
INSTALL_MODULES= \
	src/modules/experimental/mod_mmap_static.so \
	src/modules/experimental/mod_auth_digest.so \
	src/modules/extra/mod_define.so \
	src/modules/proxy/libproxy.so \
	src/modules/standard/mod_vhost_alias.so \
	src/modules/standard/mod_log_agent.so \
	src/modules/standard/mod_info.so \
	src/modules/standard/mod_log_referer.so \
	src/modules/standard/mod_mime_magic.so \
	src/modules/standard/mod_speling.so \
	src/modules/standard/mod_rewrite.so \
	src/modules/standard/mod_auth_dbm.so \
	src/modules/standard/mod_auth_anon.so \
	src/modules/standard/mod_auth_db.so \
	src/modules/standard/mod_digest.so \
	src/modules/standard/mod_cern_meta.so \
	src/modules/standard/mod_usertrack.so \
	src/modules/standard/mod_unique_id.so \
	src/modules/standard/mod_expires.so \
	src/modules/standard/mod_headers.so
.endif

PERLPATH=	/usr/bin/perl

MUNGEDFILES =	${.OBJDIR}/src/ap/Makefile \
		${.OBJDIR}/src/include/ap_config_auto.h.new \
		${.OBJDIR}/src/lib/expat-lite/Makefile \
		${.OBJDIR}/src/lib/Makefile \
		${.OBJDIR}/src/main/Makefile \
		${.OBJDIR}/src/modules/experimental/Makefile \
		${.OBJDIR}/src/modules/extra/Makefile \
		${.OBJDIR}/src/modules/proxy/Makefile \
		${.OBJDIR}/src/modules/standard/Makefile \
		${.OBJDIR}/src/modules/keynote/Makefile \
		${.OBJDIR}/src/modules/ssl/Makefile \
		${.OBJDIR}/src/modules/ssl/ssl_expr_parse.c \
		${.OBJDIR}/src/modules/ssl/ssl_expr_parse.h \
		${.OBJDIR}/src/modules/ssl/ssl_expr_scan.c \
		${.OBJDIR}/src/modules/Makefile \
		${.OBJDIR}/src/os/unix/Makefile \
		${.OBJDIR}/src/regex/Makefile \
		${.OBJDIR}/src/support/Makefile \
		${.OBJDIR}/src/apaci \
		${.OBJDIR}/src/Makefile \
		${.OBJDIR}/src/Makefile.config \
		${.OBJDIR}/src/modules.c \
		${.OBJDIR}/src/Configuration.apaci \
		${.OBJDIR}/Makefile \
		${.OBJDIR}/config.status

BINFILES= 	src/support/htdigest src/support/htpasswd

SBINFILES= \
	src/httpd \
	src/support/logresolve src/support/rotatelogs src/support/suexec

MAN+=	src/support/dbmmanage.1 src/support/htdigest.1 src/support/htpasswd.1 \
	src/support/apachectl.8 src/support/logresolve.8 \
	httpd.8 src/support/rotatelogs.8 src/support/apxs.8 \
	src/support/suexec.8

INCFILES= \
	src/include/ap.h \
	src/include/ap_alloc.h  \
	src/include/ap_compat.h \
	src/include/ap_config.h \
	src/include/ap_config_auto.h \
	src/include/ap_ctx.h \
	src/include/ap_ctype.h \
	src/include/ap_hook.h \
	src/include/ap_md5.h \
	src/include/ap_mm.h \
	src/include/ap_mmn.h \
	src/include/ap_sha1.h \
	src/include/buff.h \
	src/include/compat.h \
	src/include/conf.h \
	src/include/explain.h \
	src/include/fnmatch.h \
	src/include/fdcache.h \
	src/include/http_conf_globals.h \
	src/include/http_config.h \
	src/include/http_core.h \
	src/include/http_log.h \
	src/include/http_main.h \
	src/include/http_protocol.h \
	src/include/http_request.h \
	src/include/http_vhost.h \
	src/include/httpd.h \
	src/include/multithread.h \
	src/include/rfc1413.h \
	src/include/scoreboard.h \
	src/include/util_date.h \
	src/include/util_md5.h \
	src/include/util_script.h \
	src/include/util_uri.h \
	src/os/unix/os-inline.c \
	src/os/unix/os.h \
	src/modules/ssl/mod_ssl.h \
	src/modules/ssl/ssl_expr.h \
	src/modules/ssl/ssl_util_ssl.h \
	src/modules/ssl/ssl_util_table.h

XMLFILES= \
	src/lib/expat-lite/asciitab.h \
	src/lib/expat-lite/hashtable.h \
	src/lib/expat-lite/iasciitab.h \
	src/lib/expat-lite/latin1tab.h \
	src/lib/expat-lite/nametab.h \
	src/lib/expat-lite/utf8tab.h \
	src/lib/expat-lite/xmldef.h \
	src/lib/expat-lite/xmlparse.h \
	src/lib/expat-lite/xmlrole.h \
	src/lib/expat-lite/xmltok.h \
	src/lib/expat-lite/xmltok_impl.h

MODCONFDIR= \
	modules \
	modules.sample

CONFFILES= \
	conf/httpd.conf conf/mime.types conf/magic

HTDOCS= \
	htdocs/apache_pb.gif htdocs/index.html htdocs/openbsdpower.gif \
	htdocs/blowfish.jpg htdocs/bsd_small.gif htdocs/lock.gif \
	htdocs/logo23.jpg htdocs/logo24.jpg htdocs/smalltitle.gif \
	htdocs/openbsd_pb.gif htdocs/mod_ssl_sb.gif htdocs/openssl_ics.gif

CGIFILES=	cgi-bin/printenv cgi-bin/test-cgi	

MANUALFILES= \
	manual/FAQ.html \
	manual/howto/auth.html \
	manual/howto/htaccess.html \
	manual/howto/cgi.html \
	manual/howto/ssi.html \
	manual/LICENSE \
	manual/bind.html \
	manual/configuring.html \
	manual/content-negotiation.html \
	manual/custom-error.html \
	manual/dns-caveats.html \
	manual/dso.html \
	manual/env.html \
	manual/handler.html \
	manual/index.html \
	manual/invoking.html \
	manual/ipv6.html \
	manual/keepalive.html \
	manual/location.html \
	manual/logs.html \
	manual/images/apache_header.gif \
	manual/images/apache_pb.gif \
	manual/images/custom_errordocs.gif \
	manual/images/feather.jpg \
	manual/images/home.gif \
	manual/images/index.gif \
	manual/images/mod_rewrite_fig1.fig \
	manual/images/mod_rewrite_fig1.gif \
	manual/images/mod_rewrite_fig2.fig \
	manual/images/mod_rewrite_fig2.gif \
	manual/images/mod_ssl_sb.gif \
	manual/images/openssl_ics.gif \
	manual/images/pixel.gif \
	manual/images/sub.gif \
	manual/multilogs.html \
	manual/process-model.html \
	manual/misc/API.html \
	manual/misc/FAQ.html \
	manual/misc/custom_errordocs.html \
	manual/misc/descriptors.html \
	manual/misc/fin_wait_2.html \
	manual/misc/howto.html \
	manual/misc/index.html \
	manual/misc/known_client_problems.html \
	manual/misc/perf-bsd44.html \
	manual/misc/perf-tuning.html \
	manual/misc/perf.html \
	manual/misc/rewriteguide.html \
	manual/misc/security_tips.html \
	manual/misc/tutorials.html \
	manual/sections.html \
	manual/server-wide.html \
	manual/sitemap.html \
	manual/stopping.html \
	manual/suexec.html \
	manual/mod/mod_ssl/index.html \
	manual/mod/mod_ssl/ssl_compat.gfont000.gif \
	manual/mod/mod_ssl/ssl_compat.html \
	manual/mod/mod_ssl/ssl_cover_logo.jpg \
	manual/mod/mod_ssl/ssl_cover_title.jpg \
	manual/mod/mod_ssl/ssl_faq.gfont000.gif \
	manual/mod/mod_ssl/ssl_faq.html \
	manual/mod/mod_ssl/ssl_glossary.html \
	manual/mod/mod_ssl/ssl_howto.gfont000.gif \
	manual/mod/mod_ssl/ssl_howto.html \
	manual/mod/mod_ssl/ssl_intro.gfont000.gif \
	manual/mod/mod_ssl/ssl_intro.html \
	manual/mod/mod_ssl/ssl_intro_fig1.gif \
	manual/mod/mod_ssl/ssl_intro_fig2.gif \
	manual/mod/mod_ssl/ssl_intro_fig3.gif \
	manual/mod/mod_ssl/ssl_overview.gfont000.gif \
	manual/mod/mod_ssl/ssl_overview.html \
	manual/mod/mod_ssl/ssl_overview_fig1.gif \
	manual/mod/mod_ssl/ssl_reference.gfont000.gif \
	manual/mod/mod_ssl/ssl_reference.html \
	manual/mod/mod_ssl/ssl_template.head-chapter.gif \
	manual/mod/mod_ssl/ssl_template.head-num-1.gif \
	manual/mod/mod_ssl/ssl_template.head-num-2.gif \
	manual/mod/mod_ssl/ssl_template.head-num-3.gif \
	manual/mod/mod_ssl/ssl_template.head-num-4.gif \
	manual/mod/mod_ssl/ssl_template.head-num-5.gif \
	manual/mod/mod_ssl/ssl_template.head-num-6.gif \
	manual/mod/mod_ssl/ssl_template.head-num-7.gif \
	manual/mod/mod_ssl/ssl_template.imgdot-1x1-000000.gif \
	manual/mod/mod_ssl/ssl_template.imgdot-1x1-transp.gif \
	manual/mod/mod_ssl/ssl_template.navbut-next-n.gif \
	manual/mod/mod_ssl/ssl_template.navbut-next-s.gif \
	manual/mod/mod_ssl/ssl_template.navbut-prev-n.gif \
	manual/mod/mod_ssl/ssl_template.navbut-prev-s.gif \
	manual/mod/mod_ssl/ssl_template.title-abstract.gif \
	manual/mod/mod_ssl/ssl_template.title-compat.gif \
	manual/mod/mod_ssl/ssl_template.title-faq.gif \
	manual/mod/mod_ssl/ssl_template.title-gloss.gif \
	manual/mod/mod_ssl/ssl_template.title-howto.gif \
	manual/mod/mod_ssl/ssl_template.title-intro.gif \
	manual/mod/mod_ssl/ssl_template.title-over.gif \
	manual/mod/mod_ssl/ssl_template.title-preface.gif \
	manual/mod/mod_ssl/ssl_template.title-ref.gif \
	manual/mod/mod_ssl/ssl_template.title-toc.gif \
	manual/mod/mod_ssl/ssl_template.title-tutor.gif \
	manual/mod/core.html \
	manual/mod/directive-dict.html \
	manual/mod/directives.html \
	manual/mod/index-bytype.html \
	manual/mod/index.html \
	manual/mod/mod_access.html \
	manual/mod/mod_actions.html \
	manual/mod/mod_alias.html \
	manual/mod/mod_asis.html \
	manual/mod/mod_auth.html \
	manual/mod/mod_auth_anon.html \
	manual/mod/mod_auth_db.html \
	manual/mod/mod_auth_dbm.html \
	manual/mod/mod_auth_digest.html \
	manual/mod/mod_autoindex.html \
	manual/mod/mod_cern_meta.html \
	manual/mod/mod_cgi.html \
	manual/mod/mod_define.html \
	manual/mod/mod_digest.html \
	manual/mod/mod_dir.html \
	manual/mod/mod_env.html \
	manual/mod/mod_expires.html \
	manual/mod/mod_headers.html \
	manual/mod/mod_imap.html \
	manual/mod/mod_include.html \
	manual/mod/mod_info.html \
	manual/mod/mod_log_agent.html \
	manual/mod/mod_log_common.html \
	manual/mod/mod_log_config.html \
	manual/mod/mod_log_referer.html \
	manual/mod/mod_mime.html \
	manual/mod/mod_mime_magic.html \
	manual/mod/mod_mmap_static.html \
	manual/mod/mod_negotiation.html \
	manual/mod/mod_proxy.html \
	manual/mod/mod_rewrite.html \
	manual/mod/mod_setenvif.html \
	manual/mod/mod_so.html \
	manual/mod/mod_speling.html \
	manual/mod/mod_status.html \
	manual/mod/mod_unique_id.html \
	manual/mod/mod_userdir.html \
	manual/mod/mod_usertrack.html \
	manual/mod/mod_vhost_alias.html \
	manual/mod/module-dict.html \
	manual/urlmapping.html \
	manual/programs/ab.html \
	manual/programs/apachectl.html \
	manual/programs/apxs.html \
	manual/programs/dbmmanage.html \
	manual/programs/htdigest.html \
	manual/programs/htpasswd.html \
	manual/programs/httpd.html \
	manual/programs/index.html \
	manual/programs/logresolve.html \
	manual/programs/other.html \
	manual/programs/rotatelogs.html \
	manual/programs/suexec.html \
	manual/vhosts/details.html \
	manual/vhosts/examples.html \
	manual/vhosts/fd-limits.html \
	manual/vhosts/host.html \
	manual/vhosts/index.html \
	manual/vhosts/ip-based.html \
	manual/vhosts/mass.html \
	manual/vhosts/name-based.html \
	manual/vhosts/vhosts-in-depth.html \
	manual/vhosts/virtual-host.html
	
ICONFILES= \
	icons/back.gif \
	icons/README \
	icons/a.gif \
	icons/a.png \
	icons/small/README.txt \
	icons/small/back.gif \
	icons/small/back.png \
	icons/small/binary.gif \
	icons/small/binary.png \
	icons/small/binhex.gif \
	icons/small/binhex.png \
	icons/small/blank.gif \
	icons/small/blank.png \
	icons/small/broken.gif \
	icons/small/broken.png \
	icons/small/burst.gif \
	icons/small/burst.png \
	icons/small/comp1.gif \
	icons/small/comp1.png \
	icons/small/comp2.gif \
	icons/small/comp2.png \
	icons/small/compressed.gif \
	icons/small/compressed.png \
	icons/small/continued.gif \
	icons/small/continued.png \
	icons/small/dir.gif \
	icons/small/dir.png \
	icons/small/dir2.gif \
	icons/small/dir2.png \
	icons/small/doc.gif \
	icons/small/doc.png \
	icons/small/forward.gif \
	icons/small/forward.png \
	icons/small/generic.gif \
	icons/small/generic.png \
	icons/small/generic2.gif \
	icons/small/generic2.png \
	icons/small/generic3.gif \
	icons/small/generic3.png \
	icons/small/image.gif \
	icons/small/image.png \
	icons/small/image2.gif \
	icons/small/image2.png \
	icons/small/index.gif \
	icons/small/index.png \
	icons/small/key.gif \
	icons/small/key.png \
	icons/small/movie.gif \
	icons/small/movie.png \
	icons/small/patch.gif \
	icons/small/patch.png \
	icons/small/ps.gif \
	icons/small/ps.png \
	icons/small/rainbow.gif \
	icons/small/rainbow.png \
	icons/small/sound.gif \
	icons/small/sound.png \
	icons/small/sound2.gif \
	icons/small/sound2.png \
	icons/small/tar.gif \
	icons/small/tar.png \
	icons/small/text.gif \
	icons/small/text.png \
	icons/small/transfer.gif \
	icons/small/transfer.png \
	icons/small/unknown.gif \
	icons/small/unknown.png \
	icons/small/uu.gif \
	icons/small/uu.png \
	icons/alert.black.gif \
	icons/alert.black.png \
	icons/alert.red.gif \
	icons/alert.red.png \
	icons/apache_pb.gif \
	icons/apache_pb.png \
	icons/back.png \
	icons/ball.gray.gif \
	icons/ball.gray.png \
	icons/ball.red.gif \
	icons/ball.red.png \
	icons/binary.gif \
	icons/binary.png \
	icons/binhex.gif \
	icons/binhex.png \
	icons/blank.gif \
	icons/blank.png \
	icons/bomb.gif \
	icons/bomb.png \
	icons/box1.gif \
	icons/box1.png \
	icons/box2.gif \
	icons/box2.png \
	icons/broken.gif \
	icons/broken.png \
	icons/burst.gif \
	icons/burst.png \
	icons/c.gif \
	icons/c.png \
	icons/comp.blue.gif \
	icons/comp.blue.png \
	icons/comp.gray.gif \
	icons/comp.gray.png \
	icons/compressed.gif \
	icons/compressed.png \
	icons/continued.gif \
	icons/continued.png \
	icons/dir.gif \
	icons/dir.png \
	icons/diskimg.gif \
	icons/diskimg.png \
	icons/dvi.gif \
	icons/down.gif \
	icons/down.png \
	icons/dvi.png \
	icons/f.gif \
	icons/f.png \
	icons/folder.gif \
	icons/folder.open.gif \
	icons/folder.open.png \
	icons/folder.png \
	icons/folder.sec.gif \
	icons/folder.sec.png \
	icons/forward.gif \
	icons/forward.png \
	icons/generic.gif \
	icons/generic.png \
	icons/generic.red.gif \
	icons/generic.red.png \
	icons/generic.sec.gif \
	icons/generic.sec.png \
	icons/hand.right.gif \
	icons/hand.right.png \
	icons/hand.up.gif \
	icons/hand.up.png \
	icons/icon.sheet.gif \
	icons/icon.sheet.png \
	icons/image1.gif \
	icons/image1.png \
	icons/image2.gif \
	icons/image2.png \
	icons/image3.gif \
	icons/image3.png \
	icons/index.gif \
	icons/index.png \
	icons/layout.gif \
	icons/layout.png \
	icons/left.gif \
	icons/left.png \
	icons/link.gif \
	icons/link.png \
	icons/movie.gif \
	icons/movie.png \
	icons/p.gif \
	icons/p.png \
	icons/patch.gif \
	icons/patch.png \
	icons/pdf.gif \
	icons/pdf.png \
	icons/pie0.gif \
	icons/pie0.png \
	icons/pie1.gif \
	icons/pie1.png \
	icons/pie2.gif \
	icons/pie2.png \
	icons/pie3.gif \
	icons/pie3.png \
	icons/pie4.gif \
	icons/pie4.png \
	icons/pie5.gif \
	icons/pie5.png \
	icons/pie6.gif \
	icons/pie6.png \
	icons/pie7.gif \
	icons/pie7.png \
	icons/pie8.gif \
	icons/pie8.png \
	icons/portal.gif \
	icons/portal.png \
	icons/ps.gif \
	icons/ps.png \
	icons/quill.gif \
	icons/quill.png \
	icons/right.gif \
	icons/right.png \
	icons/screw1.gif \
	icons/screw1.png \
	icons/screw2.gif \
	icons/screw2.png \
	icons/script.gif \
	icons/script.png \
	icons/sound1.gif \
	icons/sound1.png \
	icons/sound2.gif \
	icons/sound2.png \
	icons/sphere1.gif \
	icons/sphere1.png \
	icons/sphere2.gif \
	icons/sphere2.png \
	icons/tar.gif \
	icons/tar.png \
	icons/tex.gif \
	icons/tex.png \
	icons/text.gif \
	icons/text.png \
	icons/transfer.gif \
	icons/transfer.png \
	icons/unknown.gif \
	icons/unknown.png \
	icons/up.gif \
	icons/up.png \
	icons/uu.gif \
	icons/uu.png \
	icons/uuencoded.gif \
	icons/uuencoded.png \
	icons/world1.gif \
	icons/world1.png \
	icons/world2.gif \
	icons/world2.png

.include <bsd.own.mk>

all: 	${.OBJDIR}/config.status
	@cd ${.OBJDIR} && ${MAKE}

BEFOREMAN=${.OBJDIR}/config.status

${.OBJDIR}/config.status : ${.OBJDIR}/config.layout 
	@cd ${.OBJDIR} && CC="${CC}" LD_SHLIB="${CC}" \
		OPTIM="${CFLAGS} ${COPTS}" \
		PATH="/sbin:/usr/sbin:/bin:/usr/bin" \
			sh configure ${CONFIG_ARGS}
	diff -u ${.CURDIR}/src/include/ap_config_auto.h ${.OBJDIR}/src/include/ap_config_auto.h.new

.if !exists(${.OBJDIR}/config.layout)
${.OBJDIR}/config.layout: ${.CURDIR}/config.layout
	${LNDIR} -s -e obj -e obj.${MACHINE_ARCH} -e Makefile.bsd-wrapper ${.CURDIR}
.endif


includes:
	@-for i in ${INCFILES}; do \
		j=`basename $$i`; \
		echo "Installing ${DESTDIR}${HTTPD_INCLUDEDIR}/$$j"; \
		${INSTALL} ${INSTALL_COPY} -g ${BINGRP} -m 444 \
		    ${.CURDIR}/$$i ${DESTDIR}${HTTPD_INCLUDEDIR}; \
	done
	@-for i in ${XMLFILES}; do \
		j=`basename $$i`; \
		echo "Installing ${DESTDIR}${HTTPD_INCLUDEDIR}/xml/$$j"; \
		${INSTALL} ${INSTALL_COPY} -g ${BINGRP} -m 444 \
		    ${.CURDIR}/$$i ${DESTDIR}${HTTPD_INCLUDEDIR}/xml; \
	done

install: maninstall htmlinstall
	@-for i in ${BINFILES}; do \
		j=`basename $$i`; \
		echo "Installing ${DESTDIR}${HTTPD_BINDIR}/$$j"; \
		${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP} -g ${BINGRP} \
		    -m 555 ${.OBJDIR}/$$i ${DESTDIR}${HTTPD_BINDIR}; \
	done
	@-for i in ${SBINFILES}; do \
		j=`basename $$i`; \
		echo "Installing ${DESTDIR}${HTTPD_SBINDIR}/$$j"; \
		${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP} -g ${BINGRP} \
		    -m 555 ${.OBJDIR}/$$i ${DESTDIR}${HTTPD_SBINDIR}; \
	done
	@-for i in ${INSTALL_MODULES}; do \
		j=`basename $$i`; \
		echo "Installing ${DESTDIR}${HTTPD_LIBEXECDIR}/$$j"; \
		${INSTALL} ${INSTALL_COPY} -g ${BINGRP} -m 444 \
		    ${.OBJDIR}/$$i ${DESTDIR}${HTTPD_LIBEXECDIR}; \
	done
	@d=`mktemp -d /tmp/httpdXXXXXXXXXX`; \
	echo "Installing ${DESTDIR}${HTTPD_SBINDIR}/apxs"; \
	j="sed -e 's;^#!/.*;#!${PERLPATH};' \
		-e 's;\@prefix\@;${HTTPD_PREFIX};' \
		-e 's;\@sbindir\@;${HTTPD_SBINDIR};' \
		-e 's;\@libexecdir\@;${HTTPD_LIBEXECDIR};' \
		-e 's;\@includedir\@;${HTTPD_INCLUDEDIR};' \
		-e 's;\@sysconfdir\@;${HTTPD_SYSCONFDIR};' \
		< ${.OBJDIR}/src/support/apxs > $$d/apxs && \
		${INSTALL} ${INSTALL_COPY} -g ${BINGRP} -m 555 \
		$$d/apxs ${DESTDIR}${HTTPD_SBINDIR}"; \
		echo $$j; \
		eval $$j; \
	echo "Installing ${DESTDIR}${HTTPD_SBINDIR}/apachectl"; \
	j="sed -e 's;PIDFILE=.*;PIDFILE=${HTTPD_RUNDIR}/httpd.pid;' \
		-e 's;HTTPD=.*;HTTPD=${HTTPD_SBINDIR}/httpd;' \
		< ${.OBJDIR}/src/support/apachectl > $$d/apachectl && \
		${INSTALL} ${INSTALL_COPY} -g ${BINGRP} -m 555 \
		$$d/apachectl ${DESTDIR}${HTTPD_SBINDIR}"; \
		echo $$j; \
		eval $$j; \
	echo "Installing ${DESTDIR}${HTTPD_BINDIR}/dbmmanage"; \
	j="sed -e 's;^#!/.*;#!${PERLPATH};' \
		< ${.OBJDIR}/src/support/dbmmanage > $$d/dbmmanage && \
		${INSTALL} ${INSTALL_COPY} -g ${BINGRP} -m 555 \
		$$d/dbmmanage ${DESTDIR}${HTTPD_BINDIR}"; \
		echo $$j; \
		eval $$j; \
	rm -rf $$d

.if ${.OBJDIR} == ${.CURDIR}
clean: cleanman
	-@cd ${.OBJDIR} && rm -f ${MUNGEDFILES} && ${MAKE} clean
.else
clean: cleanman
	@cd ${.OBJDIR} && find . \! -type d -print0 | xargs -0r rm
.endif

cleandir: clean

prereq:
# nothing left

test:
	# Nothing here so far...

depend:
	# Nothing here so far...

lint:
	# Nothing here so far...

tags:
	# Nothing here so far...

.ifdef NOMAN
maninstall:
	@echo NOMAN is set
cleanman:
	@echo NOMAN is set
.endif

htmlinstall:
	@-for i in ${MANUALFILES}; do \
		j=`dirname $$i | sed 's;^manual/*;;'`; \
		k=`basename $$i`; \
		echo "Installing ${DESTDIR}${HTTPD_MANUALDIR}/$$j/$$k"; \
		${INSTALL} ${INSTALL_COPY} -g ${BINGRP} -m 444 \
		    ${.OBJDIR}/htdocs/$$i ${DESTDIR}${HTTPD_MANUALDIR}/$$j/; \
	done

distribution:
	@-for i in ${MODCONFDIR}; do \
		echo "Installing ${DESTDIR}${HTTPD_SYSCONFDIR}/$$i"; \
		${INSTALL} -d -m 755 ${DESTDIR}${HTTPD_SYSCONFDIR}/$$i; \
	done
	@-for i in ${CONFFILES}; do \
		j=`dirname $$i`; \
		echo "Installing ${DESTDIR}${HTTPD_PREFIX}/$$i"; \
		${INSTALL} ${INSTALL_COPY} -g ${BINGRP} -m 444 \
		    ${.OBJDIR}/$$i ${DESTDIR}${HTTPD_PREFIX}/$$j/; \
	done
	@-for i in ${HTDOCS}; do \
		j=`dirname $$i`; \
		echo "Installing ${DESTDIR}${HTTPD_PREFIX}/$$i"; \
		${INSTALL} ${INSTALL_COPY} -g ${BINGRP} -m 444 \
		    ${.OBJDIR}/$$i ${DESTDIR}${HTTPD_PREFIX}/$$j/; \
	done
	@-for i in ${CGIFILES}; do \
		j=`dirname $$i`; \
		echo "Installing ${DESTDIR}${HTTPD_PREFIX}/$$i"; \
		${INSTALL} ${INSTALL_COPY} -g ${BINGRP} -m 000 \
		    ${.OBJDIR}/$$i ${DESTDIR}${HTTPD_PREFIX}/$$j/; \
	done
	@-for i in ${ICONFILES}; do \
		j=`dirname $$i`; \
		echo "Installing ${DESTDIR}${HTTPD_PREFIX}/$$i"; \
		${INSTALL} ${INSTALL_COPY} -g ${BINGRP} -m 444 \
		    ${.OBJDIR}/$$i ${DESTDIR}${HTTPD_PREFIX}/$$j/; \
	done

.include <bsd.obj.mk>
.include <bsd.subdir.mk>
.ifndef NOMAN
.include <bsd.man.mk>
.endif