Home | History | Annotate | Line # | Download | only in mtree
Makefile revision 1.22
      1 #	$NetBSD: Makefile,v 1.22 2011/09/10 17:02:46 apb 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 .if exists(NetBSD.dist.${MACHINE_ARCH})
     17 EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.${MACHINE_ARCH}
     18 .endif
     19 .endif
     20 
     21 .if ${MKATF} != "no"
     22 EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.tests
     23 .endif
     24 
     25 .if ${MKEXTSRC} != "no"
     26 EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.extsrc
     27 .endif
     28 
     29 NetBSD.dist:	NetBSD.dist.tmp
     30 	cmp -s NetBSD.dist.tmp NetBSD.dist || { \
     31 		echo "Updating NetBSD.dist"; \
     32 		mv NetBSD.dist.tmp NetBSD.dist; \
     33 	}
     34 NetBSD.dist.tmp::
     35 	${TOOL_CAT} ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES} > \
     36 	    ${.TARGET}
     37 
     38 CONFIGFILES=	NetBSD.dist special
     39 FILESDIR=	/etc/mtree
     40 
     41 # distrib-dirs --
     42 #	Populate $DESTDIR with directories needed by NetBSD
     43 #
     44 .if ${MKUNPRIVED} == "no"
     45 TOOL_MTREE.unpriv=
     46 .else
     47 TOOL_MTREE.unpriv=	-W
     48 .endif
     49 
     50 # postinstall(8) invokes this target to produce the right
     51 # /etc/mtree/NetBSD.dist content without duplicating logic from
     52 # the Makefile.
     53 #
     54 emit_dist_file:
     55 	cat ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES}
     56 
     57 distrib-dirs: .PHONY check_DESTDIR NetBSD.dist
     58 .if !defined(DISTRIBUTION_DONE)						# {
     59 # Create DESTDIR using HOST_INSTALL_DIR, not INSTALL_DIR, because
     60 # INSTALL_DIR would want to write to the metalog, and it can't do that
     61 # if the metalog is inside DESTDIR but DESTDIR doesn't yet exist.
     62 	${HOST_INSTALL_DIR} -m 755 ${DESTDIR}
     63 # Invoke mtree to create the directories listed in NetBSD.dist;
     64 # then invoke mtree again to register those directories in the metalog.
     65 	${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \
     66 	    -p ${DESTDIR}/ -U ${TOOL_MTREE.unpriv}
     67 .if ${MKUNPRIVED} != "no"						# {
     68 	${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \
     69 	    -p ${DESTDIR}/ -C -k all | \
     70 	    ${TOOL_AWK} '/ optional/ {next} // {print}' | ${METALOG.add}
     71 .endif	# MKUNPRIVED							# }
     72 .endif	# DISTRIBUTION_DONE						# }
     73 
     74 CLEANFILES+=	NetBSD.dist NetBSD.dist.tmp
     75 
     76 .include <bsd.prog.mk>
     77