1 # $NetBSD: Makefile,v 1.40 2019/02/17 05:29:08 mrg Exp $ 2 3 .include <bsd.own.mk> 4 5 .if ${MKX11} != "no" 6 EXTRA_DIST_FILES= NetBSD.dist.Xorg 7 .endif 8 9 # Derived from MACHINE_CPU, but keeping 32/64bit for most. 10 MTREE_MACHINE_ARCH=${MACHINE_ARCH:C/mipse[bl]/mips/:C/mips64e[bl]/mips64/:C/sh3e[bl]/sh3/:S/coldfire/m68k/:S/m68000/m68k/:C/arm.*/arm/:C/earm.*/arm/:S/earm/arm/:S/aarch64eb/aarch64/:S/or1knd/or1k/} 11 12 # The compat specific files 13 14 .if defined(MKCOMPAT) && ${MKCOMPAT} != "no" 15 .include "${NETBSDSRCDIR}/compat/archdirs.mk" 16 .if exists(NetBSD.compat.${MTREE_MACHINE_ARCH}) 17 EXTRA_DIST_FILES+= NetBSD.compat.${MTREE_MACHINE_ARCH} 18 .endif 19 EXTRA_DIST_FILES+= NetBSD.dist.compat # autogenerated 20 .if defined(MKCOMPATX11) && ${MKCOMPATX11} != "no" && ${MKX11} != "no" 21 EXTRA_DIST_FILES+= NetBSD.dist.xcompat # autogenerated 22 .endif 23 .endif 24 25 26 # Platform specific files. 27 # First we grab the mtree-specific, then either the MACHINE_ARCH or 28 # MACHINE_CPU files, and finally the MACHINE files, as long as they 29 # aren't the same files. 30 31 .if exists(NetBSD.dist.${MTREE_MACHINE_ARCH}) 32 EXTRA_DIST_FILES+= NetBSD.dist.${MTREE_MACHINE_ARCH} 33 .endif 34 35 .if empty(MTREE_MACHINE_ARCH:M${MACHINE_ARCH}) && \ 36 exists(NetBSD.dist.${MACHINE_ARCH}) 37 EXTRA_DIST_FILES+= NetBSD.dist.${MACHINE_ARCH} 38 .elif empty(MTREE_MACHINE_ARCH:M${MACHINE_CPU}) && \ 39 exists(NetBSD.dist.${MACHINE_CPU}) 40 EXTRA_DIST_FILES+= NetBSD.dist.${MACHINE_CPU} 41 .endif 42 43 .if empty(MTREE_MACHINE_ARCH:M${MACHINE}) && \ 44 exists(NetBSD.dist.${MACHINE}) 45 EXTRA_DIST_FILES+= NetBSD.dist.${MACHINE} 46 .endif 47 48 49 # The build specific files. 50 51 .if ${MKATF} != "no" 52 EXTRA_DIST_FILES+= NetBSD.dist.tests 53 .if defined(MKCOMPATTESTS) && ${MKCOMPATTESTS} != "no" 54 EXTRA_DIST_FILES+= NetBSD.dist.tests.compat 55 .endif 56 .endif 57 58 .if ${MKDTRACE} != "no" 59 EXTRA_DIST_FILES+= NetBSD.dist.dtrace 60 .endif 61 62 .if ${MKEXTSRC} != "no" 63 EXTRA_DIST_FILES+= NetBSD.dist.extsrc 64 .endif 65 66 .if ${MKISCSI} != "no" 67 EXTRA_DIST_FILES+= NetBSD.dist.iscsi 68 .endif 69 70 NetBSD.dist: NetBSD.dist.tmp 71 cmp -s NetBSD.dist.tmp NetBSD.dist || { \ 72 echo "Updating NetBSD.dist"; \ 73 mv NetBSD.dist.tmp NetBSD.dist; \ 74 } 75 # Rebuild every time 76 .PHONY: NetBSD.dist.tmp 77 NetBSD.dist.tmp: NetBSD.dist.base ${EXTRA_DIST_FILES} 78 ${TOOL_CAT} ${.ALLSRC} > ${.TARGET} 79 80 NetBSD.dist.compat: NetBSD.dist.compat.in mkcompat.awk 81 ${MKCREATE} 82 ${TOOL_AWK} -f ${.ALLSRC:M*.awk} -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} \ 83 ${.ALLSRC:M*.in} > ${.TARGET} 84 85 NetBSD.dist.xcompat: NetBSD.dist.xcompat.in mkcompat.awk 86 ${MKCREATE} 87 ${TOOL_AWK} -f ${.ALLSRC:M*.awk} -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} \ 88 ${.ALLSRC:M*.in} > ${.TARGET} 89 90 NetBSD.dist.tests.compat: NetBSD.dist.tests mkcompattree.awk 91 ${MKCREATE} 92 ${TOOL_AWK} -f ${.ALLSRC:M*.awk} \ 93 -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} -v S="usr/tests" \ 94 ${.ALLSRC:M*.tests} > ${.TARGET} 95 96 CONFIGFILES= NetBSD.dist special 97 FILESDIR= /etc/mtree 98 99 # distrib-dirs -- 100 # Populate $DESTDIR with directories needed by NetBSD 101 # 102 .if ${MKUNPRIVED} == "no" 103 TOOL_MTREE.unpriv= 104 .else 105 TOOL_MTREE.unpriv= -W 106 .endif 107 108 # postinstall(8) invokes this target to produce the right 109 # /etc/mtree/NetBSD.dist content without duplicating logic from 110 # the Makefile. 111 # 112 emit_dist_file: NetBSD.dist.base ${EXTRA_DIST_FILES} 113 @cat ${.ALLSRC} 114 115 distrib-dirs: .PHONY check_DESTDIR NetBSD.dist 116 .if !defined(DISTRIBUTION_DONE) # { 117 # Create DESTDIR using HOST_INSTALL_DIR, not INSTALL_DIR, because 118 # INSTALL_DIR would want to write to the metalog, and it can't do that 119 # if the metalog is inside DESTDIR but DESTDIR doesn't yet exist. 120 ${HOST_INSTALL_DIR} -m 755 ${DESTDIR} 121 # Invoke mtree to create the directories listed in NetBSD.dist; 122 # then invoke mtree again to register those directories in the metalog. 123 ${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \ 124 -p ${DESTDIR}/ -U ${TOOL_MTREE.unpriv} 125 .if ${MKUNPRIVED} != "no" # { 126 ${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \ 127 -p ${DESTDIR}/ -C -k all | \ 128 ${TOOL_AWK} '/ optional/ {next} // {print}' | ${METALOG.add} 129 .endif # MKUNPRIVED # } 130 .endif # DISTRIBUTION_DONE # } 131 132 CLEANFILES+= NetBSD.dist NetBSD.dist.tmp 133 CLEANFILES+= NetBSD.dist.compat 134 CLEANFILES+= NetBSD.dist.tests.compat 135 136 .include <bsd.prog.mk> 137