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