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