[BACK]Return to Makefile.crunch CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / distrib / common

File: [cvs.NetBSD.org] / src / distrib / common / Makefile.crunch (download)

Revision 1.24, Sun Oct 19 22:05:19 2008 UTC (11 years, 9 months ago) by apb
Branch: MAIN
CVS Tags: yamt-pagecache-tag8, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, netbsd-5-base, netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, netbsd-5, matt-premerge-20091211, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, matt-nb5-pq3-base, matt-nb5-pq3, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-premerge-20091211, matt-nb5-mips64-k15, matt-nb5-mips64, matt-nb4-mips64-k7-u2a-k9b, matt-mips64-premerge-20101231, matt-mips64-base2, khorben-n900, jym-xensuspend-nbase, jym-xensuspend-base, jym-xensuspend, cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2, agc-symver-base, agc-symver
Branch point for: yamt-pagecache, tls-maxphys
Changes since 1.23: +2 -1 lines

Use ${TOOL_AWK} instead of ${AWK} or plain "awk" in make commands.
Pass AWK=${TOOL_AWK:Q} to shell scripts that use awk.

#	$NetBSD: Makefile.crunch,v 1.24 2008/10/19 22:05:19 apb Exp $
#
# Makefile snippet to build a crunchgen(1)ed binary from the provided lists
#
# Required variables:
#	NETBSDSRCDIR	top level of src tree (set by <bsd.own.mk>)
#	CRUNCHBIN	name of crunchgen(1)ed binary
#	LISTS		list file(s) to use
#
# Optional variables:
#	SMALLPROG	if != 0, add SMALLPROG=1 to CRUNCHENV.  [default: 1]
#	SMALLPROG_INET6	if != 0 and SMALLPROG != 0, and ${USE_INET6} != "no",
#			add SMALLPROG_INET6=1 to CRUNCHENV.  [default: 0]
#	CRUNCHENV	environment to pass to crunchgen(1) and when building
#			the crunched program with make(1) (as command line
#			variables, to override any user provided environment
#			or make(1) cmdline vars).
#	CRUNCHGEN_FLAGS	extra options to crunchgen(1)
#	DESTDIR		destination directory
#	PARSELISTENV	environment variables to set for parselist.awk
#
# Variables modified by this:
#	CRUNCHENV	may get SMALLPROG=1 or SMALLPROG_INET6=1 added
#

.if !defined(_MAKEFILE_CRUNCH_)
_MAKEFILE_CRUNCH_=1

CRUNCHENV+=		AWK=${TOOL_AWK:Q}

SMALLPROG?=		1
SMALLPROG_INET6?=	0
.if ${SMALLPROG}				# {
CRUNCHENV+=		SMALLPROG=1
.if ${SMALLPROG_INET6} && (${USE_INET6} != "no")
CRUNCHENV+=		SMALLPROG_INET6=1
.endif
.endif						# }

.include "${DISTRIBDIR}/common/Makefile.parselist"

.PHONY:	${CRUNCHBIN}
${CRUNCHBIN}: ${CRUNCHBIN}.mk ${CRUNCHBIN}.cache ${CRUNCHBIN}.c
	${MAKE} ${CRUNCHENV} -f ${CRUNCHBIN}.mk ${CRUNCHBIN}.crunched

${CRUNCHBIN}.c: ${CRUNCHBIN}.mk
	[ ! -f ${.TARGET} ] || touch ${.TARGET}

${CRUNCHBIN}.cache: ${CRUNCHBIN}.mk
	[ ! -f ${.TARGET} ] || touch ${.TARGET}

CRUNCHGEN != command -v ${TOOL_CRUNCHGEN:[-1]} || echo

${CRUNCHBIN}.mk: ${CRUNCHBIN}.conf  ${CRUNCHGEN}
	${CRUNCHENV} ${TOOL_CRUNCHGEN} -f -D ${NETBSDSRCDIR} \
	    -L ${DESTDIR}/usr/lib -q ${CRUNCHGEN_FLAGS} ${CRUNCHBIN}.conf

${CRUNCHBIN}.conf: ${LISTS} ${PARSELISTDEP}
	-rm -f ${.TARGET} ${.TARGET}.tmp
	${PARSELIST} -v mode=crunch ${LISTS} > ${.TARGET}.tmp \
	&& mv ${.TARGET}.tmp ${.TARGET}

CLEANFILES+=	${CRUNCHBIN} ${CRUNCHBIN}.conf ${CRUNCHBIN}.conf.tmp \
		${CRUNCHBIN}.cache *.o *.cro *.c

clean cleandir distclean: cleancrunchgen

.PHONY: cleancrunchgen

cleancrunchgen:
	if [ -f ${CRUNCHBIN}.mk ]; then \
		${MAKE} -f ${CRUNCHBIN}.mk clean; \
	fi
	rm -f ${CRUNCHBIN}.mk


.endif	# _MAKEFILE_CRUNCH_