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