Makefile revision 1.32
11.32Smrg#	$NetBSD: Makefile,v 1.32 2016/06/09 00:19:31 mrg Exp $
21.6Smrg
31.6Smrg.include <bsd.own.mk>
41.6Smrg
51.6Smrg.if ${MKX11} != "no"
61.12SmrgEXTRA_DIST_FILES=	${.CURDIR}/NetBSD.dist.Xorg
71.6Smrg.endif
81.6Smrg
91.19Smrg# XXX these are only used by compat currently, but they could be used
101.19Smrg# by something else; this may need to be fixed properly in the future.
111.28Smartin.if defined(MKCOMPAT) && ${MKCOMPAT} != "no"
121.25Smatt.include "${NETBSDSRCDIR}/compat/archdirs.mk"
131.13Smrg.if exists(NetBSD.dist.${MACHINE_ARCH})
141.13SmrgEXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.${MACHINE_ARCH}
151.23Smatt.elif !empty(MACHINE_ARCH:Mearm*)
161.23SmattEXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.earm
171.13Smrg.endif
181.25SmattEXTRA_DIST_FILES+=	NetBSD.dist.compat	# autogenerated
191.29Smrg.if defined(MKCOMPATX11) && ${MKCOMPATX11} != "no" && ${MKX11} != "no"
201.26SmattEXTRA_DIST_FILES+=	NetBSD.dist.xcompat	# autogenerated
211.26Smatt.endif
221.19Smrg.endif
231.13Smrg
241.18Snjoly.if ${MKATF} != "no"
251.18SnjolyEXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.tests
261.28Smartin.if defined(MKCOMPATTESTS) && ${MKCOMPATTESTS} != "no"
271.25SmattEXTRA_DIST_FILES+=	NetBSD.dist.tests.compat
281.25Smatt.endif
291.18Snjoly.endif
301.18Snjoly
311.30Sriz.if ${MKDTRACE} != "no"
321.30SrizEXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.dtrace
331.30Sriz.endif
341.30Sriz
351.11Suebayasi.if ${MKEXTSRC} != "no"
361.12SmrgEXTRA_DIST_FILES+=	${.CURDIR}/NetBSD.dist.extsrc
371.11Suebayasi.endif
381.11Suebayasi
391.32Smrg#
401.32Smrg# The NetBSD.dist.base and ${EXTRA_DIST_FILES} should really be part
411.32Smrg# of the NetBSD.dist.tmp rule, but that needs to have no dependencies
421.32Smrg# so that it is re-run every time, yet it depends upon files existing.
431.32Smrg#
441.32Smrg.BEGIN: ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES} 
451.22SapbNetBSD.dist:	NetBSD.dist.tmp
461.22Sapb	cmp -s NetBSD.dist.tmp NetBSD.dist || { \
471.14Suebayasi		echo "Updating NetBSD.dist"; \
481.22Sapb		mv NetBSD.dist.tmp NetBSD.dist; \
491.14Suebayasi	}
501.31SmrgNetBSD.dist.tmp::
511.12Smrg	${TOOL_CAT} ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES} > \
521.9Sstacktic	    ${.TARGET}
531.1Smrg
541.25SmattNetBSD.dist.compat: ${.CURDIR}/NetBSD.dist.compat.in ${.CURDIR}/mkcompat.awk
551.25Smatt	${MKCREATE}
561.25Smatt	${TOOL_AWK} -f ${.CURDIR}/mkcompat.awk \
571.25Smatt	    -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} \
581.25Smatt		${.CURDIR}/NetBSD.dist.compat.in \
591.25Smatt	     > ${.TARGET}
601.25Smatt
611.26SmattNetBSD.dist.xcompat: ${.CURDIR}/NetBSD.dist.xcompat.in ${.CURDIR}/mkcompat.awk
621.26Smatt	${MKCREATE}
631.26Smatt	${TOOL_AWK} -f ${.CURDIR}/mkcompat.awk \
641.26Smatt	    -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} \
651.26Smatt		${.CURDIR}/NetBSD.dist.xcompat.in \
661.26Smatt	     > ${.TARGET}
671.26Smatt
681.25SmattNetBSD.dist.tests.compat: ${.CURDIR}/NetBSD.dist.tests \
691.25Smatt		${.CURDIR}/mkcompattree.awk 
701.25Smatt	${MKCREATE}
711.25Smatt	${TOOL_AWK} -f ${.CURDIR}/mkcompattree.awk \
721.25Smatt	    -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} -v S="usr/tests" \
731.25Smatt		${.CURDIR}/NetBSD.dist.tests \
741.25Smatt	     > ${.TARGET}
751.25Smatt
761.5SlukemCONFIGFILES=	NetBSD.dist special
771.1SmrgFILESDIR=	/etc/mtree
781.1Smrg
791.6Smrg# distrib-dirs --
801.6Smrg#	Populate $DESTDIR with directories needed by NetBSD
811.6Smrg#
821.6Smrg.if ${MKUNPRIVED} == "no"
831.6SmrgTOOL_MTREE.unpriv=
841.6Smrg.else
851.6SmrgTOOL_MTREE.unpriv=	-W
861.6Smrg.endif
871.6Smrg
881.17Sdyoung# postinstall(8) invokes this target to produce the right
891.17Sdyoung# /etc/mtree/NetBSD.dist content without duplicating logic from
901.17Sdyoung# the Makefile.
911.17Sdyoung#
921.28Smartinemit_dist_file:	${EXTRA_DIST_FILES}
931.24Schristos	@cat ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES}
941.16Sdyoung
951.10Sdrochnerdistrib-dirs: .PHONY check_DESTDIR NetBSD.dist
961.6Smrg.if !defined(DISTRIBUTION_DONE)						# {
971.6Smrg# Create DESTDIR using HOST_INSTALL_DIR, not INSTALL_DIR, because
981.6Smrg# INSTALL_DIR would want to write to the metalog, and it can't do that
991.6Smrg# if the metalog is inside DESTDIR but DESTDIR doesn't yet exist.
1001.6Smrg	${HOST_INSTALL_DIR} -m 755 ${DESTDIR}
1011.20Sjym# Invoke mtree to create the directories listed in NetBSD.dist;
1021.6Smrg# then invoke mtree again to register those directories in the metalog.
1031.6Smrg	${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \
1041.6Smrg	    -p ${DESTDIR}/ -U ${TOOL_MTREE.unpriv}
1051.6Smrg.if ${MKUNPRIVED} != "no"						# {
1061.6Smrg	${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \
1071.6Smrg	    -p ${DESTDIR}/ -C -k all | \
1081.6Smrg	    ${TOOL_AWK} '/ optional/ {next} // {print}' | ${METALOG.add}
1091.6Smrg.endif	# MKUNPRIVED							# }
1101.6Smrg.endif	# DISTRIBUTION_DONE						# }
1111.6Smrg
1121.22SapbCLEANFILES+=	NetBSD.dist NetBSD.dist.tmp
1131.25SmattCLEANFILES+=	NetBSD.dist.compat
1141.25SmattCLEANFILES+=	NetBSD.dist.tests.compat
1151.10Sdrochner
1161.1Smrg.include <bsd.prog.mk>
117