1996-09-24 19:46:04 +02:00
|
|
|
# bsd.web.mk
|
2000-04-29 09:50:27 +02:00
|
|
|
# $FreeBSD: www/en/web.mk,v 1.29 2000/04/23 14:31:21 phantom Exp $
|
1996-09-24 19:46:04 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Build and install a web site.
|
|
|
|
#
|
|
|
|
# Basic targets:
|
|
|
|
#
|
|
|
|
# all (default) -- performs batch mode processing necessary
|
|
|
|
# install -- Installs everything
|
|
|
|
# clean -- remove anything generated by processing
|
|
|
|
#
|
|
|
|
|
|
|
|
.if exists(${.CURDIR}/../Makefile.inc)
|
|
|
|
.include "${.CURDIR}/../Makefile.inc"
|
|
|
|
.endif
|
|
|
|
|
|
|
|
WEBDIR?= ${.CURDIR:T}
|
|
|
|
CGIDIR?= ${.CURDIR:T}
|
|
|
|
DESTDIR?= ${HOME}/public_html
|
|
|
|
|
|
|
|
WEBOWN?= ${USER}
|
1997-03-11 16:12:30 +01:00
|
|
|
WEBGRP?= www
|
|
|
|
WEBMODE?= 664
|
1996-09-24 19:46:04 +02:00
|
|
|
|
|
|
|
CGIOWN?= ${USER}
|
1997-03-11 16:12:30 +01:00
|
|
|
CGIGRP?= www
|
|
|
|
CGIMODE?= 775
|
1996-09-24 19:46:04 +02:00
|
|
|
|
2000-04-20 18:39:10 +02:00
|
|
|
PERL?= perl5
|
|
|
|
|
1996-09-24 19:46:04 +02:00
|
|
|
#
|
|
|
|
# Install dirs derived from the above.
|
|
|
|
#
|
|
|
|
DOCINSTALLDIR= ${DESTDIR}${WEBBASE}/${WEBDIR}
|
|
|
|
CGIINSTALLDIR= ${DESTDIR}${WEBBASE}/${CGIDIR}
|
|
|
|
|
|
|
|
#
|
|
|
|
# The orphan list contains sources specified in DOCS that there
|
|
|
|
# is no transform rule for. We start out with all of them, and
|
|
|
|
# each rule below removes the ones it knows about. If any are
|
|
|
|
# left over at the end, the user is warned about them.
|
|
|
|
#
|
|
|
|
ORPHANS:= ${DOCS}
|
|
|
|
|
1998-01-18 23:27:43 +01:00
|
|
|
COPY= -C
|
1996-09-24 19:46:04 +02:00
|
|
|
|
1999-04-08 23:50:03 +02:00
|
|
|
#
|
|
|
|
# Where the ports live, if CVS isn't used (ie. NOPORTSCVS is defined)
|
|
|
|
#
|
|
|
|
PORTSBASE?= /usr
|
|
|
|
|
1996-09-24 19:46:04 +02:00
|
|
|
##################################################################
|
|
|
|
# Transformation rules
|
|
|
|
|
1999-12-23 02:14:38 +01:00
|
|
|
###
|
|
|
|
# file.sgml --> file.revinc
|
|
|
|
#
|
|
|
|
# Generate temporary file for translation revision checking
|
|
|
|
.SUFFIXES: .sgml .revinc
|
|
|
|
GENDOCS+= ${REVFILES}
|
|
|
|
.sgml.revinc:
|
|
|
|
if [ -f ${BUILDTOP}/en/${DIR_IN_LOCAL}/${.IMPSRC} ]; then \
|
|
|
|
${BUILDTOP}/ja/revcheck ${BUILDTOP} ${DIR_IN_LOCAL} ${.IMPSRC} > ${.TARGET}; \
|
|
|
|
else \
|
|
|
|
touch ${.TARGET}; \
|
|
|
|
fi
|
|
|
|
|
1996-09-24 19:46:04 +02:00
|
|
|
###
|
|
|
|
# file.sgml --> file.html
|
|
|
|
#
|
|
|
|
# Runs file.sgml through spam to validate and expand some entity
|
|
|
|
# references are expanded. file.html is added to the list of
|
|
|
|
# things to install.
|
|
|
|
|
1999-12-23 02:14:38 +01:00
|
|
|
.SUFFIXES: .html
|
1996-09-24 19:46:04 +02:00
|
|
|
SGMLNORM= sgmlnorm
|
1999-09-19 13:56:18 +02:00
|
|
|
PREFIX?= /usr/local
|
|
|
|
CATALOG?= ${PREFIX}/share/sgml/html/catalog
|
1996-09-24 19:46:04 +02:00
|
|
|
SGMLNORMFLAGS= -d ${SGMLNORMOPTS} -c ${CATALOG}
|
|
|
|
GENDOCS+= ${DOCS:M*.sgml:S/.sgml$/.html/g}
|
|
|
|
ORPHANS:= ${ORPHANS:N*.sgml}
|
1999-11-29 16:11:56 +01:00
|
|
|
DATESUBST= 's/<!ENTITY date[ \t]*"$$Free[B]SD. .* \(.* .*\) .* .* $$">/<!ENTITY date "Last modified: \1">/'
|
1996-09-24 19:46:04 +02:00
|
|
|
|
|
|
|
.sgml.html:
|
1999-11-28 23:32:38 +01:00
|
|
|
sed -e ${DATESUBST} ${.IMPSRC} |\
|
2000-04-29 09:50:27 +02:00
|
|
|
SGML_CATALOG_FILES='' ${SGMLNORM} ${SGMLNORMFLAGS} > ${.TARGET}
|
1996-09-24 19:46:04 +02:00
|
|
|
|
1997-01-18 03:25:01 +01:00
|
|
|
###
|
|
|
|
# file.docb --> file.html
|
|
|
|
#
|
|
|
|
# Generate HTML from docbook
|
|
|
|
|
|
|
|
.SUFFIXES: .docb
|
|
|
|
GENDOCS+= ${DOCS:M*.docb:S/.docb$/.html/g}
|
|
|
|
ORPHANS:= ${ORPHANS:N*.docb}
|
|
|
|
|
|
|
|
.docb.html:
|
1997-01-19 22:29:03 +01:00
|
|
|
sgmlfmt -d docbook -f html ${SGMLOPTS} ${.IMPSRC}
|
1997-01-18 03:25:01 +01:00
|
|
|
|
1996-09-24 19:46:04 +02:00
|
|
|
|
|
|
|
##################################################################
|
|
|
|
# Targets
|
|
|
|
|
|
|
|
#
|
|
|
|
# If no target is specified, .MAIN is made
|
|
|
|
#
|
|
|
|
.MAIN: all
|
|
|
|
|
|
|
|
#
|
|
|
|
# Build most everything
|
|
|
|
#
|
1998-01-18 23:27:43 +01:00
|
|
|
all: ${COOKIE} orphans ${GENDOCS} ${DATA} ${LOCAL} ${CGI} _PROGSUBDIR
|
1996-09-24 19:46:04 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Warn about anything in DOCS that has no translation
|
|
|
|
#
|
|
|
|
.if !empty(ORPHANS)
|
|
|
|
orphans:
|
|
|
|
@echo Warning! I don\'t know what to do with: ${ORPHANS}
|
|
|
|
.else
|
|
|
|
orphans:
|
|
|
|
.endif
|
|
|
|
|
|
|
|
#
|
|
|
|
# Clean things up
|
|
|
|
#
|
|
|
|
.if !target(clean)
|
|
|
|
clean: _PROGSUBDIR
|
2000-04-23 16:31:21 +02:00
|
|
|
.if defined(DIRS_TO_CLEAN) && !empty(DIRS_TO_CLEAN)
|
|
|
|
.for dir in ${DIRS_TO_CLEAN}
|
|
|
|
(cd ${dir} && ${MAKE} clean)
|
|
|
|
.endfor
|
|
|
|
.endif
|
1996-09-24 19:46:04 +02:00
|
|
|
rm -f Errs errs mklog ${GENDOCS} ${LOCAL} ${CLEANFILES}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
#
|
|
|
|
# Really clean things up
|
|
|
|
#
|
|
|
|
.if !target(cleandir)
|
|
|
|
cleandir: clean _PROGSUBDIR
|
|
|
|
rm -f ${.CURDIR}/tags .depend
|
|
|
|
cd ${.CURDIR}; rm -rf obj;
|
|
|
|
.endif
|
|
|
|
|
|
|
|
#
|
|
|
|
# Install targets: before, real, and after.
|
|
|
|
#
|
|
|
|
.if !target(install)
|
|
|
|
.if !target(beforeinstall)
|
|
|
|
beforeinstall:
|
|
|
|
.endif
|
|
|
|
.if !target(afterinstall)
|
|
|
|
afterinstall:
|
|
|
|
.endif
|
|
|
|
|
1998-07-23 12:59:00 +02:00
|
|
|
_ALLINSTALL+= ${GENDOCS} ${DATA} ${LOCAL}
|
1996-09-24 19:46:04 +02:00
|
|
|
|
|
|
|
realinstall: ${COOKIE} ${GENDOCS} ${DATA} ${LOCAL} ${CGI} _PROGSUBDIR
|
|
|
|
.if !empty(_ALLINSTALL)
|
|
|
|
@mkdir -p ${DOCINSTALLDIR}
|
|
|
|
for entry in ${_ALLINSTALL}; do \
|
|
|
|
${INSTALL} ${COPY} -o ${WEBOWN} -g ${WEBGRP} -m ${WEBMODE} \
|
|
|
|
${INSTALLFLAGS} $${entry} ${DOCINSTALLDIR}; \
|
|
|
|
done
|
1997-01-18 03:25:01 +01:00
|
|
|
.if defined(INDEXLINK) && !empty(INDEXLINK)
|
|
|
|
(cd ${DOCINSTALLDIR}; ln -s -f ${INDEXLINK} index.html)
|
|
|
|
.endif
|
1996-09-24 19:46:04 +02:00
|
|
|
.endif
|
|
|
|
.if defined(CGI) && !empty(CGI)
|
|
|
|
@mkdir -p ${CGIINSTALLDIR}
|
|
|
|
for entry in ${CGI}; do \
|
|
|
|
${INSTALL} ${COPY} -o ${CGIOWN} -g ${CGIGRP} -m ${CGIMODE} \
|
|
|
|
${INSTALLFLAGS} $${entry} ${CGIINSTALLDIR}; \
|
|
|
|
done
|
|
|
|
.endif
|
|
|
|
.if defined(DOCSUBDIR) && !empty(DOCSUBDIR)
|
|
|
|
for entry in ${DOCSUBDIR}; do \
|
|
|
|
mkdir -p ${DOCINSTALLDIR}/$$entry; \
|
|
|
|
done
|
|
|
|
.endif
|
|
|
|
|
|
|
|
# Set up install dependencies so they happen in the correct order.
|
|
|
|
install: afterinstall
|
|
|
|
afterinstall: realinstall2
|
|
|
|
realinstall: beforeinstall
|
|
|
|
realinstall2: realinstall
|
|
|
|
.endif
|
|
|
|
|
|
|
|
#
|
|
|
|
# This recursively calls make in subdirectories.
|
|
|
|
#
|
|
|
|
#SUBDIR+=${DOCSUBDIR}
|
|
|
|
_PROGSUBDIR: .USE
|
|
|
|
.if defined(SUBDIR) && !empty(SUBDIR)
|
|
|
|
@for entry in ${SUBDIR}; do \
|
|
|
|
(${ECHODIR} "===> ${DIRPRFX}$$entry"; \
|
1999-09-03 16:01:15 +02:00
|
|
|
cd ${.CURDIR}/$${entry} && \
|
1996-09-24 19:46:04 +02:00
|
|
|
${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/} DIRPRFX=${DIRPRFX}$$entry/); \
|
|
|
|
done
|
|
|
|
.endif
|
|
|
|
.if defined(DOCSUBDIR) && !empty(DOCSUBDIR)
|
|
|
|
@for entry in ${DOCSUBDIR}; do \
|
|
|
|
(${ECHODIR} "===> ${DIRPRFX}$$entry"; \
|
1999-09-03 16:01:15 +02:00
|
|
|
cd ${.CURDIR}/$${entry} && \
|
1999-04-27 20:31:42 +02:00
|
|
|
if [ ${WEBDIR} = "data" -a $$entry = "handbook" -o $$entry = "docproj-primer" ]; then \
|
1999-04-03 00:06:58 +02:00
|
|
|
${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/} DIRPRFX=${DIRPRFX}$$entry/ ${PARAMS} FORMATS="txt html html-split"; \
|
1999-04-11 02:43:53 +02:00
|
|
|
elif [ $$entry = "handbook" -a ${WEBDIR} = "data/ja" ]; then \
|
|
|
|
${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/} DIRPRFX=${DIRPRFX}$$entry/ ${PARAMS} FORMATS="html html-split"; \
|
1999-03-27 16:46:31 +01:00
|
|
|
else \
|
|
|
|
${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/} DIRPRFX=${DIRPRFX}$$entry/ ${PARAMS}; \
|
|
|
|
fi); \
|
1996-09-24 19:46:04 +02:00
|
|
|
done
|
|
|
|
.endif
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# cruft for generating linuxdoc stuff
|
|
|
|
#
|
|
|
|
|
|
|
|
.if defined (DOCSUBDIR) && !empty(DOCSUBDIR)
|
|
|
|
|
1996-10-02 01:41:29 +02:00
|
|
|
FORMATS?= "html ps latin1 ascii"
|
1996-09-24 19:46:04 +02:00
|
|
|
PARAMS= DESTDIR=${DESTDIR} DOCDIR=${WEBBASE}/${WEBDIR}
|
|
|
|
PARAMS+= DOCOWN=${WEBOWN} DOCGRP=${WEBGRP}
|
1996-10-06 02:08:28 +02:00
|
|
|
PARAMS+= FORMATS=${FORMATS} COPY="${COPY}"
|
1998-01-18 23:27:43 +01:00
|
|
|
PARAMS+= SGMLOPTS="${SGMLOPTS}"
|
1996-09-24 19:46:04 +02:00
|
|
|
|
|
|
|
.endif
|
|
|
|
|
|
|
|
# THE END
|