Makefile revision 1.25
1#	$NetBSD: Makefile,v 1.25 2015/06/19 18:16:06 matt 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.include "${NETBSDSRCDIR}/compat/archdirs.mk"
17.if exists(NetBSD.dist.${MACHINE_ARCH})
18EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.${MACHINE_ARCH}
19.elif !empty(MACHINE_ARCH:Mearm*)
20EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.earm
21.endif
22EXTRA_DIST_FILES+=	NetBSD.dist.compat	# autogenerated
23.endif
24
25.if ${MKATF} != "no"
26EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.tests
27.if ${MKCOMPATTESTS} != "no"
28EXTRA_DIST_FILES+=	NetBSD.dist.tests.compat
29.endif
30.endif
31
32.if ${MKEXTSRC} != "no"
33EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.extsrc
34.endif
35
36NetBSD.dist:	NetBSD.dist.tmp
37	cmp -s NetBSD.dist.tmp NetBSD.dist || { \
38		echo "Updating NetBSD.dist"; \
39		mv NetBSD.dist.tmp NetBSD.dist; \
40	}
41NetBSD.dist.tmp:: ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES}
42	${TOOL_CAT} ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES} > \
43	    ${.TARGET}
44
45NetBSD.dist.compat: ${.CURDIR}/NetBSD.dist.compat.in ${.CURDIR}/mkcompat.awk
46	${MKCREATE}
47	${TOOL_AWK} -f ${.CURDIR}/mkcompat.awk \
48	    -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} \
49		${.CURDIR}/NetBSD.dist.compat.in \
50	     > ${.TARGET}
51
52NetBSD.dist.tests.compat: ${.CURDIR}/NetBSD.dist.tests \
53		${.CURDIR}/mkcompattree.awk 
54	${MKCREATE}
55	${TOOL_AWK} -f ${.CURDIR}/mkcompattree.awk \
56	    -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} -v S="usr/tests" \
57		${.CURDIR}/NetBSD.dist.tests \
58	     > ${.TARGET}
59
60CONFIGFILES=	NetBSD.dist special
61FILESDIR=	/etc/mtree
62
63# distrib-dirs --
64#	Populate $DESTDIR with directories needed by NetBSD
65#
66.if ${MKUNPRIVED} == "no"
67TOOL_MTREE.unpriv=
68.else
69TOOL_MTREE.unpriv=	-W
70.endif
71
72# postinstall(8) invokes this target to produce the right
73# /etc/mtree/NetBSD.dist content without duplicating logic from
74# the Makefile.
75#
76emit_dist_file:
77	@cat ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES}
78
79distrib-dirs: .PHONY check_DESTDIR NetBSD.dist
80.if !defined(DISTRIBUTION_DONE)						# {
81# Create DESTDIR using HOST_INSTALL_DIR, not INSTALL_DIR, because
82# INSTALL_DIR would want to write to the metalog, and it can't do that
83# if the metalog is inside DESTDIR but DESTDIR doesn't yet exist.
84	${HOST_INSTALL_DIR} -m 755 ${DESTDIR}
85# Invoke mtree to create the directories listed in NetBSD.dist;
86# then invoke mtree again to register those directories in the metalog.
87	${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \
88	    -p ${DESTDIR}/ -U ${TOOL_MTREE.unpriv}
89.if ${MKUNPRIVED} != "no"						# {
90	${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \
91	    -p ${DESTDIR}/ -C -k all | \
92	    ${TOOL_AWK} '/ optional/ {next} // {print}' | ${METALOG.add}
93.endif	# MKUNPRIVED							# }
94.endif	# DISTRIBUTION_DONE						# }
95
96CLEANFILES+=	NetBSD.dist NetBSD.dist.tmp
97CLEANFILES+=	NetBSD.dist.compat
98CLEANFILES+=	NetBSD.dist.tests.compat
99
100.include <bsd.prog.mk>
101