001c68bd94
program/tool from "FOO" to "TOOL_FOO". The new variables are: TOOL_ASN1_COMPILE TOOL_CAP_MKDB TOOL_CAT TOOL_CKSUM TOOL_COMPILE_ET TOOL_CONFIG TOOL_CRUNCHGEN TOOL_CTAGS TOOL_DB TOOL_EQN TOOL_FGEN TOOL_GENCAT TOOL_GROFF TOOL_HEXDUMP TOOL_INDXBIB TOOL_INSTALLBOOT TOOL_INSTALL_INFO TOOL_M4 TOOL_MAKEFS TOOL_MAKEINFO TOOL_MAKEWHATIS TOOL_MDSETIMAGE TOOL_MENUC TOOL_MKCSMAPPER TOOL_MKESDB TOOL_MKLOCALE TOOL_MKMAGIC TOOL_MKTEMP TOOL_MSGC TOOL_MTREE TOOL_PAX TOOL_PIC TOOL_PREPMKBOOTIMAGE TOOL_PWD_MKDB TOOL_REFER TOOL_ROFF_ASCII TOOL_ROFF_DVI TOOL_ROFF_HTML TOOL_ROFF_PS TOOL_ROFF_RAW TOOL_RPCGEN TOOL_SOELIM TOOL_SUNLABEL TOOL_TBL TOOL_UUDECODE TOOL_VGRIND TOOL_ZIC For each, provide default in <bsd.sys.mk> of the form: TOOL_FOO?= foo and for the ${USETOOLS}=="yes" case in <bsd.own.mk>, provide override: TOOL_FOO= ${TOOLDIR}/bin/${_TOOL_PREFIX}foo Document all of these in bsd.README. This cleans up a chunk of potential (and actual) namespace collision within our build infrastructure, as well as improves consistency in the share/mk documentation and provision of appropriate defaults for each of these variables.
131 lines
3.7 KiB
Makefile
131 lines
3.7 KiB
Makefile
# $NetBSD: Makefile.image,v 1.25 2003/07/10 10:34:04 lukem Exp $
|
|
#
|
|
# Makefile snippet to build a tree from the provided lists,
|
|
# and make an ffs file system image from that tree
|
|
#
|
|
# Required variables:
|
|
# NETBSDSRCDIR top level of src tree (set by <bsd.own.mk>)
|
|
# CRUNCHBIN name of crunchgen(1)ed binary
|
|
# LISTS list file(s) to use
|
|
# IMAGEDEPENDS depends for ${IMAGE}
|
|
# IMAGEENDIAN endianness of ${IMAGE}
|
|
# IMAGESIZE size of ${IMAGE}
|
|
# MTREECONF mtree specfiles to use to build a master specfile
|
|
#
|
|
# Optional variables:
|
|
# IMAGE name of target image
|
|
# IMAGEPOSTBUILD operation to run on ${IMAGE} ${.TARGET} after its built
|
|
# (if this returns non zero, ${.TARGET} is removed)
|
|
# DESTDIR destination directory
|
|
# MAKEFS_FLAGS extra options to ${TOOL_MAKEFS}
|
|
# PARSELISTENV environment variables to set for parselist.awk
|
|
# WORKDIR directory to build image in to
|
|
# IMAGETAR tar.gz file to create containing ${IMAGE}'s contents
|
|
#
|
|
# IMAGE_RELEASEDIR where to install ${IMAGE}.gz
|
|
# IMAGETAR_RELEASEDIR where to install ${IMAGETAR}
|
|
#
|
|
|
|
.if !defined(_MAKEFILE_IMAGE_)
|
|
_MAKEFILE_IMAGE_=1
|
|
|
|
|
|
WORKDIR?= work
|
|
WORKSPEC?= work.spec
|
|
WORKBUILT?= work.built
|
|
|
|
.include "${DISTRIBDIR}/common/Makefile.parselist"
|
|
|
|
PARSELISTENV+= TARGETDIR=${.OBJDIR}/${WORKDIR:Q}
|
|
|
|
|
|
.if !target(${WORKBUILT}) # {
|
|
${WORKBUILT}: ${IMAGEDEPENDS} ${WORKSPEC} ${PARSELISTDEP} ${LISTS}
|
|
@# There is a .PHONY ${CRUNCHBIN}, so check if out of date by hand
|
|
[ "${.OODATE}" = ${CRUNCHBIN} -a -f ${WORKBUILT} -a ${WORKBUILT} -nt ${CRUNCHBIN} ] || { \
|
|
echo "Building tree into ${WORKDIR}"; \
|
|
rm -rf ${WORKDIR} ${WORKBUILT}; \
|
|
mkdir -m 755 ${WORKDIR} && \
|
|
${TOOL_MTREE} -def ${WORKSPEC} -p ${WORKDIR}/ -UW && \
|
|
${PARSELIST} -v mode=populate ${LISTS} | \
|
|
sh -e ${POPULATE_DEBUG} \
|
|
&& touch ${WORKBUILT} ; \
|
|
}
|
|
|
|
CLEANFILES+= ${WORKBUILT}
|
|
|
|
clean cleandir distclean: cleanfsimage
|
|
|
|
.PHONY: cleanfsimage
|
|
|
|
cleanfsimage:
|
|
-rm -rf ${WORKDIR}
|
|
|
|
.endif # ! target (${WORKBUILT}) # }
|
|
|
|
.if !target(${WORKSPEC}) # {
|
|
${WORKSPEC}: ${MTREECONF} ${LISTS} ${PARSELISTDEP}
|
|
-rm -f ${.TARGET} ${.TARGET}.tmp
|
|
( for i in ${MTREECONF}; do \
|
|
cat $$i ; \
|
|
echo "/unset all" ; \
|
|
done ) >> ${.TARGET}.tmp
|
|
${PARSELIST} -v mode=mtree ${LISTS} >> ${.TARGET}.tmp \
|
|
&& mv ${.TARGET}.tmp ${.TARGET}
|
|
|
|
CLEANFILES+= ${WORKSPEC} ${WORKSPEC}.tmp
|
|
.endif # ! target (${WORKSPEC}) # }
|
|
|
|
.if defined(IMAGE) # {
|
|
${IMAGE}: ${WORKBUILT}
|
|
[ "${.OODATE}" = ${WORKBUILT} -a -f ${IMAGE} -a ! ${IMAGE} -ot ${WORKBUILT} ] || { \
|
|
echo "Creating image into ${.TARGET}..."; \
|
|
rm -f ${.TARGET} ${.TARGET}.tmp; \
|
|
${TOOL_MAKEFS} -t ffs -B ${IMAGEENDIAN} -s ${IMAGESIZE} -F ${WORKSPEC} \
|
|
-N ${NETBSDSRCDIR}/etc -o bsize=4096,fsize=512 \
|
|
-o optimization=space,minfree=0 \
|
|
${MAKEFS_FLAGS} ${.TARGET}.tmp ${WORKDIR} \
|
|
&& mv -f ${.TARGET}.tmp ${.TARGET}; \
|
|
}
|
|
.if defined(IMAGEPOSTBUILD)
|
|
${IMAGEPOSTBUILD} || { rm -f ${.TARGET} ; false; }
|
|
.endif
|
|
|
|
${IMAGE}.gz: ${IMAGE}
|
|
-rm -f ${.TARGET}
|
|
gzip -9c ${.ALLSRC} > ${.TARGET}
|
|
|
|
realall: ${IMAGE}
|
|
|
|
.if defined(IMAGE_RELEASEDIR)
|
|
release:: check_RELEASEDIR .WAIT ${IMAGE}.gz
|
|
${RELEASE_INSTALL} ${IMAGE}.gz \
|
|
${RELEASEDIR}/${MACHINE}/${IMAGE_RELEASEDIR}
|
|
.endif
|
|
|
|
CLEANFILES+= ${IMAGE} ${IMAGE}.gz ${IMAGE}.tmp
|
|
.endif # ! defined(IMAGE) # }
|
|
|
|
|
|
.if defined(IMAGETAR) # {
|
|
${IMAGETAR}: ${WORKBUILT} ${WORKSPEC} ${IMAGEDEPENDS}
|
|
( cd ${WORKDIR}; \
|
|
GZIP=-9 ${TOOL_PAX} -ON ${NETBSDSRCDIR}/etc -wdzM <${.OBJDIR}/${WORKSPEC} \
|
|
) > ${.TARGET}.tmp \
|
|
&& mv ${.TARGET}.tmp ${.TARGET}
|
|
|
|
realall: ${IMAGETAR}
|
|
|
|
CLEANFILES+= ${IMAGETAR} ${IMAGETAR}.tmp
|
|
|
|
.if defined(IMAGETAR_RELEASEDIR)
|
|
release:: check_RELEASEDIR .WAIT ${IMAGETAR}
|
|
${RELEASE_INSTALL} ${IMAGETAR} \
|
|
${RELEASEDIR}/${MACHINE}/${IMAGETAR_RELEASEDIR}
|
|
.endif
|
|
|
|
.endif # ! defined(IMAGETAR) # }
|
|
|
|
|
|
.endif # _MAKEFILE_IMAGE_
|