Home | History | Annotate | Line # | Download | only in common
Makefile.crunch revision 1.11
      1  1.11  lukem #	$NetBSD: Makefile.crunch,v 1.11 2002/10/17 02:05:36 lukem Exp $
      2   1.1  lukem #
      3   1.1  lukem # Makefile snippet to build a crunchgen(1)ed binary from the provided lists
      4   1.1  lukem #
      5   1.1  lukem 
      6   1.1  lukem #
      7   1.1  lukem # Required variables:
      8   1.8  lukem #	NETBSDSRCDIR	top level of src tree (set by <bsd.own.mk>)
      9   1.1  lukem #	CRUNCHBIN	name of crunchgen(1)ed binary
     10   1.1  lukem #	LISTS		list file(s) to use
     11   1.1  lukem #
     12   1.4  lukem # Optional variables:
     13  1.11  lukem #	SMALLPROG	if != 0, add SMALLPROG=1 to CRUNCHENV.  [default: 1]
     14  1.11  lukem #	SMALLPROG_INET6	if != 0 and SMALLPROG != 0, add SMALLPROG_INET6=1
     15  1.11  lukem #			to CRUNCHENV.  [default: 0]
     16   1.9  lukem #	CRUNCHENV	environment to pass to crunchgen(1) and when building
     17  1.11  lukem #			the crunched program.
     18   1.6  lukem #	CRUNCHGEN_FLAGS	extra options to crunchgen(1)
     19   1.4  lukem #	DESTDIR		destination directory
     20   1.4  lukem #	PARSELISTENV	environment variables to set for parselist.awk
     21   1.4  lukem #
     22   1.9  lukem # Variables modified by this:
     23  1.11  lukem #	CRUNCHENV	may get SMALLPROG=1 or SMALLPROG_INET6=1 added
     24  1.11  lukem #
     25   1.9  lukem 
     26  1.11  lukem SMALLPROG?=		1
     27  1.11  lukem SMALLPROG_INET6?=	0
     28  1.11  lukem .if ${SMALLPROG}				# {
     29  1.11  lukem CRUNCHENV+=		SMALLPROG=1
     30  1.11  lukem .if ${SMALLPROG_INET6}
     31  1.11  lukem CRUNCHENV+=		SMALLPROG_INET6=1
     32  1.11  lukem .endif
     33  1.11  lukem .endif						# }
     34   1.4  lukem 
     35   1.7  lukem .include "${DISTRIBDIR}/common/Makefile.parselist"
     36   1.1  lukem 
     37   1.1  lukem ${CRUNCHBIN}: ${CRUNCHBIN}.mk ${CRUNCHBIN}.cache ${CRUNCHBIN}.c
     38  1.10  lukem 	${CRUNCHENV} ${MAKE} -j 1 -f ${CRUNCHBIN}.mk all
     39   1.1  lukem 
     40   1.1  lukem ${CRUNCHBIN}.mk ${CRUNCHBIN}.cache ${CRUNCHBIN}.c: ${CRUNCHBIN}.conf
     41   1.9  lukem 	${CRUNCHENV} ${CRUNCHGEN} -f -D ${NETBSDSRCDIR} -L ${DESTDIR}/usr/lib \
     42  1.10  lukem 	    -q ${CRUNCHGEN_FLAGS} ${.ALLSRC}
     43   1.1  lukem 
     44   1.7  lukem ${CRUNCHBIN}.conf: ${LISTS} ${PARSELISTDEP}
     45   1.1  lukem 	-rm -f ${.TARGET} ${.TARGET}.tmp
     46   1.7  lukem 	${PARSELIST} -v mode=crunch ${LISTS} > ${.TARGET}.tmp \
     47   1.1  lukem 	&& mv ${.TARGET}.tmp ${.TARGET}
     48   1.1  lukem 
     49   1.2  lukem CLEANFILES+=	${CRUNCHBIN} ${CRUNCHBIN}.conf ${CRUNCHBIN}.conf.tmp \
     50   1.2  lukem 		${CRUNCHBIN}.cache *.o *.cro *.c
     51   1.1  lukem 
     52   1.1  lukem clean cleandir distclean: cleancrunchgen
     53   1.1  lukem 
     54   1.1  lukem .PHONY: cleancrunchgen
     55   1.1  lukem 
     56   1.1  lukem cleancrunchgen:
     57   1.1  lukem 	if [ -f ${CRUNCHBIN}.mk ]; then \
     58  1.10  lukem 		${MAKE} -j 1 -f ${CRUNCHBIN}.mk clean; \
     59   1.1  lukem 	fi
     60   1.2  lukem 	rm -f ${CRUNCHBIN}.mk
     61