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