Makefile revision 1.17
1#	$NetBSD: Makefile,v 1.17 2010/04/27 03:01:25 dyoung 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.if exists(NetBSD.dist.${MACHINE_ARCH})
14EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.${MACHINE_ARCH}
15.endif
16
17.if ${MKEXTSRC} != "no"
18EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.extsrc
19.endif
20
21NetBSD.dist:	NetBSD.dist.tmp
22	cmp -s NetBSD.dist.tmp NetBSD.dist || { \
23		echo "Updating NetBSD.dist"; \
24		mv NetBSD.dist.tmp NetBSD.dist; \
25	}
26NetBSD.dist.tmp::
27	${TOOL_CAT} ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES} > \
28	    ${.TARGET}
29
30CONFIGFILES=	NetBSD.dist special
31FILESDIR=	/etc/mtree
32
33# distrib-dirs --
34#	Populate $DESTDIR with directories needed by NetBSD
35#
36.if ${MKUNPRIVED} == "no"
37TOOL_MTREE.unpriv=
38.else
39TOOL_MTREE.unpriv=	-W
40.endif
41
42# postinstall(8) invokes this target to produce the right
43# /etc/mtree/NetBSD.dist content without duplicating logic from
44# the Makefile.
45#
46emit_dist_file:
47	cat ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES}
48
49distrib-dirs: .PHONY check_DESTDIR NetBSD.dist
50.if !defined(DISTRIBUTION_DONE)						# {
51# Create DESTDIR using HOST_INSTALL_DIR, not INSTALL_DIR, because
52# INSTALL_DIR would want to write to the metalog, and it can't do that
53# if the metalog is inside DESTDIR but DESTDIR doesn't yet exist.
54	${HOST_INSTALL_DIR} -m 755 ${DESTDIR}
55# Inkoke mtree to create the directories listed in NetBSD.dist;
56# then invoke mtree again to register those directories in the metalog.
57	${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \
58	    -p ${DESTDIR}/ -U ${TOOL_MTREE.unpriv}
59.if ${MKUNPRIVED} != "no"						# {
60	${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \
61	    -p ${DESTDIR}/ -C -k all | \
62	    ${TOOL_AWK} '/ optional/ {next} // {print}' | ${METALOG.add}
63.endif	# MKUNPRIVED							# }
64.endif	# DISTRIBUTION_DONE						# }
65
66CLEANFILES+=	NetBSD.dist NetBSD.dist.tmp
67
68.include <bsd.prog.mk>
69