NetBSD/distrib/common/Makefile.mdset

97 lines
2.8 KiB
Makefile
Raw Normal View History

# $NetBSD: Makefile.mdset,v 1.10 2002/04/26 15:50:27 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 (with the symbols are stored in
# ${FILENAME}.symbols.gz), and gzipped into
# ${FILENAME}.gz.
#
# If FILENAME is "-", use "netbsd.${KERNEL}" as
# the target name.
#
# Optional variables:
# MDSETDIR Where to install release kernels.
2002-04-14 08:22:38 +04:00
#
# MDSET.${FILENAME}.post For each kernel named ${FILENAME},
# execute this after ${NM} / ${STRIP}.
# Kernel is available as netbsd.tmp.
# If MDSET.${FILENAME}.suffixes uses
# this to build extra kernels, the
# resultant file must be gzipped as
# "netbsd.${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
# KERNELDEPS Dependency version of ${KERNELS} (with .WAIT)
# KERNELSYMS List of kernel .symbol 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
KERNELDEPS+= ${_KERNEL.${_K}}.gz .WAIT
.for suf in ${MDSET.${_FILENAME}.suffixes}
KERNELS+= ${_KERNEL.${_K}}.${suf}.gz
KERNELDEPS+= ${_KERNEL.${_K}}.${suf}.gz .WAIT
CLEANFILES+= netbsd.${suf} netbsd.${suf}.gz
.endfor
KERNELSYMS+= ${_KERNEL.${_K}}.symbols.gz
.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 netbsd.tmp ${_KERNEL.${_K}}.symbols.gz
@cp ${KERNOBJDIR}/${_K}/netbsd netbsd.tmp
${MDSETIMAGE} -v netbsd.tmp ${_I}
${NM} netbsd.tmp | gzip -9 > ${_KERNEL.${_K}}.symbols.gz
${STRIP} netbsd.tmp
.if defined(_POST.${_KERNEL.${_K}})
${_POST.${_KERNEL.${_K}}}
.endif
@gzip -9f netbsd.tmp
mv netbsd.tmp.gz ${.TARGET}
.for suf in ${MDSET.${_FILENAME}.suffixes}
${_KERNEL.${_K}}.${suf}.gz: .NOTMAIN ${_KERNEL.${_K}}.gz
mv netbsd.${suf}.gz ${.TARGET}
.endfor
.endfor # }
CLEANFILES+= netbsd.tmp netbsd.tmp.gz ${KERNELS} ${KERNELSYMS}
realall: ${KERNELDEPS}
.if defined(MDSETDIR)
release: check_RELEASEDIR .WAIT ${KERNELDEPS}
-mkdir -p ${RELEASEDIR}/${MDSETDIR}
${RELINSTALL} ${KERNELS} ${KERNELSYMS} ${RELEASEDIR}/${MDSETDIR}
.endif