1 1.21 dsl # $NetBSD: Makefile.crunch,v 1.21 2005/09/05 20:14:08 dsl 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.17 lukem # SMALLPROG_INET6 if != 0 and SMALLPROG != 0, and ${USE_INET6} != "no", 13 1.17 lukem # add SMALLPROG_INET6=1 to CRUNCHENV. [default: 0] 14 1.9 lukem # CRUNCHENV environment to pass to crunchgen(1) and when building 15 1.18 lukem # the crunched program with make(1) (as command line 16 1.18 lukem # variables, to override any user provided environment 17 1.18 lukem # or make(1) cmdline vars). 18 1.6 lukem # CRUNCHGEN_FLAGS extra options to crunchgen(1) 19 1.4 lukem # DESTDIR destination directory 20 1.4 lukem # PARSELISTENV environment variables to set for parselist.awk 21 1.4 lukem # 22 1.9 lukem # Variables modified by this: 23 1.11 lukem # CRUNCHENV may get SMALLPROG=1 or SMALLPROG_INET6=1 added 24 1.11 lukem # 25 1.9 lukem 26 1.12 lukem .if !defined(_MAKEFILE_CRUNCH_) 27 1.12 lukem _MAKEFILE_CRUNCH_=1 28 1.12 lukem 29 1.12 lukem 30 1.11 lukem SMALLPROG?= 1 31 1.11 lukem SMALLPROG_INET6?= 0 32 1.11 lukem .if ${SMALLPROG} # { 33 1.11 lukem CRUNCHENV+= SMALLPROG=1 34 1.17 lukem .if ${SMALLPROG_INET6} && (${USE_INET6} != "no") 35 1.11 lukem CRUNCHENV+= SMALLPROG_INET6=1 36 1.11 lukem .endif 37 1.11 lukem .endif # } 38 1.4 lukem 39 1.7 lukem .include "${DISTRIBDIR}/common/Makefile.parselist" 40 1.1 lukem 41 1.13 dsl .PHONY: ${CRUNCHBIN} 42 1.1 lukem ${CRUNCHBIN}: ${CRUNCHBIN}.mk ${CRUNCHBIN}.cache ${CRUNCHBIN}.c 43 1.18 lukem ${MAKE} ${CRUNCHENV} -f ${CRUNCHBIN}.mk ${CRUNCHBIN}.crunched 44 1.1 lukem 45 1.14 dsl ${CRUNCHBIN}.c: ${CRUNCHBIN}.mk 46 1.14 dsl [ ! -f ${.TARGET} ] || touch ${.TARGET} 47 1.14 dsl 48 1.14 dsl ${CRUNCHBIN}.cache: ${CRUNCHBIN}.mk 49 1.14 dsl [ ! -f ${.TARGET} ] || touch ${.TARGET} 50 1.14 dsl 51 1.20 dsl ${CRUNCHBIN}.mk: ${CRUNCHBIN}.conf ${TOOL_CRUNCHGEN:[-1]} 52 1.16 lukem ${CRUNCHENV} ${TOOL_CRUNCHGEN} -f -D ${NETBSDSRCDIR} \ 53 1.21 dsl -L ${DESTDIR}/usr/lib -q ${CRUNCHGEN_FLAGS} ${CRUNCHBIN}.conf 54 1.1 lukem 55 1.7 lukem ${CRUNCHBIN}.conf: ${LISTS} ${PARSELISTDEP} 56 1.1 lukem -rm -f ${.TARGET} ${.TARGET}.tmp 57 1.7 lukem ${PARSELIST} -v mode=crunch ${LISTS} > ${.TARGET}.tmp \ 58 1.1 lukem && mv ${.TARGET}.tmp ${.TARGET} 59 1.1 lukem 60 1.2 lukem CLEANFILES+= ${CRUNCHBIN} ${CRUNCHBIN}.conf ${CRUNCHBIN}.conf.tmp \ 61 1.2 lukem ${CRUNCHBIN}.cache *.o *.cro *.c 62 1.1 lukem 63 1.1 lukem clean cleandir distclean: cleancrunchgen 64 1.1 lukem 65 1.1 lukem .PHONY: cleancrunchgen 66 1.1 lukem 67 1.1 lukem cleancrunchgen: 68 1.1 lukem if [ -f ${CRUNCHBIN}.mk ]; then \ 69 1.15 lukem ${MAKE} -f ${CRUNCHBIN}.mk clean; \ 70 1.1 lukem fi 71 1.2 lukem rm -f ${CRUNCHBIN}.mk 72 1.12 lukem 73 1.12 lukem 74 1.12 lukem .endif # _MAKEFILE_CRUNCH_ 75