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