Home | History | Annotate | Line # | Download | only in mtree
Makefile revision 1.33
      1 #	$NetBSD: Makefile,v 1.33 2016/06/09 03:44:01 christos Exp $
      2 
      3 .include <bsd.own.mk>
      4 
      5 .if ${MKX11} != "no"
      6 EXTRA_DIST_FILES=	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+=	NetBSD.dist.${MACHINE_ARCH}
     15 .elif !empty(MACHINE_ARCH:Mearm*)
     16 EXTRA_DIST_FILES+=	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+=	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+=	NetBSD.dist.dtrace
     33 .endif
     34 
     35 .if ${MKEXTSRC} != "no"
     36 EXTRA_DIST_FILES+=	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: 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: NetBSD.dist.base ${EXTRA_DIST_FILES}
     51 	${TOOL_CAT} ${.ALLSRC} > ${.TARGET}
     52 
     53 NetBSD.dist.compat: NetBSD.dist.compat.in mkcompat.awk
     54 	${MKCREATE}
     55 	${TOOL_AWK} -f ${.ALLSRC:M*.awk} -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} \
     56 	    ${.ALLSRC:M*.in} > ${.TARGET}
     57 
     58 NetBSD.dist.xcompat: NetBSD.dist.xcompat.in mkcompat.awk
     59 	${MKCREATE}
     60 	${TOOL_AWK} -f ${.ALLSRC:M*.awk} -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} \
     61 	    ${.ALLSRC:M*.in} > ${.TARGET}
     62 
     63 NetBSD.dist.tests.compat: NetBSD.dist.tests mkcompattree.awk 
     64 	${MKCREATE}
     65 	${TOOL_AWK} -f ${.ALLSRC:M*.awk}/mkcompattree.awk \
     66 	    -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} -v S="usr/tests" \
     67 		${.ALLSRC:M*.tests} > ${.TARGET}
     68 
     69 CONFIGFILES=	NetBSD.dist special
     70 FILESDIR=	/etc/mtree
     71 
     72 # distrib-dirs --
     73 #	Populate $DESTDIR with directories needed by NetBSD
     74 #
     75 .if ${MKUNPRIVED} == "no"
     76 TOOL_MTREE.unpriv=
     77 .else
     78 TOOL_MTREE.unpriv=	-W
     79 .endif
     80 
     81 # postinstall(8) invokes this target to produce the right
     82 # /etc/mtree/NetBSD.dist content without duplicating logic from
     83 # the Makefile.
     84 #
     85 emit_dist_file:	NetBSD.dist.base ${EXTRA_DIST_FILES}
     86 	@cat ${.ALLSRC}
     87 
     88 distrib-dirs: .PHONY check_DESTDIR NetBSD.dist
     89 .if !defined(DISTRIBUTION_DONE)						# {
     90 # Create DESTDIR using HOST_INSTALL_DIR, not INSTALL_DIR, because
     91 # INSTALL_DIR would want to write to the metalog, and it can't do that
     92 # if the metalog is inside DESTDIR but DESTDIR doesn't yet exist.
     93 	${HOST_INSTALL_DIR} -m 755 ${DESTDIR}
     94 # Invoke mtree to create the directories listed in NetBSD.dist;
     95 # then invoke mtree again to register those directories in the metalog.
     96 	${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \
     97 	    -p ${DESTDIR}/ -U ${TOOL_MTREE.unpriv}
     98 .if ${MKUNPRIVED} != "no"						# {
     99 	${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \
    100 	    -p ${DESTDIR}/ -C -k all | \
    101 	    ${TOOL_AWK} '/ optional/ {next} // {print}' | ${METALOG.add}
    102 .endif	# MKUNPRIVED							# }
    103 .endif	# DISTRIBUTION_DONE						# }
    104 
    105 CLEANFILES+=	NetBSD.dist NetBSD.dist.tmp
    106 CLEANFILES+=	NetBSD.dist.compat
    107 CLEANFILES+=	NetBSD.dist.tests.compat
    108 
    109 .include <bsd.prog.mk>
    110