2005-11-11 00:29:37 +03:00
|
|
|
# $NetBSD: Makefile.crunch,v 1.23 2005/11/10 21:29:37 dsl Exp $
|
2002-02-03 18:24:43 +03:00
|
|
|
#
|
|
|
|
# Makefile snippet to build a crunchgen(1)ed binary from the provided lists
|
|
|
|
#
|
|
|
|
# Required variables:
|
2002-04-26 19:50:21 +04:00
|
|
|
# NETBSDSRCDIR top level of src tree (set by <bsd.own.mk>)
|
2002-02-03 18:24:43 +03:00
|
|
|
# CRUNCHBIN name of crunchgen(1)ed binary
|
|
|
|
# LISTS list file(s) to use
|
|
|
|
#
|
2002-03-15 01:26:08 +03:00
|
|
|
# Optional variables:
|
2002-10-17 06:05:35 +04:00
|
|
|
# SMALLPROG if != 0, add SMALLPROG=1 to CRUNCHENV. [default: 1]
|
2005-01-18 15:30:21 +03:00
|
|
|
# SMALLPROG_INET6 if != 0 and SMALLPROG != 0, and ${USE_INET6} != "no",
|
|
|
|
# add SMALLPROG_INET6=1 to CRUNCHENV. [default: 0]
|
2002-05-02 17:16:46 +04:00
|
|
|
# CRUNCHENV environment to pass to crunchgen(1) and when building
|
2005-01-19 04:18:59 +03:00
|
|
|
# the crunched program with make(1) (as command line
|
|
|
|
# variables, to override any user provided environment
|
|
|
|
# or make(1) cmdline vars).
|
2002-04-02 09:36:23 +04:00
|
|
|
# CRUNCHGEN_FLAGS extra options to crunchgen(1)
|
2002-03-15 01:26:08 +03:00
|
|
|
# DESTDIR destination directory
|
|
|
|
# PARSELISTENV environment variables to set for parselist.awk
|
|
|
|
#
|
2002-05-02 17:16:46 +04:00
|
|
|
# Variables modified by this:
|
2002-10-17 06:05:35 +04:00
|
|
|
# CRUNCHENV may get SMALLPROG=1 or SMALLPROG_INET6=1 added
|
|
|
|
#
|
2002-05-02 17:16:46 +04:00
|
|
|
|
2003-03-11 10:18:38 +03:00
|
|
|
.if !defined(_MAKEFILE_CRUNCH_)
|
|
|
|
_MAKEFILE_CRUNCH_=1
|
|
|
|
|
|
|
|
|
2002-10-17 06:05:35 +04:00
|
|
|
SMALLPROG?= 1
|
|
|
|
SMALLPROG_INET6?= 0
|
|
|
|
.if ${SMALLPROG} # {
|
|
|
|
CRUNCHENV+= SMALLPROG=1
|
2005-01-18 15:30:21 +03:00
|
|
|
.if ${SMALLPROG_INET6} && (${USE_INET6} != "no")
|
2002-10-17 06:05:35 +04:00
|
|
|
CRUNCHENV+= SMALLPROG_INET6=1
|
|
|
|
.endif
|
|
|
|
.endif # }
|
2002-03-15 01:26:08 +03:00
|
|
|
|
2002-04-12 05:59:45 +04:00
|
|
|
.include "${DISTRIBDIR}/common/Makefile.parselist"
|
2002-02-03 18:24:43 +03:00
|
|
|
|
2003-05-09 16:20:04 +04:00
|
|
|
.PHONY: ${CRUNCHBIN}
|
2002-02-03 18:24:43 +03:00
|
|
|
${CRUNCHBIN}: ${CRUNCHBIN}.mk ${CRUNCHBIN}.cache ${CRUNCHBIN}.c
|
2005-01-19 04:18:59 +03:00
|
|
|
${MAKE} ${CRUNCHENV} -f ${CRUNCHBIN}.mk ${CRUNCHBIN}.crunched
|
2002-02-03 18:24:43 +03:00
|
|
|
|
2003-05-15 21:52:32 +04:00
|
|
|
${CRUNCHBIN}.c: ${CRUNCHBIN}.mk
|
|
|
|
[ ! -f ${.TARGET} ] || touch ${.TARGET}
|
|
|
|
|
|
|
|
${CRUNCHBIN}.cache: ${CRUNCHBIN}.mk
|
|
|
|
[ ! -f ${.TARGET} ] || touch ${.TARGET}
|
|
|
|
|
2005-11-11 00:29:37 +03:00
|
|
|
CRUNCHGEN != command -v ${TOOL_CRUNCHGEN:[-1]} || echo
|
2005-11-08 01:19:34 +03:00
|
|
|
|
|
|
|
${CRUNCHBIN}.mk: ${CRUNCHBIN}.conf ${CRUNCHGEN}
|
2003-07-10 14:33:58 +04:00
|
|
|
${CRUNCHENV} ${TOOL_CRUNCHGEN} -f -D ${NETBSDSRCDIR} \
|
2005-09-06 00:14:08 +04:00
|
|
|
-L ${DESTDIR}/usr/lib -q ${CRUNCHGEN_FLAGS} ${CRUNCHBIN}.conf
|
2002-02-03 18:24:43 +03:00
|
|
|
|
2002-04-12 05:59:45 +04:00
|
|
|
${CRUNCHBIN}.conf: ${LISTS} ${PARSELISTDEP}
|
2002-02-03 18:24:43 +03:00
|
|
|
-rm -f ${.TARGET} ${.TARGET}.tmp
|
2002-04-12 05:59:45 +04:00
|
|
|
${PARSELIST} -v mode=crunch ${LISTS} > ${.TARGET}.tmp \
|
2002-02-03 18:24:43 +03:00
|
|
|
&& mv ${.TARGET}.tmp ${.TARGET}
|
|
|
|
|
2002-02-06 02:16:16 +03:00
|
|
|
CLEANFILES+= ${CRUNCHBIN} ${CRUNCHBIN}.conf ${CRUNCHBIN}.conf.tmp \
|
|
|
|
${CRUNCHBIN}.cache *.o *.cro *.c
|
2002-02-03 18:24:43 +03:00
|
|
|
|
|
|
|
clean cleandir distclean: cleancrunchgen
|
|
|
|
|
|
|
|
.PHONY: cleancrunchgen
|
|
|
|
|
|
|
|
cleancrunchgen:
|
|
|
|
if [ -f ${CRUNCHBIN}.mk ]; then \
|
2003-05-18 15:25:33 +04:00
|
|
|
${MAKE} -f ${CRUNCHBIN}.mk clean; \
|
2002-02-03 18:24:43 +03:00
|
|
|
fi
|
2002-02-06 02:16:16 +03:00
|
|
|
rm -f ${CRUNCHBIN}.mk
|
2003-03-11 10:18:38 +03:00
|
|
|
|
|
|
|
|
|
|
|
.endif # _MAKEFILE_CRUNCH_
|