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