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