xref: /netbsd-src/etc/mtree/Makefile (revision 49d8c9ecf4abd21261269266ef64939f71b3cd09)
1#	$NetBSD: Makefile,v 1.24 2013/10/16 14:50:43 christos Exp $
2
3.include <bsd.own.mk>
4
5.if ${MKX11} != "no"
6. if ${X11FLAVOUR} == "Xorg"
7EXTRA_DIST_FILES=	${.CURDIR}/NetBSD.dist.Xorg
8. else
9EXTRA_DIST_FILES=	${.CURDIR}/NetBSD.dist.XFree86
10. endif
11.endif
12
13# XXX these are only used by compat currently, but they could be used
14# by something else; this may need to be fixed properly in the future.
15.if ${MKCOMPAT} != "no"
16.if exists(NetBSD.dist.${MACHINE_ARCH})
17EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.${MACHINE_ARCH}
18.elif !empty(MACHINE_ARCH:Mearm*)
19EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.earm
20.endif
21.endif
22
23.if ${MKATF} != "no"
24EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.tests
25.endif
26
27.if ${MKEXTSRC} != "no"
28EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.extsrc
29.endif
30
31NetBSD.dist:	NetBSD.dist.tmp
32	cmp -s NetBSD.dist.tmp NetBSD.dist || { \
33		echo "Updating NetBSD.dist"; \
34		mv NetBSD.dist.tmp NetBSD.dist; \
35	}
36NetBSD.dist.tmp::
37	${TOOL_CAT} ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES} > \
38	    ${.TARGET}
39
40CONFIGFILES=	NetBSD.dist special
41FILESDIR=	/etc/mtree
42
43# distrib-dirs --
44#	Populate $DESTDIR with directories needed by NetBSD
45#
46.if ${MKUNPRIVED} == "no"
47TOOL_MTREE.unpriv=
48.else
49TOOL_MTREE.unpriv=	-W
50.endif
51
52# postinstall(8) invokes this target to produce the right
53# /etc/mtree/NetBSD.dist content without duplicating logic from
54# the Makefile.
55#
56emit_dist_file:
57	@cat ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES}
58
59distrib-dirs: .PHONY check_DESTDIR NetBSD.dist
60.if !defined(DISTRIBUTION_DONE)						# {
61# Create DESTDIR using HOST_INSTALL_DIR, not INSTALL_DIR, because
62# INSTALL_DIR would want to write to the metalog, and it can't do that
63# if the metalog is inside DESTDIR but DESTDIR doesn't yet exist.
64	${HOST_INSTALL_DIR} -m 755 ${DESTDIR}
65# Invoke mtree to create the directories listed in NetBSD.dist;
66# then invoke mtree again to register those directories in the metalog.
67	${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \
68	    -p ${DESTDIR}/ -U ${TOOL_MTREE.unpriv}
69.if ${MKUNPRIVED} != "no"						# {
70	${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \
71	    -p ${DESTDIR}/ -C -k all | \
72	    ${TOOL_AWK} '/ optional/ {next} // {print}' | ${METALOG.add}
73.endif	# MKUNPRIVED							# }
74.endif	# DISTRIBUTION_DONE						# }
75
76CLEANFILES+=	NetBSD.dist NetBSD.dist.tmp
77
78.include <bsd.prog.mk>
79