NetBSD/etc/mtree/Makefile

111 lines
3.5 KiB
Makefile

# $NetBSD: Makefile,v 1.30 2015/10/09 19:23:18 riz Exp $
.include <bsd.own.mk>
.if ${MKX11} != "no"
EXTRA_DIST_FILES= ${.CURDIR}/NetBSD.dist.Xorg
.endif
# XXX these are only used by compat currently, but they could be used
# by something else; this may need to be fixed properly in the future.
.if defined(MKCOMPAT) && ${MKCOMPAT} != "no"
.include "${NETBSDSRCDIR}/compat/archdirs.mk"
.if exists(NetBSD.dist.${MACHINE_ARCH})
EXTRA_DIST_FILES+= ${.CURDIR}/NetBSD.dist.${MACHINE_ARCH}
.elif !empty(MACHINE_ARCH:Mearm*)
EXTRA_DIST_FILES+= ${.CURDIR}/NetBSD.dist.earm
.endif
EXTRA_DIST_FILES+= NetBSD.dist.compat # autogenerated
.if defined(MKCOMPATX11) && ${MKCOMPATX11} != "no" && ${MKX11} != "no"
EXTRA_DIST_FILES+= NetBSD.dist.xcompat # autogenerated
.endif
.endif
.if ${MKATF} != "no"
EXTRA_DIST_FILES+= ${.CURDIR}/NetBSD.dist.tests
.if defined(MKCOMPATTESTS) && ${MKCOMPATTESTS} != "no"
EXTRA_DIST_FILES+= NetBSD.dist.tests.compat
.endif
.endif
.if ${MKDTRACE} != "no"
EXTRA_DIST_FILES+= ${.CURDIR}/NetBSD.dist.dtrace
.endif
.if ${MKEXTSRC} != "no"
EXTRA_DIST_FILES+= ${.CURDIR}/NetBSD.dist.extsrc
.endif
NetBSD.dist: NetBSD.dist.tmp
cmp -s NetBSD.dist.tmp NetBSD.dist || { \
echo "Updating NetBSD.dist"; \
mv NetBSD.dist.tmp NetBSD.dist; \
}
NetBSD.dist.tmp:: ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES}
${TOOL_CAT} ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES} > \
${.TARGET}
NetBSD.dist.compat: ${.CURDIR}/NetBSD.dist.compat.in ${.CURDIR}/mkcompat.awk
${MKCREATE}
${TOOL_AWK} -f ${.CURDIR}/mkcompat.awk \
-v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} \
${.CURDIR}/NetBSD.dist.compat.in \
> ${.TARGET}
NetBSD.dist.xcompat: ${.CURDIR}/NetBSD.dist.xcompat.in ${.CURDIR}/mkcompat.awk
${MKCREATE}
${TOOL_AWK} -f ${.CURDIR}/mkcompat.awk \
-v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} \
${.CURDIR}/NetBSD.dist.xcompat.in \
> ${.TARGET}
NetBSD.dist.tests.compat: ${.CURDIR}/NetBSD.dist.tests \
${.CURDIR}/mkcompattree.awk
${MKCREATE}
${TOOL_AWK} -f ${.CURDIR}/mkcompattree.awk \
-v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} -v S="usr/tests" \
${.CURDIR}/NetBSD.dist.tests \
> ${.TARGET}
CONFIGFILES= NetBSD.dist special
FILESDIR= /etc/mtree
# distrib-dirs --
# Populate $DESTDIR with directories needed by NetBSD
#
.if ${MKUNPRIVED} == "no"
TOOL_MTREE.unpriv=
.else
TOOL_MTREE.unpriv= -W
.endif
# postinstall(8) invokes this target to produce the right
# /etc/mtree/NetBSD.dist content without duplicating logic from
# the Makefile.
#
emit_dist_file: ${EXTRA_DIST_FILES}
@cat ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES}
distrib-dirs: .PHONY check_DESTDIR NetBSD.dist
.if !defined(DISTRIBUTION_DONE) # {
# Create DESTDIR using HOST_INSTALL_DIR, not INSTALL_DIR, because
# INSTALL_DIR would want to write to the metalog, and it can't do that
# if the metalog is inside DESTDIR but DESTDIR doesn't yet exist.
${HOST_INSTALL_DIR} -m 755 ${DESTDIR}
# Invoke mtree to create the directories listed in NetBSD.dist;
# then invoke mtree again to register those directories in the metalog.
${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \
-p ${DESTDIR}/ -U ${TOOL_MTREE.unpriv}
.if ${MKUNPRIVED} != "no" # {
${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \
-p ${DESTDIR}/ -C -k all | \
${TOOL_AWK} '/ optional/ {next} // {print}' | ${METALOG.add}
.endif # MKUNPRIVED # }
.endif # DISTRIBUTION_DONE # }
CLEANFILES+= NetBSD.dist NetBSD.dist.tmp
CLEANFILES+= NetBSD.dist.compat
CLEANFILES+= NetBSD.dist.tests.compat
.include <bsd.prog.mk>