2009-04-04 02:36:34 +04:00
|
|
|
# $NetBSD: Makefile.mdset,v 1.34 2009/04/03 22:36:35 perry 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
|
|
|
#
|
2005-05-31 20:23:37 +04:00
|
|
|
# MDSET_NOGZIP If defined, don't gzip any kernels.
|
|
|
|
#
|
|
|
|
# MDSET_NOGZIP.${FILENAME} If defined, don't gzip ${FILENAME}
|
|
|
|
#
|
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
|
|
|
|
#
|
2005-05-31 20:23:37 +04:00
|
|
|
# MDSET_POST For each kernel,
|
|
|
|
# execute this after ${NM} / ${STRIP}.
|
|
|
|
# Kernel is available as "${.TARGET}"
|
|
|
|
#
|
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}
|
2006-08-23 23:01:26 +04:00
|
|
|
_FILENAME:= ${_KERNEL.${_K}.${_F}}
|
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
|
|
|
|
2007-06-07 19:12:34 +04:00
|
|
|
.for _S _C in ${MDSET_SUFFIXES.${_F}} # {
|
2002-10-14 20:16:09 +04:00
|
|
|
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
|
|
|
|
|
2005-05-31 20:23:37 +04:00
|
|
|
.if defined(MDSET_NOGZIP.${_FILENAME}) && defined(MDSET_NOGZIP)
|
|
|
|
KERNELS+= ${_KERNEL.${_K}.${_F}}.${_S}
|
|
|
|
.else # {
|
|
|
|
KERNELS+= ${_KERNEL.${_K}.${_F}}.${_S}.gz
|
|
|
|
|
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}
|
2009-04-04 02:36:34 +04:00
|
|
|
gzip -9nc ${.ALLSRC} > ${.TARGET}
|
2005-05-31 20:23:37 +04:00
|
|
|
.endif # }
|
2002-05-09 01:44:53 +04:00
|
|
|
|
|
|
|
.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
|
|
|
|
2007-09-08 18:25:09 +04:00
|
|
|
.if defined(MDSET_POST.${_FILENAME})
|
|
|
|
_POST.${_KERNEL.${_K}.${_F}}:= ${MDSET_POST.${_FILENAME}}
|
|
|
|
.elif defined(MDSET_POST)
|
|
|
|
_POST.${_KERNEL.${_K}.${_F}}:= ${MDSET_POST}
|
2002-04-14 05:41:24 +04:00
|
|
|
.endif
|
|
|
|
|
2005-05-31 20:23:37 +04:00
|
|
|
|
|
|
|
CLEANFILES+= ${_KERNEL.${_K}.${_F}}
|
|
|
|
|
2008-05-03 03:13:05 +04:00
|
|
|
.if defined(MDSET_NOIMAGE.${_FILENAME})
|
|
|
|
${_I}=
|
|
|
|
.endif
|
|
|
|
|
2008-07-21 14:00:51 +04:00
|
|
|
# Darwin requires a special hack - this is documented in
|
|
|
|
# doc/HACKS, and just works around the problems described more
|
|
|
|
# fully in http://mail-index.netbsd.org/current-users/2008/06/27/msg003242.html
|
|
|
|
OPSYS!= uname -s
|
|
|
|
.if ${OPSYS} == "Darwin"
|
|
|
|
MDSETIMAGEFLAGS=
|
|
|
|
.else
|
|
|
|
MDSETIMAGEFLAGS=-v
|
|
|
|
.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
|
2008-05-03 03:13:05 +04:00
|
|
|
.if !defined(MDSET_NOIMAGE.${_FILENAME})
|
2008-07-21 14:00:51 +04:00
|
|
|
${TOOL_MDSETIMAGE} ${MDSETIMAGEFLAGS} ${.TARGET}.tmp ${_I}
|
2008-05-03 03:13:05 +04:00
|
|
|
.endif
|
2003-10-24 04:11:24 +04:00
|
|
|
.if !defined(MDSET_NOSYMBOLS.${_FILENAME}) && !defined(MDSET_NOSYMBOLS)
|
2009-04-04 02:36:34 +04:00
|
|
|
${NM} ${.TARGET}.tmp | gzip -9n > ${.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}
|
2005-05-31 20:23:37 +04:00
|
|
|
.if defined(MDSET_POST.${_FILENAME}) || defined(MDSET_POST)
|
2002-05-09 01:44:53 +04:00
|
|
|
${_POST.${.TARGET}}
|
2002-04-11 19:28:14 +04:00
|
|
|
.endif
|
2002-05-09 01:44:53 +04:00
|
|
|
|
2005-05-31 20:23:37 +04:00
|
|
|
.if defined(MDSET_NOGZIP.${_FILENAME}) || defined(MDSET_NOGZIP)
|
|
|
|
KERNELS+= ${_KERNEL.${_K}.${_F}}
|
|
|
|
.else # {
|
|
|
|
KERNELS+= ${_KERNEL.${_K}.${_F}}.gz
|
|
|
|
|
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}
|
2009-04-04 02:36:34 +04:00
|
|
|
gzip -9nc ${.ALLSRC} > ${.TARGET}
|
2005-05-31 20:23:37 +04:00
|
|
|
.endif # }
|
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} \
|
2008-06-23 06:09:29 +04:00
|
|
|
${RELEASEDIR}/${RELEASEMACHINEDIR}/${MDSET_RELEASEDIR}
|
2002-04-11 19:28:14 +04:00
|
|
|
.endif
|
2003-03-11 10:18:38 +03:00
|
|
|
|
|
|
|
|
|
|
|
.endif # _MAKEFILE_MDSET_
|