Makefile.crunch revision 1.7 1 # $NetBSD: Makefile.crunch,v 1.7 2002/04/12 01:59:45 lukem Exp $
2 #
3 # Makefile snippet to build a crunchgen(1)ed binary from the provided lists
4 #
5
6 #
7 # Required variables:
8 # _SRC_TOP_ 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 # CRUNCHGEN_FLAGS extra options to crunchgen(1)
14 # DESTDIR destination directory
15 # PARSELISTENV environment variables to set for parselist.awk
16 #
17
18 .include "${DISTRIBDIR}/common/Makefile.parselist"
19
20 ${CRUNCHBIN}: ${CRUNCHBIN}.mk ${CRUNCHBIN}.cache ${CRUNCHBIN}.c
21 env SMALLPROG=1 ${MAKE} -f ${CRUNCHBIN}.mk all
22
23 ${CRUNCHBIN}.mk ${CRUNCHBIN}.cache ${CRUNCHBIN}.c: ${CRUNCHBIN}.conf
24 env SMALLPROG=1 \
25 ${CRUNCHGEN} -f -D ${_SRC_TOP_} -L ${DESTDIR}/usr/lib \
26 ${CRUNCHGEN_FLAGS} ${.ALLSRC}
27
28 ${CRUNCHBIN}.conf: ${LISTS} ${PARSELISTDEP}
29 -rm -f ${.TARGET} ${.TARGET}.tmp
30 ${PARSELIST} -v mode=crunch ${LISTS} > ${.TARGET}.tmp \
31 && mv ${.TARGET}.tmp ${.TARGET}
32
33 CLEANFILES+= ${CRUNCHBIN} ${CRUNCHBIN}.conf ${CRUNCHBIN}.conf.tmp \
34 ${CRUNCHBIN}.cache *.o *.cro *.c
35
36 clean cleandir distclean: cleancrunchgen
37
38 .PHONY: cleancrunchgen
39
40 cleancrunchgen:
41 if [ -f ${CRUNCHBIN}.mk ]; then \
42 ${MAKE} -f ${CRUNCHBIN}.mk clean; \
43 fi
44 rm -f ${CRUNCHBIN}.mk
45