Drop main() prototype. Syncs with NetBSD-8
[minix.git] / distrib / common / Makefile.crunch
blob85c22446e34e7ad42417f9ec17e6726497a5e6a0
1 #       $NetBSD: Makefile.crunch,v 1.25 2014/02/01 21:05:54 matt Exp $
3 # Makefile snippet to build a crunchgen(1)ed binary from the provided lists
5 # Required variables:
6 #       NETBSDSRCDIR    top level of src tree (set by <bsd.own.mk>)
7 #       CRUNCHBIN       name of crunchgen(1)ed binary
8 #       LISTS           list file(s) to use
10 # Optional variables:
11 #       SMALLPROG       if != 0, add SMALLPROG=1 to CRUNCHENV.  [default: 1]
12 #       SMALLPROG_INET6 if != 0 and SMALLPROG != 0, and ${USE_INET6} != "no",
13 #                       add SMALLPROG_INET6=1 to CRUNCHENV.  [default: 0]
14 #       CRUNCHENV       environment to pass to crunchgen(1) and when building
15 #                       the crunched program with make(1) (as command line
16 #                       variables, to override any user provided environment
17 #                       or make(1) cmdline vars).
18 #       CRUNCHGEN_FLAGS extra options to crunchgen(1)
19 #       DESTDIR         destination directory
20 #       PARSELISTENV    environment variables to set for parselist.awk
22 # Variables modified by this:
23 #       CRUNCHENV       may get SMALLPROG=1 or SMALLPROG_INET6=1 added
26 .if !defined(_MAKEFILE_CRUNCH_)
27 _MAKEFILE_CRUNCH_=1
29 CRUNCHENV+=             AWK=${TOOL_AWK:Q}
31 SMALLPROG?=             1
32 SMALLPROG_INET6?=       0
33 .if ${SMALLPROG}                                # {
34 CRUNCHENV+=             SMALLPROG=1
35 .if ${SMALLPROG_INET6} && (${USE_INET6} != "no")
36 CRUNCHENV+=             SMALLPROG_INET6=1
37 .endif
38 .endif                                          # }
40 .include "${DISTRIBDIR}/common/Makefile.parselist"
42 .PHONY: ${CRUNCHBIN}
43 ${CRUNCHBIN}: ${CRUNCHBIN}.mk ${CRUNCHBIN}.cache ${CRUNCHBIN}.c
44         ${MAKE} ${CRUNCHENV} -f ${CRUNCHBIN}.mk ${CRUNCHBIN}.crunched
46 ${CRUNCHBIN}.c: ${CRUNCHBIN}.mk
47         [ ! -f ${.TARGET} ] || touch ${.TARGET}
49 ${CRUNCHBIN}.cache: ${CRUNCHBIN}.mk
50         [ ! -f ${.TARGET} ] || touch ${.TARGET}
52 CRUNCHGEN != command -v ${TOOL_CRUNCHGEN:[-1]} || echo
54 ${CRUNCHBIN}.mk: ${CRUNCHBIN}.conf  ${CRUNCHGEN}
55         ${CRUNCHENV} ${TOOL_CRUNCHGEN} -f -D ${NETBSDSRCDIR} -d ${DBG:Q} \
56             -L ${DESTDIR}/usr/lib -q ${CRUNCHGEN_FLAGS} ${CRUNCHBIN}.conf
58 ${CRUNCHBIN}.conf: ${LISTS} ${PARSELISTDEP}
59         -rm -f ${.TARGET} ${.TARGET}.tmp
60         ${PARSELIST} -v mode=crunch ${LISTS} > ${.TARGET}.tmp \
61         && mv ${.TARGET}.tmp ${.TARGET}
63 CLEANFILES+=    ${CRUNCHBIN} ${CRUNCHBIN}.conf ${CRUNCHBIN}.conf.tmp \
64                 ${CRUNCHBIN}.cache *.o *.cro *.c
66 clean cleandir distclean: cleancrunchgen
68 .PHONY: cleancrunchgen
70 cleancrunchgen:
71         if [ -f ${CRUNCHBIN}.mk ]; then \
72                 ${MAKE} -f ${CRUNCHBIN}.mk clean; \
73         fi
74         rm -f ${CRUNCHBIN}.mk
77 .endif  # _MAKEFILE_CRUNCH_