NetBSD/distrib/common/Makefile.mdset
lukem 36f355e14e - Rename Makefile.mdset variables:
MDEXTRA_SUFFIXES.${KERNEL} 	-> MDSET.${FILENAME}.suffixes
	${KERNEL.${_K}}.post		-> MDSET.${FILENAME}.post
  This allows "default" rules for for MDSETTARGETS with FILENAMEs of "-"
  by defined MDSET.-.post & MDSET.-.suffixes
- Document the above
- Use the above appropriately in various Makefiles
- Be a be quieter when building these kernels
- Add .WAIT syncs so that multiple kernels aren't built in parallel, because
  the temporary filename is the same, and it also avoid hairy magic in
  syncing the targets generated from MDSET.${FILENAME}.suffixes with
  the master target for that ${FILENAME}
2002-04-14 01:41:24 +00:00

86 lines
2.5 KiB
Makefile

# $NetBSD: Makefile.mdset,v 1.6 2002/04/14 01:41:25 lukem Exp $
#
# Makefile snippet to ${MDSETIMAGE} file system images into kernels
#
#
# Required variables:
# _SRC_TOP_ Top level of src tree (set by <bsd.own.mk>)
# MDSETTARGETS List of images to ${MDSETIMAGE} into kernels:
# KERNEL IMAGE FILENAME
# The kernel ${KERNOBJDIR}/${KERNEL}/netbsd is
# ${MDSETIMAGE} with ${IMAGE}, ${STRIP}ped,
# and gzipped into ${FILENAME}.gz.
# If FILENAME is "-", use "netbsd.${KERNEL}" as
# the target name.
#
# Optional variables:
# MDSETDIR Where to install release kernels.
# 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"
# 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 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 .WAIT
.for suf in ${MDSET.${_FILENAME}.suffixes}
KERNELS+= ${_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}
@echo "Populating ${_K} with ${_I} 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: ${KERNELS}
.if defined(MDSETDIR)
release: check_RELEASEDIR .WAIT ${KERNELS}
-mkdir -p ${RELEASEDIR}/${MDSETDIR}
${RELINSTALL} ${KERNELS} ${KERNELSYMS} ${RELEASEDIR}/${MDSETDIR}
.endif