xref: /minix3/etc/mtree/Makefile (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1#	$NetBSD: Makefile,v 1.30 2015/10/09 19:23:18 riz Exp $
2
3.include <bsd.own.mk>
4
5.if ${MKX11} != "no"
6EXTRA_DIST_FILES=	${.CURDIR}/NetBSD.dist.Xorg
7.endif
8
9.if defined(__MINIX)
10.if ${MKLIBSTDCXX} == "yes"
11EXTRA_DIST_FILES+=	${.CURDIR}/Minix.libstdcxx
12.endif
13
14.if ${MKLIBCXX} == "yes"
15EXTRA_DIST_FILES+=	${.CURDIR}/Minix.libcxx
16.endif
17
18.if ${MKBITCODE} == "yes"
19EXTRA_DIST_FILES+=	${.CURDIR}/Minix.bitcode
20.endif
21
22.if exists(NetBSD.dist.${MACHINE_ARCH})
23EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.${MACHINE_ARCH}
24.endif
25.endif # defined(__MINIX)
26
27# XXX these are only used by compat currently, but they could be used
28# by something else; this may need to be fixed properly in the future.
29.if defined(MKCOMPAT) && ${MKCOMPAT} != "no"
30.include "${NETBSDSRCDIR}/compat/archdirs.mk"
31.if exists(NetBSD.dist.${MACHINE_ARCH})
32EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.${MACHINE_ARCH}
33.elif !empty(MACHINE_ARCH:Mearm*)
34EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.earm
35.endif
36EXTRA_DIST_FILES+=	NetBSD.dist.compat	# autogenerated
37.if defined(MKCOMPATX11) && ${MKCOMPATX11} != "no" && ${MKX11} != "no"
38EXTRA_DIST_FILES+=	NetBSD.dist.xcompat	# autogenerated
39.endif
40.endif
41
42.if ${MKATF} != "no"
43EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.tests
44.if defined(MKCOMPATTESTS) && ${MKCOMPATTESTS} != "no"
45EXTRA_DIST_FILES+=	NetBSD.dist.tests.compat
46.endif
47.endif
48
49.if ${MKDTRACE} != "no"
50EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.dtrace
51.endif
52
53.if ${MKEXTSRC} != "no"
54EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.extsrc
55.endif
56
57NetBSD.dist:	NetBSD.dist.tmp
58	cmp -s NetBSD.dist.tmp NetBSD.dist || { \
59		echo "Updating NetBSD.dist"; \
60		mv NetBSD.dist.tmp NetBSD.dist; \
61	}
62NetBSD.dist.tmp:: ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES}
63	${TOOL_CAT} ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES} > \
64	    ${.TARGET}
65
66NetBSD.dist.compat: ${.CURDIR}/NetBSD.dist.compat.in ${.CURDIR}/mkcompat.awk
67	${MKCREATE}
68	${TOOL_AWK} -f ${.CURDIR}/mkcompat.awk \
69	    -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} \
70		${.CURDIR}/NetBSD.dist.compat.in \
71	     > ${.TARGET}
72
73NetBSD.dist.xcompat: ${.CURDIR}/NetBSD.dist.xcompat.in ${.CURDIR}/mkcompat.awk
74	${MKCREATE}
75	${TOOL_AWK} -f ${.CURDIR}/mkcompat.awk \
76	    -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} \
77		${.CURDIR}/NetBSD.dist.xcompat.in \
78	     > ${.TARGET}
79
80NetBSD.dist.tests.compat: ${.CURDIR}/NetBSD.dist.tests \
81		${.CURDIR}/mkcompattree.awk
82	${MKCREATE}
83	${TOOL_AWK} -f ${.CURDIR}/mkcompattree.awk \
84	    -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} -v S="usr/tests" \
85		${.CURDIR}/NetBSD.dist.tests \
86	     > ${.TARGET}
87
88CONFIGFILES=	NetBSD.dist special
89FILESDIR=	/etc/mtree
90
91# distrib-dirs --
92#	Populate $DESTDIR with directories needed by NetBSD
93#
94.if ${MKUNPRIVED} == "no"
95TOOL_MTREE.unpriv=
96.else
97TOOL_MTREE.unpriv=	-W
98.endif
99
100# postinstall(8) invokes this target to produce the right
101# /etc/mtree/NetBSD.dist content without duplicating logic from
102# the Makefile.
103#
104emit_dist_file:	${EXTRA_DIST_FILES}
105	@cat ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES}
106
107distrib-dirs: .PHONY check_DESTDIR NetBSD.dist
108.if !defined(DISTRIBUTION_DONE)						# {
109# Create DESTDIR using HOST_INSTALL_DIR, not INSTALL_DIR, because
110# INSTALL_DIR would want to write to the metalog, and it can't do that
111# if the metalog is inside DESTDIR but DESTDIR doesn't yet exist.
112	${HOST_INSTALL_DIR} -m 755 ${DESTDIR}
113# Invoke mtree to create the directories listed in NetBSD.dist;
114# then invoke mtree again to register those directories in the metalog.
115	${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \
116	    -p ${DESTDIR}/ -U ${TOOL_MTREE.unpriv}
117.if ${MKUNPRIVED} != "no"						# {
118	${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \
119	    -p ${DESTDIR}/ -C -k all | \
120	    ${TOOL_AWK} '/ optional/ {next} // {print}' | ${METALOG.add}
121.endif	# MKUNPRIVED							# }
122.endif	# DISTRIBUTION_DONE						# }
123
124CLEANFILES+=	NetBSD.dist NetBSD.dist.tmp
125CLEANFILES+=	NetBSD.dist.compat
126CLEANFILES+=	NetBSD.dist.tests.compat
127
128.include <bsd.prog.mk>
129