2004-06-07 01:44:52 +04:00
|
|
|
# $NetBSD: Makefile.mdset,v 1.26 2004/06/06 21:44:52 dsl Exp $
|
2002-04-11 19:28:14 +04:00
|
|
|
#
|
2003-07-10 14:33:58 +04:00
|
|
|
# Makefile snippet to ${TOOL_MDSETIMAGE} file system images into kernels
|
2002-04-11 19:28:14 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# Required variables:
|
2002-04-26 19:50:21 +04:00
|
|
|
# NETBSDSRCDIR Top level of src tree (set by <bsd.own.mk>)
|
2003-07-10 14:33:58 +04:00
|
|
|
# MDSETTARGETS List of images to ${TOOL_MDSETIMAGE} into kernels,
|
2002-04-14 08:22:38 +04:00
|
|
|
# containing one or more tuples of the form:
|
2002-04-12 17:39:43 +04:00
|
|
|
# KERNEL IMAGE FILENAME
|
2002-04-14 08:22:38 +04:00
|
|
|
#
|
2003-07-10 14:33:58 +04:00
|
|
|
# The kernel is ${TOOL_MDSETIMAGE} with ${IMAGE},
|
2002-05-05 17:02:44 +04:00
|
|
|
# ${STRIP}ped (after the symbols are stored in
|
2002-04-14 08:22:38 +04:00
|
|
|
# ${FILENAME}.symbols.gz), and gzipped into
|
|
|
|
# ${FILENAME}.gz.
|
|
|
|
#
|
2003-03-11 08:14:58 +03:00
|
|
|
# If KERNEL does not contain a `/', use
|
|
|
|
# ${KERNOBJDIR}/KERNEL/netbsd as the kernel.
|
|
|
|
#
|
2002-11-18 15:39:43 +03:00
|
|
|
# If FILENAME is "-", use "netbsd-${KERNEL}" as
|
2003-03-11 08:14:58 +03:00
|
|
|
# the target name. This may not be a sensible
|
|
|
|
# name if KERNEL contains a `/'.
|
2002-04-11 19:28:14 +04:00
|
|
|
#
|
|
|
|
# Optional variables:
|
2002-05-02 22:02:14 +04:00
|
|
|
# MDSET_RELEASEDIR Where to install release kernels.
|
2002-04-14 08:22:38 +04:00
|
|
|
#
|
2003-10-24 04:11:24 +04:00
|
|
|
# MDSET_NOSTRIP If defined, don't strip any kernels.
|
|
|
|
#
|
2002-05-10 06:31:45 +04:00
|
|
|
# MDSET_NOSTRIP.${FILENAME} If defined, don't strip ${FILENAME}
|
|
|
|
#
|
2003-10-24 04:11:24 +04:00
|
|
|
# MDSET_NOSYMBOLS If defined, don't generate *.symbols.gz
|
|
|
|
#
|
2002-05-09 01:44:53 +04:00
|
|
|
# MDSET_NOSYMBOLS.${FILENAME} If defined, don't generate
|
2002-05-05 17:02:44 +04:00
|
|
|
# ${FILENAME}.symbols.gz
|
|
|
|
#
|
2002-05-09 01:44:53 +04:00
|
|
|
# MDSET_POST.${FILENAME} For each kernel named ${FILENAME},
|
2002-04-14 05:41:24 +04:00
|
|
|
# execute this after ${NM} / ${STRIP}.
|
2002-05-09 01:44:53 +04:00
|
|
|
# Kernel is available as "${.TARGET}"
|
2002-04-14 08:22:38 +04:00
|
|
|
#
|
2002-05-09 01:44:53 +04:00
|
|
|
# MDSET_SUFFIXES.${FILENAME} List of extra install kernel suffixes
|
|
|
|
# and build commands to create from
|
|
|
|
# ${FILENAME} after its created by
|
2003-07-10 14:33:58 +04:00
|
|
|
# ${TOOL_MDSETIMAGE} ; ${NM} ; ${STRIP}:
|
2002-05-09 01:44:53 +04:00
|
|
|
# SUFFIX COMMANDVAR
|
|
|
|
# "${.TARGET}" is "${FILENAME}.${SUFFIX}"
|
|
|
|
# COMMANDVAR is the name of the variable
|
|
|
|
# containing the command to build
|
|
|
|
# ${.TARGET}.
|
2002-04-11 19:28:14 +04:00
|
|
|
#
|
2002-04-12 09:50:19 +04:00
|
|
|
# Variables modified by this:
|
2002-04-12 17:39:43 +04:00
|
|
|
# KERNELS List of kernel .gz files to build
|
2002-05-05 17:02:44 +04:00
|
|
|
# KERNELSYMS List of kernel .symbol.gz files to build
|
2002-04-12 09:50:19 +04:00
|
|
|
#
|
2002-04-11 19:28:14 +04:00
|
|
|
|
2003-03-11 10:18:38 +03:00
|
|
|
.if !defined(_MAKEFILE_MDSET_)
|
|
|
|
_MAKEFILE_MDSET_=1
|
|
|
|
|
2002-04-11 19:28:14 +04:00
|
|
|
.include <bsd.kernobj.mk>
|
|
|
|
|
2002-04-14 05:41:24 +04:00
|
|
|
.for _K _I _F in ${MDSETTARGETS} # {
|
2003-03-11 08:14:58 +03:00
|
|
|
|
|
|
|
_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))
|
2002-04-14 05:41:24 +04:00
|
|
|
.if ${_FILENAME} == "-"
|
2002-11-18 15:39:43 +03:00
|
|
|
_KERNEL.${_K}.${_F}:= netbsd-${_K}
|
2002-04-12 17:39:43 +04:00
|
|
|
.else
|
2002-10-14 20:16:09 +04:00
|
|
|
_KERNEL.${_K}.${_F}:= ${_F}
|
2002-04-12 17:39:43 +04:00
|
|
|
.endif
|
2002-04-11 19:28:14 +04:00
|
|
|
|
2002-10-14 20:16:09 +04:00
|
|
|
KERNELS+= ${_KERNEL.${_K}.${_F}}.gz
|
2002-05-09 01:44:53 +04:00
|
|
|
|
|
|
|
.for _S _C in ${MDSET_SUFFIXES.${_FILENAME}} # {
|
2002-10-14 20:16:09 +04:00
|
|
|
KERNELS+= ${_KERNEL.${_K}.${_F}}.${_S}.gz
|
|
|
|
CLEANFILES+= ${_KERNEL.${_K}.${_F}}.${_S}
|
2002-05-09 01:44:53 +04:00
|
|
|
|
2002-10-14 20:16:09 +04:00
|
|
|
${_KERNEL.${_K}.${_F}}.${_S}: ${_KERNEL.${_K}.${_F}}
|
2002-05-09 01:44:53 +04:00
|
|
|
.if defined(${_C})
|
|
|
|
${${_C}}
|
|
|
|
.else
|
|
|
|
@echo "No such variable \"${_C}\""
|
|
|
|
false
|
|
|
|
.endif
|
|
|
|
|
2002-10-14 20:16:09 +04:00
|
|
|
${_KERNEL.${_K}.${_F}}.${_S}.gz: ${_KERNEL.${_K}.${_F}}.${_S}
|
2004-05-04 06:52:05 +04:00
|
|
|
${_MKTARGET_CREATE}
|
2002-05-09 01:44:53 +04:00
|
|
|
-rm -f ${.TARGET}
|
|
|
|
gzip -9c ${.ALLSRC} > ${.TARGET}
|
|
|
|
|
|
|
|
.endfor # }
|
|
|
|
|
2003-10-24 04:11:24 +04:00
|
|
|
.if !defined(MDSET_NOSYMBOLS.${_FILENAME}) && !defined(MDSET_NOSYMBOLS)
|
2002-10-14 20:16:09 +04:00
|
|
|
KERNELSYMS+= ${_KERNEL.${_K}.${_F}}.symbols.gz
|
2002-05-05 17:02:44 +04:00
|
|
|
.endif
|
2002-04-11 19:28:14 +04:00
|
|
|
|
2002-05-09 01:44:53 +04:00
|
|
|
.if defined(MDSET_POST.${_FILENAME})
|
2002-10-14 20:16:09 +04:00
|
|
|
_POST.${_KERNEL.${_K}.${_F}}:= ${MDSET_POST.${_FILENAME}}
|
2002-04-14 05:41:24 +04:00
|
|
|
.endif
|
|
|
|
|
2003-03-11 08:14:58 +03:00
|
|
|
${_KERNEL.${_K}.${_F}}: .NOTMAIN ${_KERNNAME.${_K}.${_F}} ${_I}
|
2004-05-04 06:52:05 +04:00
|
|
|
${_MKTARGET_CREATE} "(from: ${.ALLSRC})"
|
2004-01-17 23:17:44 +03:00
|
|
|
@rm -f ${.TARGET} ${.TARGET}.tmp ${.TARGET}.symbols.gz
|
|
|
|
@cp ${_KERNNAME.${_K}.${_F}} ${.TARGET}.tmp
|
|
|
|
${TOOL_MDSETIMAGE} -v ${.TARGET}.tmp ${_I}
|
2003-10-24 04:11:24 +04:00
|
|
|
.if !defined(MDSET_NOSYMBOLS.${_FILENAME}) && !defined(MDSET_NOSYMBOLS)
|
2004-01-17 23:17:44 +03:00
|
|
|
${NM} ${.TARGET}.tmp | gzip -9 > ${.TARGET}.symbols.gz
|
2002-05-05 17:02:44 +04:00
|
|
|
.endif
|
2003-10-24 04:11:24 +04:00
|
|
|
.if !defined(MDSET_NOSTRIP.${_FILENAME}) && !defined(MDSET_NOSTRIP)
|
2004-06-07 01:44:52 +04:00
|
|
|
${STRIP} -R .comment -R .ident ${.TARGET}.tmp
|
2002-05-10 06:31:45 +04:00
|
|
|
.endif
|
2004-01-17 23:17:44 +03:00
|
|
|
@mv ${.TARGET}.tmp ${.TARGET}
|
2002-05-09 01:44:53 +04:00
|
|
|
.if defined(MDSET_POST.${_FILENAME})
|
|
|
|
${_POST.${.TARGET}}
|
2002-04-11 19:28:14 +04:00
|
|
|
.endif
|
2002-05-09 01:44:53 +04:00
|
|
|
|
2002-10-14 20:16:09 +04:00
|
|
|
${_KERNEL.${_K}.${_F}}.gz: ${_KERNEL.${_K}.${_F}}
|
2004-05-04 06:52:05 +04:00
|
|
|
${_MKTARGET_CREATE}
|
2002-05-09 01:44:53 +04:00
|
|
|
-rm -f ${.TARGET}
|
|
|
|
gzip -9c ${.ALLSRC} > ${.TARGET}
|
2002-04-11 19:28:14 +04:00
|
|
|
|
2002-10-14 20:16:09 +04:00
|
|
|
CLEANFILES+= ${_KERNEL.${_K}.${_F}}
|
2002-04-13 21:27:07 +04:00
|
|
|
|
2002-04-11 19:28:14 +04:00
|
|
|
.endfor # }
|
|
|
|
|
2002-05-03 19:22:55 +04:00
|
|
|
CLEANFILES+= ${KERNELS} ${KERNELSYMS}
|
2002-04-11 19:28:14 +04:00
|
|
|
|
2002-05-03 19:22:55 +04:00
|
|
|
realall: ${KERNELS}
|
2002-04-11 19:28:14 +04:00
|
|
|
|
2002-05-02 22:02:14 +04:00
|
|
|
.if defined(MDSET_RELEASEDIR)
|
2002-05-07 07:34:16 +04:00
|
|
|
release:: check_RELEASEDIR .WAIT ${KERNELS}
|
2002-05-02 22:02:14 +04:00
|
|
|
${RELEASE_INSTALL} ${KERNELS} ${KERNELSYMS} \
|
2003-01-03 18:34:30 +03:00
|
|
|
${RELEASEDIR}/${MACHINE}/${MDSET_RELEASEDIR}
|
2002-04-11 19:28:14 +04:00
|
|
|
.endif
|
2003-03-11 10:18:38 +03:00
|
|
|
|
|
|
|
|
|
|
|
.endif # _MAKEFILE_MDSET_
|