Home | History | Annotate | Line # | Download | only in mtree
Makefile revision 1.30
      1 #	$NetBSD: Makefile,v 1.30 2015/10/09 19:23:18 riz Exp $
      2 
      3 .include <bsd.own.mk>
      4 
      5 .if ${MKX11} != "no"
      6 EXTRA_DIST_FILES=	${.CURDIR}/NetBSD.dist.Xorg
      7 .endif
      8 
      9 # XXX these are only used by compat currently, but they could be used
     10 # by something else; this may need to be fixed properly in the future.
     11 .if defined(MKCOMPAT) && ${MKCOMPAT} != "no"
     12 .include "${NETBSDSRCDIR}/compat/archdirs.mk"
     13 .if exists(NetBSD.dist.${MACHINE_ARCH})
     14 EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.${MACHINE_ARCH}
     15 .elif !empty(MACHINE_ARCH:Mearm*)
     16 EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.earm
     17 .endif
     18 EXTRA_DIST_FILES+=	NetBSD.dist.compat	# autogenerated
     19 .if defined(MKCOMPATX11) && ${MKCOMPATX11} != "no" && ${MKX11} != "no"
     20 EXTRA_DIST_FILES+=	NetBSD.dist.xcompat	# autogenerated
     21 .endif
     22 .endif
     23 
     24 .if ${MKATF} != "no"
     25 EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.tests
     26 .if defined(MKCOMPATTESTS) && ${MKCOMPATTESTS} != "no"
     27 EXTRA_DIST_FILES+=	NetBSD.dist.tests.compat
     28 .endif
     29 .endif
     30 
     31 .if ${MKDTRACE} != "no"
     32 EXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.dtrace
     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:	${EXTRA_DIST_FILES}
     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