2013-12-06 12:04:52 +01:00
|
|
|
# $NetBSD: Makefile.image,v 1.32 2013/05/24 21:34:19 christos Exp $
|
Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
* tools
* distribution
* sets
* release
The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.
For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.
Regarding new or modifications of Makefiles a few things:
* Read share/mk/bsd.README
* If you add a subdirectory, add a Makefile in it, and have it called
by the parent through the SUBDIR variable.
* Do not add arbitrary inclusion which crosses to another branch of
the hierarchy; If you can't do without it, put a comment on why.
If possible, do not use inclusion at all.
* Use as much as possible the infrastructure, it is here to make
life easier, do not fight it.
Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-09-12 09:37:05 +02:00
|
|
|
#
|
|
|
|
# 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>)
|
|
|
|
# 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)
|
|
|
|
# CRUNCHBIN name of crunchgen(1)ed binary
|
|
|
|
# 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
|
|
|
|
# Default to `.' if ${CRUNCHBIN} isn't set, to always force a rebuild.
|
|
|
|
[ "${.OODATE}" = ${CRUNCHBIN:U.} -a -f ${WORKBUILT} -a ${WORKBUILT} -nt ${CRUNCHBIN:U.} ] || { \
|
|
|
|
${_MKSHMSG} " build " ${.CURDIR:T}/${WORKDIR}; \
|
|
|
|
rm -rf ${WORKDIR} ${WORKBUILT}; \
|
|
|
|
mkdir -m 755 ${WORKDIR} && \
|
|
|
|
${TOOL_MTREE} -def ${WORKSPEC} -p ${WORKDIR}/ -UW && \
|
|
|
|
${PARSELIST} -v mode=populate ${LISTS} | \
|
|
|
|
${HOST_SH} -e ${POPULATE_DEBUG} \
|
|
|
|
&& touch ${WORKBUILT} ; \
|
|
|
|
}
|
|
|
|
|
|
|
|
CLEANFILES+= ${WORKBUILT}
|
|
|
|
|
|
|
|
clean cleandir distclean: cleanfsimage
|
|
|
|
|
|
|
|
.PHONY: cleanfsimage
|
|
|
|
|
|
|
|
cleanfsimage:
|
|
|
|
-rm -rf ${WORKDIR} ${WORKBUILT}
|
|
|
|
|
|
|
|
.endif # ! target (${WORKBUILT}) # }
|
|
|
|
|
|
|
|
.if !target(${WORKSPEC}) # {
|
|
|
|
${WORKSPEC}: ${MTREECONF} ${LISTS} ${PARSELISTDEP}
|
|
|
|
${_MKTARGET_CREATE}
|
|
|
|
-rm -f ${.TARGET} ${.TARGET}.tmp
|
|
|
|
( for i in ${MTREECONF}; do \
|
|
|
|
echo "# --" ; \
|
|
|
|
echo "# entries from: $$i" ; \
|
|
|
|
echo "#" ; \
|
|
|
|
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) # {
|
2013-12-06 12:04:52 +01:00
|
|
|
IMGMAKEFSOPTIONS?= -o bsize=4096,fsize=512
|
Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
* tools
* distribution
* sets
* release
The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.
For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.
Regarding new or modifications of Makefiles a few things:
* Read share/mk/bsd.README
* If you add a subdirectory, add a Makefile in it, and have it called
by the parent through the SUBDIR variable.
* Do not add arbitrary inclusion which crosses to another branch of
the hierarchy; If you can't do without it, put a comment on why.
If possible, do not use inclusion at all.
* Use as much as possible the infrastructure, it is here to make
life easier, do not fight it.
Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-09-12 09:37:05 +02:00
|
|
|
${IMAGE}: ${WORKBUILT}
|
|
|
|
[ "${.OODATE}" = ${WORKBUILT} -a -f ${IMAGE} -a ! ${IMAGE} -ot ${WORKBUILT} ] || { \
|
|
|
|
${_MKSHMSG_CREATE} ${.CURDIR:T}/${.TARGET}; \
|
|
|
|
rm -f ${.TARGET} ${.TARGET}.tmp; \
|
|
|
|
${TOOL_MAKEFS} -t ffs -B ${IMAGEENDIAN} -s ${IMAGESIZE} -F ${WORKSPEC} \
|
2013-12-06 12:04:52 +01:00
|
|
|
-N ${NETBSDSRCDIR}/etc ${IMGMAKEFSOPTIONS} \
|
Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
* tools
* distribution
* sets
* release
The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.
For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.
Regarding new or modifications of Makefiles a few things:
* Read share/mk/bsd.README
* If you add a subdirectory, add a Makefile in it, and have it called
by the parent through the SUBDIR variable.
* Do not add arbitrary inclusion which crosses to another branch of
the hierarchy; If you can't do without it, put a comment on why.
If possible, do not use inclusion at all.
* Use as much as possible the infrastructure, it is here to make
life easier, do not fight it.
Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-09-12 09:37:05 +02:00
|
|
|
-o optimization=space,minfree=0 \
|
|
|
|
${MAKEFS_FLAGS} ${.TARGET}.tmp ${WORKDIR} \
|
|
|
|
&& mv -f ${.TARGET}.tmp ${.TARGET}; \
|
|
|
|
}
|
|
|
|
.if defined(IMAGEPOSTBUILD)
|
|
|
|
${IMAGEPOSTBUILD} || { rm -f ${.TARGET} ; false; }
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.PHONY: fsimage
|
|
|
|
fsimage: ${IMAGE}
|
|
|
|
|
|
|
|
${IMAGE}.gz: ${IMAGE}
|
|
|
|
${_MKTARGET_CREATE}
|
|
|
|
-rm -f ${.TARGET}
|
|
|
|
gzip -9nc ${.ALLSRC} > ${.TARGET}
|
|
|
|
|
|
|
|
realall: ${IMAGE}
|
|
|
|
|
|
|
|
.if defined(IMAGE_RELEASEDIR)
|
|
|
|
release:: check_RELEASEDIR .WAIT ${IMAGE}.gz
|
|
|
|
${RELEASE_INSTALL} ${IMAGE}.gz \
|
|
|
|
${RELEASEDIR}/${RELEASEMACHINEDIR}/${IMAGE_RELEASEDIR}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
CLEANFILES+= ${IMAGE} ${IMAGE}.gz ${IMAGE}.tmp
|
|
|
|
.endif # ! defined(IMAGE) # }
|
|
|
|
|
|
|
|
|
|
|
|
.if defined(IMAGETAR) # {
|
|
|
|
${IMAGETAR}: ${WORKBUILT} ${WORKSPEC} ${IMAGEDEPENDS}
|
|
|
|
${_MKTARGET_CREATE}
|
|
|
|
( cd ${WORKDIR}; \
|
|
|
|
GZIP=-9n ${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}/${RELEASEMACHINEDIR}/${IMAGETAR_RELEASEDIR}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.endif # ! defined(IMAGETAR) # }
|
|
|
|
|
|
|
|
|
|
|
|
.endif # _MAKEFILE_IMAGE_
|