NetBSD/distrib/common/Makefile.mdset
lukem 001c68bd94 Rename a large chunk of the make(1) variables which refer to a
program/tool from "FOO" to "TOOL_FOO".  The new variables are:
	TOOL_ASN1_COMPILE  TOOL_CAP_MKDB  TOOL_CAT  TOOL_CKSUM  TOOL_COMPILE_ET
	TOOL_CONFIG  TOOL_CRUNCHGEN  TOOL_CTAGS  TOOL_DB  TOOL_EQN  TOOL_FGEN
	TOOL_GENCAT  TOOL_GROFF  TOOL_HEXDUMP  TOOL_INDXBIB  TOOL_INSTALLBOOT
	TOOL_INSTALL_INFO  TOOL_M4  TOOL_MAKEFS  TOOL_MAKEINFO  TOOL_MAKEWHATIS
	TOOL_MDSETIMAGE  TOOL_MENUC  TOOL_MKCSMAPPER  TOOL_MKESDB
	TOOL_MKLOCALE  TOOL_MKMAGIC  TOOL_MKTEMP  TOOL_MSGC  TOOL_MTREE
	TOOL_PAX  TOOL_PIC  TOOL_PREPMKBOOTIMAGE  TOOL_PWD_MKDB  TOOL_REFER
	TOOL_ROFF_ASCII  TOOL_ROFF_DVI  TOOL_ROFF_HTML  TOOL_ROFF_PS
	TOOL_ROFF_RAW  TOOL_RPCGEN  TOOL_SOELIM  TOOL_SUNLABEL  TOOL_TBL
	TOOL_UUDECODE  TOOL_VGRIND  TOOL_ZIC

For each, provide default in <bsd.sys.mk> of the form:
	TOOL_FOO?=	foo
and for the ${USETOOLS}=="yes" case in <bsd.own.mk>, provide override:
	TOOL_FOO=	${TOOLDIR}/bin/${_TOOL_PREFIX}foo

Document all of these in bsd.README.

This cleans up a chunk of potential (and actual) namespace collision
within our build infrastructure, as well as improves consistency in
the share/mk documentation and provision of appropriate defaults for
each of these variables.
2003-07-10 10:33:58 +00:00

138 lines
3.6 KiB
Makefile

# $NetBSD: Makefile.mdset,v 1.22 2003/07/10 10:34:05 lukem Exp $
#
# Makefile snippet to ${TOOL_MDSETIMAGE} file system images into kernels
#
#
# Required variables:
# NETBSDSRCDIR Top level of src tree (set by <bsd.own.mk>)
# MDSETTARGETS List of images to ${TOOL_MDSETIMAGE} into kernels,
# containing one or more tuples of the form:
# KERNEL IMAGE FILENAME
#
# The kernel is ${TOOL_MDSETIMAGE} with ${IMAGE},
# ${STRIP}ped (after the symbols are stored in
# ${FILENAME}.symbols.gz), and gzipped into
# ${FILENAME}.gz.
#
# If KERNEL does not contain a `/', use
# ${KERNOBJDIR}/KERNEL/netbsd as the kernel.
#
# If FILENAME is "-", use "netbsd-${KERNEL}" as
# the target name. This may not be a sensible
# name if KERNEL contains a `/'.
#
# Optional variables:
# MDSET_RELEASEDIR Where to install release kernels.
#
# MDSET_NOSTRIP.${FILENAME} If defined, don't strip ${FILENAME}
#
# MDSET_NOSYMBOLS.${FILENAME} If defined, don't generate
# ${FILENAME}.symbols.gz
#
# MDSET_POST.${FILENAME} For each kernel named ${FILENAME},
# execute this after ${NM} / ${STRIP}.
# Kernel is available as "${.TARGET}"
#
# MDSET_SUFFIXES.${FILENAME} List of extra install kernel suffixes
# and build commands to create from
# ${FILENAME} after its created by
# ${TOOL_MDSETIMAGE} ; ${NM} ; ${STRIP}:
# SUFFIX COMMANDVAR
# "${.TARGET}" is "${FILENAME}.${SUFFIX}"
# COMMANDVAR is the name of the variable
# containing the command to build
# ${.TARGET}.
#
# Variables modified by this:
# KERNELS List of kernel .gz files to build
# KERNELSYMS List of kernel .symbol.gz files to build
#
.if !defined(_MAKEFILE_MDSET_)
_MAKEFILE_MDSET_=1
.include <bsd.kernobj.mk>
.for _K _I _F in ${MDSETTARGETS} # {
_KERNEL:=${_K} # (work around obscure issue in make(1))
.if (${_KERNEL:M*/*} != "")
_KERNNAME.${_K}.${_F}:= ${_K}
.else
_KERNNAME.${_K}.${_F}:= ${KERNOBJDIR}/${_K}/netbsd
.endif
_FILENAME:=${_F} # (work around obscure issue in make(1))
.if ${_FILENAME} == "-"
_KERNEL.${_K}.${_F}:= netbsd-${_K}
.else
_KERNEL.${_K}.${_F}:= ${_F}
.endif
KERNELS+= ${_KERNEL.${_K}.${_F}}.gz
.for _S _C in ${MDSET_SUFFIXES.${_FILENAME}} # {
KERNELS+= ${_KERNEL.${_K}.${_F}}.${_S}.gz
CLEANFILES+= ${_KERNEL.${_K}.${_F}}.${_S}
${_KERNEL.${_K}.${_F}}.${_S}: ${_KERNEL.${_K}.${_F}}
.if defined(${_C})
${${_C}}
.else
@echo "No such variable \"${_C}\""
false
.endif
${_KERNEL.${_K}.${_F}}.${_S}.gz: ${_KERNEL.${_K}.${_F}}.${_S}
-rm -f ${.TARGET}
gzip -9c ${.ALLSRC} > ${.TARGET}
.endfor # }
.if !defined(MDSET_NOSYMBOLS.${_FILENAME})
KERNELSYMS+= ${_KERNEL.${_K}.${_F}}.symbols.gz
.endif
.if defined(MDSET_POST.${_FILENAME})
_POST.${_KERNEL.${_K}.${_F}}:= ${MDSET_POST.${_FILENAME}}
.endif
${_KERNEL.${_K}.${_F}}: .NOTMAIN ${_KERNNAME.${_K}.${_F}} ${_I}
@echo "mdsetimage: ${_KERNNAME.${_K}.${_F}}"
@echo " with: ${_I}"
@echo " into: ${.TARGET}"
@rm -f ${.TARGET} ${.TARGET}.symbols.gz
@cp ${_KERNNAME.${_K}.${_F}} ${.TARGET}
${TOOL_MDSETIMAGE} -v ${.TARGET} ${_I}
.if !defined(MDSET_NOSYMBOLS.${_FILENAME})
${NM} ${.TARGET} | gzip -9 > ${.TARGET}.symbols.gz
.endif
.if !defined(MDSET_NOSTRIP.${_FILENAME})
${STRIP} ${.TARGET}
.endif
.if defined(MDSET_POST.${_FILENAME})
${_POST.${.TARGET}}
.endif
${_KERNEL.${_K}.${_F}}.gz: ${_KERNEL.${_K}.${_F}}
-rm -f ${.TARGET}
gzip -9c ${.ALLSRC} > ${.TARGET}
CLEANFILES+= ${_KERNEL.${_K}.${_F}}
.endfor # }
CLEANFILES+= ${KERNELS} ${KERNELSYMS}
realall: ${KERNELS}
.if defined(MDSET_RELEASEDIR)
release:: check_RELEASEDIR .WAIT ${KERNELS}
${RELEASE_INSTALL} ${KERNELS} ${KERNELSYMS} \
${RELEASEDIR}/${MACHINE}/${MDSET_RELEASEDIR}
.endif
.endif # _MAKEFILE_MDSET_