Home | History | Annotate | Line # | Download | only in mtree
Makefile revision 1.32
      1 #	$NetBSD: Makefile,v 1.32 2016/06/09 00:19:31 mrg 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 #
     40 # The NetBSD.dist.base and ${EXTRA_DIST_FILES} should really be part
     41 # of the NetBSD.dist.tmp rule, but that needs to have no dependencies
     42 # so that it is re-run every time, yet it depends upon files existing.
     43 #
     44 .BEGIN: ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES} 
     45 NetBSD.dist:	NetBSD.dist.tmp
     46 	cmp -s NetBSD.dist.tmp NetBSD.dist || { \
     47 		echo "Updating NetBSD.dist"; \
     48 		mv NetBSD.dist.tmp NetBSD.dist; \
     49 	}
     50 NetBSD.dist.tmp::
     51 	${TOOL_CAT} ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES} > \
     52 	    ${.TARGET}
     53 
     54 NetBSD.dist.compat: ${.CURDIR}/NetBSD.dist.compat.in ${.CURDIR}/mkcompat.awk
     55 	${MKCREATE}
     56 	${TOOL_AWK} -f ${.CURDIR}/mkcompat.awk \
     57 	    -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} \
     58 		${.CURDIR}/NetBSD.dist.compat.in \
     59 	     > ${.TARGET}
     60 
     61 NetBSD.dist.xcompat: ${.CURDIR}/NetBSD.dist.xcompat.in ${.CURDIR}/mkcompat.awk
     62 	${MKCREATE}
     63 	${TOOL_AWK} -f ${.CURDIR}/mkcompat.awk \
     64 	    -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} \
     65 		${.CURDIR}/NetBSD.dist.xcompat.in \
     66 	     > ${.TARGET}
     67 
     68 NetBSD.dist.tests.compat: ${.CURDIR}/NetBSD.dist.tests \
     69 		${.CURDIR}/mkcompattree.awk 
     70 	${MKCREATE}
     71 	${TOOL_AWK} -f ${.CURDIR}/mkcompattree.awk \
     72 	    -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} -v S="usr/tests" \
     73 		${.CURDIR}/NetBSD.dist.tests \
     74 	     > ${.TARGET}
     75 
     76 CONFIGFILES=	NetBSD.dist special
     77 FILESDIR=	/etc/mtree
     78 
     79 # distrib-dirs --
     80 #	Populate $DESTDIR with directories needed by NetBSD
     81 #
     82 .if ${MKUNPRIVED} == "no"
     83 TOOL_MTREE.unpriv=
     84 .else
     85 TOOL_MTREE.unpriv=	-W
     86 .endif
     87 
     88 # postinstall(8) invokes this target to produce the right
     89 # /etc/mtree/NetBSD.dist content without duplicating logic from
     90 # the Makefile.
     91 #
     92 emit_dist_file:	${EXTRA_DIST_FILES}
     93 	@cat ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES}
     94 
     95 distrib-dirs: .PHONY check_DESTDIR NetBSD.dist
     96 .if !defined(DISTRIBUTION_DONE)						# {
     97 # Create DESTDIR using HOST_INSTALL_DIR, not INSTALL_DIR, because
     98 # INSTALL_DIR would want to write to the metalog, and it can't do that
     99 # if the metalog is inside DESTDIR but DESTDIR doesn't yet exist.
    100 	${HOST_INSTALL_DIR} -m 755 ${DESTDIR}
    101 # Invoke mtree to create the directories listed in NetBSD.dist;
    102 # then invoke mtree again to register those directories in the metalog.
    103 	${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \
    104 	    -p ${DESTDIR}/ -U ${TOOL_MTREE.unpriv}
    105 .if ${MKUNPRIVED} != "no"						# {
    106 	${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \
    107 	    -p ${DESTDIR}/ -C -k all | \
    108 	    ${TOOL_AWK} '/ optional/ {next} // {print}' | ${METALOG.add}
    109 .endif	# MKUNPRIVED							# }
    110 .endif	# DISTRIBUTION_DONE						# }
    111 
    112 CLEANFILES+=	NetBSD.dist NetBSD.dist.tmp
    113 CLEANFILES+=	NetBSD.dist.compat
    114 CLEANFILES+=	NetBSD.dist.tests.compat
    115 
    116 .include <bsd.prog.mk>
    117