1996-09-24 19:46:04 +02:00
|
|
|
# bsd.web.mk
|
2003-11-25 16:12:42 +01:00
|
|
|
# $FreeBSD: www/share/mk/web.site.mk,v 1.48 2003/11/24 18:26:34 hrs 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
|
|
|
|
2001-10-29 11:14:33 +01:00
|
|
|
CP?= /bin/cp
|
|
|
|
CVS?= /usr/bin/cvs
|
|
|
|
ECHO_CMD?= echo
|
|
|
|
SETENV?= /usr/bin/env
|
|
|
|
LN?= /bin/ln
|
|
|
|
MKDIR?= /bin/mkdir
|
|
|
|
MV?= /bin/mv
|
|
|
|
PERL?= /usr/bin/perl5
|
|
|
|
RM?= /bin/rm
|
|
|
|
SED?= /usr/bin/sed
|
|
|
|
SH?= /bin/sh
|
|
|
|
SORT?= /usr/bin/sort
|
|
|
|
TOUCH?= /usr/bin/touch
|
2003-04-20 23:03:24 +02:00
|
|
|
HTML2TXT?= ${PREFIX}/bin/w3m
|
2002-03-13 14:09:45 +01:00
|
|
|
HTML2TXTOPTS?= -dump ${HTML2TXTFLAGS}
|
|
|
|
ISPELL?= ispell
|
2003-04-20 23:03:24 +02:00
|
|
|
ISPELLOPTS?= -l -p /usr/share/dict/freebsd ${ISPELLFLAGS}
|
2001-10-29 11:14:33 +01:00
|
|
|
|
|
|
|
XSLTPROC?= ${PREFIX}/bin/xsltproc
|
2003-11-25 16:12:42 +01:00
|
|
|
XSLTPROCOPTS?= ${XSLTPROCFLAGS}
|
2001-10-29 11:14:33 +01:00
|
|
|
TIDY?= ${PREFIX}/bin/tidy
|
2002-08-07 05:17:10 +02:00
|
|
|
TIDYOPTS?= -i -m -raw -preserve -f /dev/null -asxml ${TIDYFLAGS}
|
2000-04-20 18:39:10 +02:00
|
|
|
|
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
|
|
|
|
|
2003-05-11 23:24:42 +02:00
|
|
|
#
|
|
|
|
# Instruction for bsd.subdir.mk to not to process SUBDIR directive.
|
|
|
|
# It is not neccessary since web.site.mk do it too.
|
|
|
|
#
|
2003-06-24 12:24:59 +02:00
|
|
|
NO_SUBDIR= YES
|
2003-05-11 23:24:42 +02:00
|
|
|
|
2003-11-24 19:26:35 +01:00
|
|
|
#
|
|
|
|
# for dependency
|
|
|
|
#
|
|
|
|
DOC_PREFIX?= ${WEB_PREFIX}/../doc
|
|
|
|
.include "${DOC_PREFIX}/share/mk/doc.common.mk"
|
|
|
|
|
|
|
|
XML_NEWS_NEWS_MASTER= ${WEB_PREFIX}/en/news/news.xml
|
|
|
|
XML_NEWS_NEWS= ${WEB_PREFIX}/${WWW_LANGCODE}/news/news.xml
|
|
|
|
XML_NEWS_PRESS_MASTER= ${WEB_PREFIX}/en/news/press.xml
|
|
|
|
XML_NEWS_PRESS= ${WEB_PREFIX}/${WWW_LANGCODE}/news/press.xml
|
|
|
|
XML_NEWS_INCLUDES_MASTER= ${WEB_PREFIX}/en/news/includes.xsl
|
|
|
|
XML_NEWS_INCLUDES= ${WEB_PREFIX}/${WWW_LANGCODE}/news/includes.xsl
|
|
|
|
|
|
|
|
XML_INCLUDES= ${WEB_PREFIX}/${WWW_LANGCODE}/includes.xsl
|
|
|
|
XML_INCLUDES+= ${WEB_PREFIX}/share/sgml/includes.header.xsl
|
|
|
|
XML_INCLUDES+= ${WEB_PREFIX}/share/sgml/includes.misc.xsl
|
|
|
|
XML_INCLUDES+= ${WEB_PREFIX}/share/sgml/includes.release.xsl
|
|
|
|
XML_INCLUDES+= ${WEB_PREFIX}/share/sgml/includes.xsl
|
|
|
|
|
|
|
|
SGML_INCLUDES= ${WEB_PREFIX}/${WWW_LANGCODE}/includes.sgml
|
|
|
|
SGML_INCLUDES+= ${WEB_PREFIX}/share/sgml/includes.header.sgml
|
|
|
|
SGML_INCLUDES+= ${WEB_PREFIX}/share/sgml/includes.misc.sgml
|
|
|
|
SGML_INCLUDES+= ${WEB_PREFIX}/share/sgml/includes.release.sgml
|
|
|
|
SGML_INCLUDES+= ${WEB_PREFIX}/share/sgml/includes.sgml
|
|
|
|
|
|
|
|
|
1996-09-24 19:46:04 +02:00
|
|
|
##################################################################
|
|
|
|
# Transformation rules
|
|
|
|
|
|
|
|
###
|
|
|
|
# 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.
|
|
|
|
|
2000-11-22 03:35:42 +01:00
|
|
|
.SUFFIXES: .sgml .html
|
2000-10-02 11:16:24 +02:00
|
|
|
.if defined(REVCHECK)
|
2001-12-12 12:57:44 +01:00
|
|
|
PREHTML?= ${WEB_PREFIX}/ja/prehtml
|
2001-10-29 11:14:33 +01:00
|
|
|
CANONPREFIX0!= cd ${WEB_PREFIX}; ${ECHO_CMD} $${PWD};
|
2000-11-07 12:39:40 +01:00
|
|
|
CANONPREFIX= ${PWD:S/^${CANONPREFIX0}//:S/^\///}
|
2001-10-29 11:14:33 +01:00
|
|
|
LOCALTOP!= ${ECHO_CMD} ${CANONPREFIX} | \
|
|
|
|
${PERL} -pe 's@[^/]+@..@g; $$_.="/." if($$_ eq".."); s@^\.\./@@;'
|
|
|
|
DIR_IN_LOCAL!= ${ECHO_CMD} ${CANONPREFIX} | ${PERL} -pe 's@^[^/]+/?@@;'
|
2001-12-12 12:57:44 +01:00
|
|
|
PREHTMLOPTS?= -revcheck "${LOCALTOP}" "${DIR_IN_LOCAL}" ${PREHTMLFLAGS}
|
2000-10-02 11:16:24 +02:00
|
|
|
.else
|
2001-12-12 12:57:44 +01:00
|
|
|
DATESUBST?= 's/<!ENTITY date[ \t]*"$$Free[B]SD. .* \(.* .*\) .* .* $$">/<!ENTITY date "Last modified: \1">/'
|
|
|
|
PREHTML?= ${SED} -e ${DATESUBST}
|
2000-10-02 11:16:24 +02:00
|
|
|
.endif
|
2000-10-02 09:52:48 +02:00
|
|
|
.if !defined(OPENJADE)
|
2001-12-12 12:57:44 +01:00
|
|
|
SGMLNORM?= ${PREFIX}/bin/sgmlnorm
|
2000-10-02 09:52:48 +02:00
|
|
|
.else
|
2001-12-12 12:57:44 +01:00
|
|
|
SGMLNORM?= ${PREFIX}/bin/osgmlnorm
|
2000-10-02 09:52:48 +02:00
|
|
|
.endif
|
2001-10-29 11:14:33 +01:00
|
|
|
LOCALBASE?= /usr/local
|
|
|
|
PREFIX?= ${LOCALBASE}
|
1999-09-19 13:56:18 +02:00
|
|
|
CATALOG?= ${PREFIX}/share/sgml/html/catalog
|
2001-12-12 12:57:44 +01:00
|
|
|
SGMLNORMOPTS?= -d ${SGMLNORMFLAGS} -c ${CATALOG} -D ${.CURDIR}
|
1996-09-24 19:46:04 +02:00
|
|
|
GENDOCS+= ${DOCS:M*.sgml:S/.sgml$/.html/g}
|
|
|
|
ORPHANS:= ${ORPHANS:N*.sgml}
|
|
|
|
|
2002-03-13 14:09:45 +01:00
|
|
|
spellcheck:
|
|
|
|
.for _entry in ${GENDOCS}
|
|
|
|
@echo "Spellcheck ${_entry}"
|
|
|
|
@${HTML2TXT} ${HTML2TXTOPTS} ${.CURDIR}/${_entry} | ${ISPELL} ${ISPELLOPTS}
|
|
|
|
.endfor
|
|
|
|
|
2003-11-24 19:26:35 +01:00
|
|
|
.sgml.html: ${SGML_INCLUDES}
|
2001-12-12 12:57:44 +01:00
|
|
|
${PREHTML} ${PREHTMLOPTS} ${.IMPSRC} | \
|
2001-10-29 11:14:33 +01:00
|
|
|
${SETENV} SGML_CATALOG_FILES= \
|
2001-12-12 12:57:44 +01:00
|
|
|
${SGMLNORM} ${SGMLNORMOPTS} > ${.TARGET} || \
|
2001-10-29 11:14:33 +01:00
|
|
|
(${RM} -f ${.TARGET} && false)
|
|
|
|
.if !defined(NO_TIDY)
|
2001-12-12 12:57:44 +01:00
|
|
|
-${TIDY} ${TIDYOPTS} ${.TARGET}
|
2001-10-29 11:14:33 +01:00
|
|
|
.endif
|
1996-09-24 19:46:04 +02:00
|
|
|
|
1997-01-18 03:25:01 +01:00
|
|
|
###
|
|
|
|
# file.docb --> file.html
|
|
|
|
#
|
|
|
|
# Generate HTML from docbook
|
|
|
|
|
2001-10-29 11:14:33 +01:00
|
|
|
SGMLFMT?= ${PREFIX}/bin/sgmlfmt
|
2001-12-12 12:57:44 +01:00
|
|
|
SGMLFMTOPTS?= -d docbook -f html ${SGMLFMTFLAGS} ${SGMLFLAGS}
|
1997-01-18 03:25:01 +01:00
|
|
|
.SUFFIXES: .docb
|
|
|
|
GENDOCS+= ${DOCS:M*.docb:S/.docb$/.html/g}
|
|
|
|
ORPHANS:= ${ORPHANS:N*.docb}
|
|
|
|
|
|
|
|
.docb.html:
|
2001-12-12 12:57:44 +01:00
|
|
|
${SGMLFMT} ${SGMLFMTOPTS} ${.IMPSRC}
|
2001-10-29 11:14:33 +01:00
|
|
|
.if !defined(NO_TIDY)
|
2001-12-12 12:57:44 +01:00
|
|
|
-${TIDY} ${TIDYOPTS} ${.TARGET}
|
2001-10-29 11:14:33 +01:00
|
|
|
.endif
|
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:
|
2001-10-29 11:14:33 +01:00
|
|
|
@${ECHO} Warning! I don\'t know what to do with: ${ORPHANS}
|
1996-09-24 19:46:04 +02:00
|
|
|
.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}
|
2001-10-29 11:14:33 +01:00
|
|
|
cd ${.CURDIR}/${dir}; ${MAKE} clean
|
2000-04-23 16:31:21 +02:00
|
|
|
.endfor
|
|
|
|
.endif
|
2001-10-29 11:14:33 +01:00
|
|
|
${RM} -f Errs errs mklog ${GENDOCS} ${LOCAL} ${CLEANFILES}
|
1996-09-24 19:46:04 +02:00
|
|
|
.endif
|
|
|
|
|
|
|
|
#
|
|
|
|
# Really clean things up
|
|
|
|
#
|
|
|
|
.if !target(cleandir)
|
|
|
|
cleandir: clean _PROGSUBDIR
|
2001-10-29 11:14:33 +01:00
|
|
|
${RM} -f ${.CURDIR}/tags .depend
|
|
|
|
cd ${.CURDIR}; ${RM} -rf obj
|
1996-09-24 19:46:04 +02:00
|
|
|
.endif
|
|
|
|
|
|
|
|
#
|
|
|
|
# Install targets: before, real, and after.
|
|
|
|
#
|
|
|
|
.if !target(install)
|
|
|
|
.if !target(beforeinstall)
|
|
|
|
beforeinstall:
|
|
|
|
.endif
|
|
|
|
.if !target(afterinstall)
|
|
|
|
afterinstall:
|
|
|
|
.endif
|
|
|
|
|
2001-10-29 11:14:33 +01:00
|
|
|
INSTALL_WEB?= \
|
|
|
|
${INSTALL} ${COPY} ${INSTALLFLAGS} -o ${WEBOWN} -g ${WEBGRP} -m ${WEBMODE}
|
|
|
|
INSTALL_CGI?= \
|
|
|
|
${INSTALL} ${COPY} ${INSTALLFLAGS} -o ${CGIOWN} -g ${CGIGRP} -m ${CGIMODE}
|
1998-07-23 12:59:00 +02:00
|
|
|
_ALLINSTALL+= ${GENDOCS} ${DATA} ${LOCAL}
|
1996-09-24 19:46:04 +02:00
|
|
|
|
2001-10-29 11:14:33 +01:00
|
|
|
realinstall: ${COOKIE} ${_ALLINSTALL} ${CGI} _PROGSUBDIR
|
1996-09-24 19:46:04 +02:00
|
|
|
.if !empty(_ALLINSTALL)
|
2001-10-29 11:14:33 +01:00
|
|
|
@${MKDIR} -p ${DOCINSTALLDIR}
|
|
|
|
.for entry in ${_ALLINSTALL}
|
|
|
|
.if exists(${.CURDIR}/${entry})
|
|
|
|
${INSTALL_WEB} ${.CURDIR}/${entry} ${DOCINSTALLDIR}
|
|
|
|
.else
|
|
|
|
${INSTALL_WEB} ${entry} ${DOCINSTALLDIR}
|
|
|
|
.endif
|
|
|
|
.endfor
|
1997-01-18 03:25:01 +01:00
|
|
|
.if defined(INDEXLINK) && !empty(INDEXLINK)
|
2001-10-29 11:14:33 +01:00
|
|
|
cd ${DOCINSTALLDIR}; ${LN} -fs ${INDEXLINK} index.html
|
1997-01-18 03:25:01 +01:00
|
|
|
.endif
|
1996-09-24 19:46:04 +02:00
|
|
|
.endif
|
|
|
|
.if defined(CGI) && !empty(CGI)
|
2001-10-29 11:14:33 +01:00
|
|
|
@${MKDIR} -p ${CGIINSTALLDIR}
|
|
|
|
.for entry in ${CGI}
|
|
|
|
${INSTALL_CGI} ${.CURDIR}/${entry} ${CGIINSTALLDIR}
|
|
|
|
.endfor
|
1996-09-24 19:46:04 +02:00
|
|
|
.endif
|
|
|
|
.if defined(DOCSUBDIR) && !empty(DOCSUBDIR)
|
2001-10-29 11:14:33 +01:00
|
|
|
.for entry in ${DOCSUBDIR}
|
|
|
|
@${MKDIR} -p ${DOCINSTALLDIR}/${entry}
|
|
|
|
.endfor
|
1996-09-24 19:46:04 +02:00
|
|
|
.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)
|
2001-10-29 11:14:33 +01:00
|
|
|
.for entry in ${SUBDIR}
|
|
|
|
@${ECHODIR} "===> ${DIRPRFX}${entry}"
|
|
|
|
@cd ${.CURDIR}/${entry}; \
|
|
|
|
${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/} \
|
|
|
|
DIRPRFX=${DIRPRFX}${entry}/
|
|
|
|
.endfor
|
1996-09-24 19:46:04 +02:00
|
|
|
.endif
|
|
|
|
.if defined(DOCSUBDIR) && !empty(DOCSUBDIR)
|
2001-10-29 11:14:33 +01:00
|
|
|
.for entry in ${DOCSUBDIR}
|
|
|
|
@${ECHODIR} "===> ${DIRPRFX}${entry}"
|
2001-10-30 17:51:34 +01:00
|
|
|
@if [ \( "${WEBDIR}" = "data" -a "${entry}" = "handbook" \) -o "${entry}" = "docproj-primer" ]; then \
|
|
|
|
cd ${.CURDIR}/${entry}; \
|
2001-10-29 11:14:33 +01:00
|
|
|
${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/} \
|
|
|
|
DIRPRFX=${DIRPRFX}${entry}/ ${PARAMS} \
|
2001-10-30 17:51:34 +01:00
|
|
|
FORMATS="txt html html-split"; \
|
|
|
|
elif [ "${WEBDIR}" = "data/ja" -a "${entry}" = "handbook" ]; then \
|
|
|
|
cd ${.CURDIR}/${entry}; \
|
2001-10-29 11:14:33 +01:00
|
|
|
${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/} \
|
|
|
|
DIRPRFX=${DIRPRFX}${entry}/ ${PARAMS} \
|
2001-10-30 17:51:34 +01:00
|
|
|
FORMATS="html html-split"; \
|
|
|
|
else \
|
|
|
|
cd ${.CURDIR}/${entry}; \
|
2001-10-29 11:14:33 +01:00
|
|
|
${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/} \
|
2001-10-30 17:51:34 +01:00
|
|
|
DIRPRFX=${DIRPRFX}${entry}/ ${PARAMS}; \
|
|
|
|
fi
|
2001-10-29 11:14:33 +01:00
|
|
|
.endfor
|
1996-09-24 19:46:04 +02:00
|
|
|
.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
|
|
|
|
|
2000-09-30 02:21:39 +02:00
|
|
|
.include <bsd.obj.mk>
|
2001-10-29 11:14:33 +01:00
|
|
|
|
1996-09-24 19:46:04 +02:00
|
|
|
# THE END
|