aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 280db781d121103b4e4d2f78b06ef9b3a48e5700 (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
TARGETS = dtc ftdump
CFLAGS = -Wall -g

BISON = bison

DTC_OBJS = dtc.o flattree.o fstree.o data.o livetree.o \
		srcpos.o treesource.o \
		dtc-parser.tab.o lex.yy.o

DEPFILES = $(DTC_OBJS:.o=.d)

all: $(TARGETS)

dtc: $(DTC_OBJS)
	$(LINK.c) -o $@ $^

ftdump:	ftdump.o
	$(LINK.c) -o $@ $^

dtc-parser.tab.c dtc-parser.tab.h dtc-parser.output: dtc-parser.y
	$(BISON) -d $<

lex.yy.c: dtc-lexer.l
	$(LEX) $<

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

check: all
	cd tests && $(MAKE) check

clean:
	rm -f *~ *.o a.out core $(TARGETS)
	rm -f *.tab.[ch] lex.yy.c
	rm -f *.i *.output vgcore.*
	rm -f *.d
	cd tests && $(MAKE) clean

%.d: %.c
	$(CC) -MM -MG -MT "$*.o $@" $< > $@

-include $(DEPFILES)