2003-11-24 19:26:35 +01:00
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
# This include file <doc.common.mk> provides targets and variables for
|
|
|
|
# documents commonly used in doc/ and www/ tree.
|
|
|
|
#
|
|
|
|
|
Improve transtable.{xml,xsl}, including:
- The structure of transtable.xml is revised. <word> should be
bracketed with <group>.
- A sorting order of the FreeBSD mirror sites rendered using
mirrors.xml has been determined by sort(1).
- A template "transtable-lookup" has been added for localization on
word-by-word basis.
- Replace English month names in news.xml, press.xml, and
advisories.xml with numbers that correspond to the names.
The number->name translation is performed on the fly.
- Since information in mirrors.xml is used in www/ tree, it depends on
doc/ tree now. When WITHOUT_DOC is defined it can be built without
doc/ tree, but some information becomes unavailable. For example,
a list of the mirror sites generated in index.html becomes a dummy
one, and calling "transtable-lookup" with a word returns the word
itself.
Neither www/ nor doc/ build should be broken due to this commit, but
until the necessary changes are applied in the localized directories,
the transtable does not work; it simply generates non-localized contents
even if transtable.xsl is used.
2004-01-12 22:27:01 +01:00
|
|
|
AWK?= /usr/bin/awk
|
|
|
|
GREP?= /usr/bin/grep
|
2004-05-11 12:35:19 +02:00
|
|
|
REALPATH?= /bin/realpath
|
2006-11-02 19:58:17 +01:00
|
|
|
SED?= /usr/bin/sed
|
Improve transtable.{xml,xsl}, including:
- The structure of transtable.xml is revised. <word> should be
bracketed with <group>.
- A sorting order of the FreeBSD mirror sites rendered using
mirrors.xml has been determined by sort(1).
- A template "transtable-lookup" has been added for localization on
word-by-word basis.
- Replace English month names in news.xml, press.xml, and
advisories.xml with numbers that correspond to the names.
The number->name translation is performed on the fly.
- Since information in mirrors.xml is used in www/ tree, it depends on
doc/ tree now. When WITHOUT_DOC is defined it can be built without
doc/ tree, but some information becomes unavailable. For example,
a list of the mirror sites generated in index.html becomes a dummy
one, and calling "transtable-lookup" with a word returns the word
itself.
Neither www/ nor doc/ build should be broken due to this commit, but
until the necessary changes are applied in the localized directories,
the transtable does not work; it simply generates non-localized contents
even if transtable.xsl is used.
2004-01-12 22:27:01 +01:00
|
|
|
|
2003-11-24 19:26:35 +01:00
|
|
|
.if defined(DOC_PREFIX) && !empty(DOC_PREFIX)
|
|
|
|
WEB_PREFIX?= ${DOC_PREFIX}/../www
|
|
|
|
.elif defined(WEB_PREFIX) && !empty(WEB_PREFIX)
|
|
|
|
DOC_PREFIX?= ${WEB_PREFIX}/../doc
|
|
|
|
.else
|
|
|
|
.error "You must define either WEB_PREFIX or DOC_PREFIX!"
|
|
|
|
.endif
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Work out the language and encoding used for this document.
|
|
|
|
#
|
|
|
|
# Liberal default of maximum of 10 directories below to find it.
|
|
|
|
#
|
|
|
|
|
2004-01-07 00:57:46 +01:00
|
|
|
.if defined(DOC_PREFIX) && !empty(DOC_PREFIX)
|
2004-05-11 12:35:19 +02:00
|
|
|
DOC_PREFIX_NAME!= ${REALPATH} ${DOC_PREFIX}
|
2004-01-07 00:57:46 +01:00
|
|
|
DOC_PREFIX_NAME:= ${DOC_PREFIX_NAME:T}
|
|
|
|
.else
|
2003-11-24 19:26:35 +01:00
|
|
|
DOC_PREFIX_NAME?= doc
|
2004-01-07 00:57:46 +01:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if defined(WEB_PREFIX) && !empty(WEB_PREFIX)
|
2004-05-11 12:35:19 +02:00
|
|
|
WWW_PREFIX_NAME!= ${REALPATH} ${WEB_PREFIX}
|
2004-01-07 00:57:46 +01:00
|
|
|
WWW_PREFIX_NAME:= ${WWW_PREFIX_NAME:T}
|
|
|
|
.else
|
2003-11-24 19:26:35 +01:00
|
|
|
WWW_PREFIX_NAME?= www
|
2004-01-07 00:57:46 +01:00
|
|
|
.endif
|
2003-11-24 19:26:35 +01:00
|
|
|
|
2004-01-07 00:57:46 +01:00
|
|
|
.if (!defined(LANGCODE) || empty(LANGCODE)) && (!defined(WWW_LANGCODE) || empty(WWW_LANGCODE))
|
|
|
|
# Calculate _LANGCODE.
|
|
|
|
_LANGCODE:= ${.CURDIR}
|
2003-11-24 19:26:35 +01:00
|
|
|
.for _ in 1 2 3 4 5 6 7 8 9 10
|
2004-01-07 00:57:46 +01:00
|
|
|
.if !(${_LANGCODE:H:T} == ${DOC_PREFIX_NAME}) && !(${_LANGCODE:H:T} == ${WWW_PREFIX_NAME})
|
|
|
|
_LANGCODE:= ${_LANGCODE:H}
|
2003-11-24 19:26:35 +01:00
|
|
|
.endif
|
|
|
|
.endfor
|
2004-01-07 00:57:46 +01:00
|
|
|
.if (${_LANGCODE:H:T} == ${DOC_PREFIX_NAME})
|
2003-11-26 02:47:00 +01:00
|
|
|
# We are in doc/.
|
2004-01-07 00:57:46 +01:00
|
|
|
_LANGCODE:= ${_LANGCODE:T}
|
|
|
|
_WWW_LANGCODE:= .
|
2003-11-26 02:47:00 +01:00
|
|
|
.else
|
|
|
|
# We are in www/.
|
2004-01-07 00:57:46 +01:00
|
|
|
_WWW_LANGCODE:= ${_LANGCODE:T}
|
|
|
|
_LANGCODE:= .
|
|
|
|
.endif
|
|
|
|
.else
|
|
|
|
# when LANGCODE or WWW_LANGCODE is defined, use the value.
|
|
|
|
.if defined(LANGCODE) && !empty(LANGCODE)
|
|
|
|
_LANGCODE?= ${LANGCODE}
|
|
|
|
.else
|
|
|
|
_LANGCODE?= .
|
|
|
|
.endif
|
|
|
|
.if defined(WWW_LANGCODE) && !empty(WWW_LANGCODE)
|
|
|
|
_WWW_LANGCODE?= ${WWW_LANGCODE}
|
|
|
|
.else
|
|
|
|
_WWW_LANGCODE?= .
|
2003-11-26 02:47:00 +01:00
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
2004-01-07 00:57:46 +01:00
|
|
|
# fixup _LANGCODE
|
|
|
|
.if (${_LANGCODE} == .)
|
|
|
|
# We have a short name such as `en' in ${_WWW_LANGCODE} now.
|
|
|
|
# Guess _LANGCODE using _WWW_LANGCODE.
|
|
|
|
_LANGCODE:= ${_WWW_LANGCODE}
|
|
|
|
.if (${_LANGCODE} != .)
|
|
|
|
_LANGCODE!= ${ECHO} ${DOC_PREFIX}/${_WWW_LANGCODE}*
|
2003-11-24 19:26:35 +01:00
|
|
|
.for _ in 1 2 3 4 5 6 7 8 9 10
|
2004-01-07 00:57:46 +01:00
|
|
|
.if !(${_LANGCODE:H:T} == ${DOC_PREFIX_NAME})
|
|
|
|
_LANGCODE:= ${_LANGCODE:H}
|
2003-11-24 19:26:35 +01:00
|
|
|
.endif
|
|
|
|
.endfor
|
2004-01-07 00:57:46 +01:00
|
|
|
_LANGCODE:= ${_LANGCODE:T}
|
2003-11-24 19:26:35 +01:00
|
|
|
.endif
|
|
|
|
.endif
|
2004-01-07 00:57:46 +01:00
|
|
|
LANGCODE?= ${_LANGCODE}
|
2003-11-24 19:26:35 +01:00
|
|
|
|
2004-01-07 00:57:46 +01:00
|
|
|
# fixup _WWW_LANGCODE
|
|
|
|
.if (${_WWW_LANGCODE} == .)
|
2003-11-26 02:47:00 +01:00
|
|
|
# We have a long name such as `en_US.ISO8859-1' in ${LANGCODE} now.
|
2004-01-07 00:57:46 +01:00
|
|
|
# Guess _WWW_LANGCODE using _LANGCODE.
|
|
|
|
_WWW_LANGCODE!= ${ECHO} ${WEB_PREFIX}/*
|
|
|
|
_WWW2_LANGCODE!= ${ECHO} ${_WWW_LANGCODE:T} |\
|
2003-11-24 19:26:35 +01:00
|
|
|
${SED} -e 's,.*\(${LANGCODE:R:C,(..)_.*,\1,}[^. ]*\).*,\1,'
|
2005-09-18 10:19:20 +02:00
|
|
|
.if ${_WWW_LANGCODE:T} == "*"
|
|
|
|
_WWW_LANGCODE:= .
|
|
|
|
.elif ${_WWW_LANGCODE:T} == ${_WWW2_LANGCODE}
|
2004-01-07 00:57:46 +01:00
|
|
|
_WWW_LANGCODE:= .
|
2003-11-24 19:26:35 +01:00
|
|
|
.else
|
2004-01-07 00:57:46 +01:00
|
|
|
_WWW_LANGCODE:= ${_WWW2_LANGCODE}
|
2003-11-24 19:26:35 +01:00
|
|
|
.endif
|
2004-01-07 00:57:46 +01:00
|
|
|
.undef _WWW2_LANGCODE
|
2003-11-24 19:26:35 +01:00
|
|
|
.endif
|
2004-01-07 00:57:46 +01:00
|
|
|
WWW_LANGCODE?= ${_WWW_LANGCODE}
|
2003-11-24 19:26:35 +01:00
|
|
|
|
2004-05-11 12:35:19 +02:00
|
|
|
# normalize DOC_PREFIX and WEB_PREFIX
|
|
|
|
DOC_PREFIX!= ${REALPATH} ${DOC_PREFIX}
|
|
|
|
WEB_PREFIX!= ${REALPATH} ${WEB_PREFIX}
|
|
|
|
|
2006-08-21 20:27:43 +02:00
|
|
|
.if ${WWW_LANGCODE} == "en"
|
|
|
|
WEB_PREFIX_REL= ${.CURDIR:S,^${WEB_PREFIX},,:C,/[^/]+,/..,g:S,^/..,,:S,^/,,:S,^$,.,:S,^/..,,}
|
|
|
|
.else
|
|
|
|
WEB_PREFIX_REL= ${.CURDIR:S,^${WEB_PREFIX},,:C,/[^/]+,/..,g:S,^/..,,:S,^/,,:S,^$,.,}
|
|
|
|
.endif
|
|
|
|
|
2004-07-06 17:09:55 +02:00
|
|
|
.if !defined(URL_RELPREFIX)
|
|
|
|
URLS_ABSOLUTE= YES
|
|
|
|
.elif !defined(URLS_ABSOLUTE)
|
|
|
|
_URL_RELPREFIX_LEVEL!= set -- ${URL_RELPREFIX:S,/$,,:S,/, ,g}; echo "$$\#"
|
|
|
|
URL_RELPREFIX_ENT= freebsd.urls.relprefix.${_URL_RELPREFIX_LEVEL}
|
|
|
|
.endif
|
|
|
|
|
2004-05-05 14:52:48 +02:00
|
|
|
#
|
2004-05-11 12:59:48 +02:00
|
|
|
# when URLS_ABSOLUTE is specified, make
|
|
|
|
# %freebsd.urls.absolute; "INCLUDE".
|
2004-05-05 14:52:48 +02:00
|
|
|
#
|
2004-05-11 12:59:48 +02:00
|
|
|
.if defined(URLS_ABSOLUTE)
|
|
|
|
HTMLFLAGS+= -ifreebsd.urls.absolute
|
|
|
|
SGMLNORMFLAGS+= -ifreebsd.urls.absolute
|
|
|
|
NSGMLSFLAGS+= -ifreebsd.urls.absolute
|
2004-07-06 17:09:55 +02:00
|
|
|
.elif defined(URL_RELPREFIX_ENT) && !empty(URL_RELPREFIX_ENT)
|
|
|
|
HTMLFLAGS+= -i${URL_RELPREFIX_ENT}
|
|
|
|
SGMLNORMFLAGS+= -i${URL_RELPREFIX_ENT}
|
|
|
|
NSGMLSFLAGS+= -i${URL_RELPREFIX_ENT}
|
2004-05-05 14:52:48 +02:00
|
|
|
.endif
|
2004-05-12 14:58:12 +02:00
|
|
|
|
|
|
|
# for ascii and printable format, always use URLS_ABSOLUTE.
|
|
|
|
PRINTFLAGS+= -ifreebsd.urls.absolute
|
|
|
|
HTMLTXTFLAGS+= -ifreebsd.urls.absolute
|
2004-07-07 13:23:16 +02:00
|
|
|
OTHERFLAGS+= -ifreebsd.urls.absolute
|
2004-05-12 14:58:12 +02:00
|
|
|
|
|
|
|
# for packages, always use URLS_ABSOLUTE.
|
|
|
|
PKGMAKEFLAGS+= URLS_ABSOLUTE=yes
|