Home | History | Annotate | Line # | Download | only in common
Makefile.crunch revision 1.9
      1 #	$NetBSD: Makefile.crunch,v 1.9 2002/05/02 13:16:46 lukem Exp $
      2 #
      3 # Makefile snippet to build a crunchgen(1)ed binary from the provided lists
      4 #
      5 
      6 #
      7 # Required variables:
      8 #	NETBSDSRCDIR	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 #	CRUNCHENV	environment to pass to crunchgen(1) and when building
     14 #			the crunched program.  [default: SMALLPROG=1]
     15 #	CRUNCHGEN_FLAGS	extra options to crunchgen(1)
     16 #	DESTDIR		destination directory
     17 #	PARSELISTENV	environment variables to set for parselist.awk
     18 #
     19 # Variables modified by this:
     20 
     21 CRUNCHENV?=	SMALLPROG=1
     22 
     23 .include "${DISTRIBDIR}/common/Makefile.parselist"
     24 
     25 ${CRUNCHBIN}: ${CRUNCHBIN}.mk ${CRUNCHBIN}.cache ${CRUNCHBIN}.c
     26 	${CRUNCHENV} ${MAKE} -f ${CRUNCHBIN}.mk all
     27 
     28 ${CRUNCHBIN}.mk ${CRUNCHBIN}.cache ${CRUNCHBIN}.c: ${CRUNCHBIN}.conf
     29 	${CRUNCHENV} ${CRUNCHGEN} -f -D ${NETBSDSRCDIR} -L ${DESTDIR}/usr/lib \
     30 	    ${CRUNCHGEN_FLAGS} ${.ALLSRC}
     31 
     32 ${CRUNCHBIN}.conf: ${LISTS} ${PARSELISTDEP}
     33 	-rm -f ${.TARGET} ${.TARGET}.tmp
     34 	${PARSELIST} -v mode=crunch ${LISTS} > ${.TARGET}.tmp \
     35 	&& mv ${.TARGET}.tmp ${.TARGET}
     36 
     37 CLEANFILES+=	${CRUNCHBIN} ${CRUNCHBIN}.conf ${CRUNCHBIN}.conf.tmp \
     38 		${CRUNCHBIN}.cache *.o *.cro *.c
     39 
     40 clean cleandir distclean: cleancrunchgen
     41 
     42 .PHONY: cleancrunchgen
     43 
     44 cleancrunchgen:
     45 	if [ -f ${CRUNCHBIN}.mk ]; then \
     46 		${MAKE} -f ${CRUNCHBIN}.mk clean; \
     47 	fi
     48 	rm -f ${CRUNCHBIN}.mk
     49