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