1# $NetBSD: Makefile.crunch,v 1.11 2002/10/17 02:05:36 lukem Exp $ 2# 3# Makefile snippet to build a crunchgen(1)ed binary from the provided lists 4# 5 6# 7# Required variables: 8# NETBSDSRCDIR top level of src tree (set by <bsd.own.mk>) 9# CRUNCHBIN name of crunchgen(1)ed binary 10# LISTS list file(s) to use 11# 12# Optional variables: 13# SMALLPROG if != 0, add SMALLPROG=1 to CRUNCHENV. [default: 1] 14# SMALLPROG_INET6 if != 0 and SMALLPROG != 0, add SMALLPROG_INET6=1 15# to CRUNCHENV. [default: 0] 16# CRUNCHENV environment to pass to crunchgen(1) and when building 17# the crunched program. 18# CRUNCHGEN_FLAGS extra options to crunchgen(1) 19# DESTDIR destination directory 20# PARSELISTENV environment variables to set for parselist.awk 21# 22# Variables modified by this: 23# CRUNCHENV may get SMALLPROG=1 or SMALLPROG_INET6=1 added 24# 25 26SMALLPROG?= 1 27SMALLPROG_INET6?= 0 28.if ${SMALLPROG} # { 29CRUNCHENV+= SMALLPROG=1 30.if ${SMALLPROG_INET6} 31CRUNCHENV+= SMALLPROG_INET6=1 32.endif 33.endif # } 34 35.include "${DISTRIBDIR}/common/Makefile.parselist" 36 37${CRUNCHBIN}: ${CRUNCHBIN}.mk ${CRUNCHBIN}.cache ${CRUNCHBIN}.c 38 ${CRUNCHENV} ${MAKE} -j 1 -f ${CRUNCHBIN}.mk all 39 40${CRUNCHBIN}.mk ${CRUNCHBIN}.cache ${CRUNCHBIN}.c: ${CRUNCHBIN}.conf 41 ${CRUNCHENV} ${CRUNCHGEN} -f -D ${NETBSDSRCDIR} -L ${DESTDIR}/usr/lib \ 42 -q ${CRUNCHGEN_FLAGS} ${.ALLSRC} 43 44${CRUNCHBIN}.conf: ${LISTS} ${PARSELISTDEP} 45 -rm -f ${.TARGET} ${.TARGET}.tmp 46 ${PARSELIST} -v mode=crunch ${LISTS} > ${.TARGET}.tmp \ 47 && mv ${.TARGET}.tmp ${.TARGET} 48 49CLEANFILES+= ${CRUNCHBIN} ${CRUNCHBIN}.conf ${CRUNCHBIN}.conf.tmp \ 50 ${CRUNCHBIN}.cache *.o *.cro *.c 51 52clean cleandir distclean: cleancrunchgen 53 54.PHONY: cleancrunchgen 55 56cleancrunchgen: 57 if [ -f ${CRUNCHBIN}.mk ]; then \ 58 ${MAKE} -j 1 -f ${CRUNCHBIN}.mk clean; \ 59 fi 60 rm -f ${CRUNCHBIN}.mk 61