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