NetBSD/distrib/common/Makefile.crunch

45 lines
1.2 KiB
Makefile

# $NetBSD: Makefile.crunch,v 1.7 2002/04/12 01:59:45 lukem Exp $
#
# Makefile snippet to build a crunchgen(1)ed binary from the provided lists
#
#
# Required variables:
# _SRC_TOP_ top level of src tree (set by <bsd.own.mk>)
# CRUNCHBIN name of crunchgen(1)ed binary
# LISTS list file(s) to use
#
# Optional variables:
# CRUNCHGEN_FLAGS extra options to crunchgen(1)
# DESTDIR destination directory
# PARSELISTENV environment variables to set for parselist.awk
#
.include "${DISTRIBDIR}/common/Makefile.parselist"
${CRUNCHBIN}: ${CRUNCHBIN}.mk ${CRUNCHBIN}.cache ${CRUNCHBIN}.c
env SMALLPROG=1 ${MAKE} -f ${CRUNCHBIN}.mk all
${CRUNCHBIN}.mk ${CRUNCHBIN}.cache ${CRUNCHBIN}.c: ${CRUNCHBIN}.conf
env SMALLPROG=1 \
${CRUNCHGEN} -f -D ${_SRC_TOP_} -L ${DESTDIR}/usr/lib \
${CRUNCHGEN_FLAGS} ${.ALLSRC}
${CRUNCHBIN}.conf: ${LISTS} ${PARSELISTDEP}
-rm -f ${.TARGET} ${.TARGET}.tmp
${PARSELIST} -v mode=crunch ${LISTS} > ${.TARGET}.tmp \
&& mv ${.TARGET}.tmp ${.TARGET}
CLEANFILES+= ${CRUNCHBIN} ${CRUNCHBIN}.conf ${CRUNCHBIN}.conf.tmp \
${CRUNCHBIN}.cache *.o *.cro *.c
clean cleandir distclean: cleancrunchgen
.PHONY: cleancrunchgen
cleancrunchgen:
if [ -f ${CRUNCHBIN}.mk ]; then \
${MAKE} -f ${CRUNCHBIN}.mk clean; \
fi
rm -f ${CRUNCHBIN}.mk