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