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