NetBSD/distrib/common/Makefile.mdset

97 lines
2.7 KiB
Makefile
Raw Normal View History

# $NetBSD: Makefile.mdset,v 1.14 2002/05/07 03:34:17 lukem Exp $
#
# Makefile snippet to ${MDSETIMAGE} file system images into kernels
#
#
# Required variables:
# NETBSDSRCDIR Top level of src tree (set by <bsd.own.mk>)
2002-04-14 08:22:38 +04:00
# MDSETTARGETS List of images to ${MDSETIMAGE} into kernels,
# containing one or more tuples of the form:
# KERNEL IMAGE FILENAME
2002-04-14 08:22:38 +04:00
#
# The kernel is ${MDSETIMAGE} with ${IMAGE},
# ${STRIP}ped (after the symbols are stored in
2002-04-14 08:22:38 +04:00
# ${FILENAME}.symbols.gz), and gzipped into
# ${FILENAME}.gz.
#
# If FILENAME is "-", use "netbsd.${KERNEL}" as
# the target name.
#
# Optional variables:
# MDSET_RELEASEDIR Where to install release kernels.
2002-04-14 08:22:38 +04:00
#
# MDSET.${FILENAME}.nosymbols If defined, don't generate
# ${FILENAME}.symbols.gz
#
# MDSET.${FILENAME}.post For each kernel named ${FILENAME},
# execute this after ${NM} / ${STRIP}.
# Kernel is available as "${.TARGET:R}"
# If MDSET.${FILENAME}.suffixes uses
# this to build extra kernels, the
# resultant file must be gzipped by this
# as "${.TARGET:R}.${suffix}.gz"
2002-04-14 08:22:38 +04:00
#
# MDSET.${FILENAME}.suffixes List of extra install kernel suffixes.
# The extra kernels are usually created
# by MDSET.${FILENAME}.post.
#
# Variables modified by this:
# KERNELS List of kernel .gz files to build
# KERNELSYMS List of kernel .symbol.gz files to build
# _KERNEL.${KERNEL} Target filename for ${KERNEL}
#
.include <bsd.kernobj.mk>
.for _K _I _F in ${MDSETTARGETS} # {
_FILENAME:=${_F} # work around obscure issue in make(1)
.if ${_FILENAME} == "-"
_KERNEL.${_K}:= netbsd.${_K}
.else
_KERNEL.${_K}:= ${_F}
.endif
KERNELS+= ${_KERNEL.${_K}}.gz
.for suf in ${MDSET.${_FILENAME}.suffixes}
KERNELS+= ${_KERNEL.${_K}}.${suf}.gz
CLEANFILES+= ${_KERNEL.${_K}}.${suf}
.endfor
.if !defined(MDSET.${_FILENAME}.nosymbols)
KERNELSYMS+= ${_KERNEL.${_K}}.symbols.gz
.endif
.if defined(MDSET.${_FILENAME}.post)
_POST.${_KERNEL.${_K}}:= ${MDSET.${_FILENAME}.post}
.endif
${_KERNEL.${_K}}.gz: .NOTMAIN ${KERNOBJDIR}/${_K}/netbsd ${_I}
2002-04-14 08:22:38 +04:00
@echo "mdsetimage: ${KERNOBJDIR}/${_K}/netbsd"
@echo " with: ${_I}"
@echo " into: ${.TARGET}"
@rm -f ${.TARGET:R} ${.TARGET:R}.symbols.gz
@cp ${KERNOBJDIR}/${_K}/netbsd ${.TARGET:R}
${MDSETIMAGE} -v ${.TARGET:R} ${_I}
.if !defined(MDSET.${_FILENAME}.nosymbols)
${NM} ${.TARGET:R} | gzip -9 > ${.TARGET:R}.symbols.gz
.endif
${STRIP} ${.TARGET:R}
.if defined(_POST.${.TARGET:R})
${_POST.${.TARGET:R}}
.endif
gzip -9f ${.TARGET:R}
CLEANFILES+= ${_KERNEL.${_K}}
.endfor # }
CLEANFILES+= ${KERNELS} ${KERNELSYMS}
realall: ${KERNELS}
.if defined(MDSET_RELEASEDIR)
release:: check_RELEASEDIR .WAIT ${KERNELS}
${RELEASE_INSTALL} ${KERNELS} ${KERNELSYMS} \
${RELEASEDIR}/${MDSET_RELEASEDIR}
.endif