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