Home | History | Annotate | Line # | Download | only in mtree
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"
      7 EXTRA_DIST_FILES=	${.CURDIR}/NetBSD.dist.Xorg
      8 . else
      9 EXTRA_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})
     18 EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.${MACHINE_ARCH}
     19 .elif !empty(MACHINE_ARCH:Mearm*)
     20 EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.earm
     21 .endif
     22 EXTRA_DIST_FILES+=	NetBSD.dist.compat	# autogenerated
     23 .endif
     24 
     25 .if ${MKATF} != "no"
     26 EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.tests
     27 .if ${MKCOMPATTESTS} != "no"
     28 EXTRA_DIST_FILES+=	NetBSD.dist.tests.compat
     29 .endif
     30 .endif
     31 
     32 .if ${MKEXTSRC} != "no"
     33 EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.extsrc
     34 .endif
     35 
     36 NetBSD.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 	}
     41 NetBSD.dist.tmp:: ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES}
     42 	${TOOL_CAT} ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES} > \
     43 	    ${.TARGET}
     44 
     45 NetBSD.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 
     52 NetBSD.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 
     60 CONFIGFILES=	NetBSD.dist special
     61 FILESDIR=	/etc/mtree
     62 
     63 # distrib-dirs --
     64 #	Populate $DESTDIR with directories needed by NetBSD
     65 #
     66 .if ${MKUNPRIVED} == "no"
     67 TOOL_MTREE.unpriv=
     68 .else
     69 TOOL_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 #
     76 emit_dist_file:
     77 	@cat ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES}
     78 
     79 distrib-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 
     96 CLEANFILES+=	NetBSD.dist NetBSD.dist.tmp
     97 CLEANFILES+=	NetBSD.dist.compat
     98 CLEANFILES+=	NetBSD.dist.tests.compat
     99 
    100 .include <bsd.prog.mk>
    101