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