summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/dtc/Makefile
blob: cdbbf4bba211936eafc3efcd60ccd02f885f62c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# $FreeBSD$

.include <bsd.own.mk>

DTCDIR=	${.CURDIR}/../../../contrib/dtc
_LIBFDTDIR= ${.CURDIR}/../../../sys/contrib/libfdt
.PATH: ${DTCDIR} ${_LIBFDTDIR}

PROG=	dtc

SRCS=	dtc.c checks.c fstree.c livetree.c treesource.c data.c \
	flattree.c srcpos.c util.c \
	fdt.c fdt_ro.c fdt_rw.c fdt_strerror.c \
	fdt_sw.c fdt_wip.c ${DTCVERSIONFILE}

WARNS?=	2
CFLAGS+= -I. -I${.CURDIR} -I${DTCDIR} -I${_LIBFDTDIR}

VERSIONMAJ!= awk '/^VERSION =/ { print $$3 }' ${DTCDIR}/Makefile
VERSIONMIN!= awk '/^PATCHLEVEL =/ { print $$3 }' ${DTCDIR}/Makefile
VERSIONSUB!= awk '/^SUBLEVEL =/ { print $$3 }' ${DTCDIR}/Makefile
VERSIONEXTRA=

DTCVERSION:=	${VERSIONMAJ}.${VERSIONMIN}.${VERSIONSUB}${VERSIONEXTRA}
DTCVERSIONFILE:=	version_gen.h

MAN=

BISON=	yacc
LEX=	lex

OBJS+= dtc-parser.tab.o dtc-lexer.lex.o

CLEANFILES+= dtc-parser.tab.o dtc-lexer.lex.o dtc-parser.tab.c \
		dtc-parser.tab.h dtc-lexer.lex.c ${DTCVERSIONFILE}

${DTCVERSIONFILE}:
	@echo '#define DTC_VERSION "DTC ${DTCVERSION}"' > ${DTCVERSIONFILE}

dtc-parser.tab.o:	dtc-parser.tab.c dtc-parser.tab.h
dtc-lexer.lex.o:	dtc-lexer.lex.c dtc-parser.tab.h

dtc-parser.tab.c:	dtc-parser.y
	${BISON} -o$@ -d ${DTCDIR}/dtc-parser.y

dtc-parser.tab.h:	dtc-parser.tab.c

dtc-lexer.lex.c: dtc-lexer.l
	${LEX} -o$@ ${DTCDIR}/dtc-lexer.l

.include <bsd.prog.mk>
OpenPOWER on IntegriCloud