# $NetBSD: Makefile.mdset,v 1.12 2002/05/03 15:22:57 lukem Exp $ # # Makefile snippet to ${MDSETIMAGE} file system images into kernels # # # Required variables: # NETBSDSRCDIR Top level of src tree (set by ) # MDSETTARGETS List of images to ${MDSETIMAGE} into kernels, # containing one or more tuples of the form: # KERNEL IMAGE FILENAME # # 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: # MDSET_RELEASEDIR Where to install release kernels. # # 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" # # 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 .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 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 "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} ${NM} ${.TARGET:R} | gzip -9 > ${.TARGET:R}.symbols.gz ${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