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