Makefile revision 204490
1# $FreeBSD: head/gnu/usr.bin/dtc/Makefile 204490 2010-02-28 22:09:09Z raj $
2
3.include <bsd.own.mk>
4
5DTCDIR=	${.CURDIR}/../../../contrib/dtc
6LIBFDTDIR= ${.CURDIR}/../../../sys/contrib/libfdt
7.PATH: ${DTCDIR} ${LIBFDTDIR} ${DTCDIR}/tests
8
9PROG=	dtc
10
11SRCS=	dtc.c checks.c fstree.c livetree.c treesource.c data.c \
12	flattree.c srcpos.c util.c \
13	fdt.c fdt_ro.c fdt_rw.c fdt_strerror.c \
14	fdt_sw.c fdt_wip.c $(DTCDIR)/version_gen.h
15
16CFLAGS = -Wall -g -Os -fPIC -Wpointer-arith -Wcast-qual
17CFLAGS+= -I. -I${.CURDIR} -I${DTCDIR} -I${LIBFDTDIR}
18
19VERSIONMAJ!= awk '/^VERSION =/ { print $$3 }' $(DTCDIR)/Makefile
20VERSIONMIN!= awk '/^PATCHLEVEL =/ { print $$3 }' $(DTCDIR)/Makefile
21VERSIONSUB!= awk '/^SUBLEVEL =/ { print $$3 }' $(DTCDIR)/Makefile
22VERSIONEXTRA!= $(DTCDIR)/scripts/setlocalversion
23
24DTCVERSION:=	${VERSIONMAJ}.${VERSIONMIN}.${VERSIONSUB}${VERSIONEXTRA}
25DTCVERSIONFILE:=	$(DTCDIR)/version_gen.h
26
27MAN=
28
29BISON=	yacc
30LEX=	lex
31
32OBJS+= dtc-parser.tab.o dtc-lexer.lex.o
33
34CLEANFILES+= dtc-parser.tab.o dtc-lexer.lex.o dtc-parser.tab.c \
35		dtc-parser.tab.h dtc-lexer.lex.c ${DTCVERSIONFILE}
36
37$(DTCVERSIONFILE):
38	@echo '#define DTC_VERSION "DTC ${DTCVERSION}"' > ${DTCVERSIONFILE}
39
40dtc-parser.tab.o:	dtc-parser.tab.c dtc-parser.tab.h
41dtc-lexer.lex.o:	dtc-lexer.lex.c dtc-parser.tab.h
42
43dtc-parser.tab.c:	dtc-parser.y
44	$(BISON) -o$@ -d $(DTCDIR)/dtc-parser.y
45
46dtc-parser.tab.h:	dtc-parser.tab.c
47
48dtc-lexer.lex.c: dtc-lexer.l
49	$(LEX) -o$@ $(DTCDIR)/dtc-lexer.l
50
51.include <bsd.prog.mk>
52