diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8410a24 --- /dev/null +++ b/Makefile | |||
@@ -0,0 +1,32 @@ | |||
1 | CC = gcc | ||
2 | FLEX = flex | ||
3 | BISON = bison | ||
4 | |||
5 | CFILES = $(shell find . -name "*.c") | ||
6 | OBJS = $(CFILES:.c=.o) | ||
7 | LFILE = $(wildcard *.l) | ||
8 | YFILE = $(wildcard *.y) | ||
9 | LFC = ./lex.yy.c | ||
10 | YFC = ./syntax.tab.c | ||
11 | LFO = $(LFC:.c=.o) | ||
12 | YFO = $(YFC:.c=.o) | ||
13 | |||
14 | bcsh: syntax $(filter-out $(LFO),$(OBJS)) | ||
15 | $(CC) -g -o bcsh $(filter-out $(LFO),$(OBJS)) -lfl | ||
16 | |||
17 | syntax: lexical syntax-c | ||
18 | $(CC) -c $(YFC) -o $(YFO) | ||
19 | |||
20 | lexical: $(LFILE) | ||
21 | $(FLEX) -o $(LFC) $(LFILE) | ||
22 | |||
23 | syntax-c: $(YFILE) | ||
24 | $(BISON) -o $(YFC) -d -v $(YFILE) -Wcounterexamples | ||
25 | |||
26 | -include $(patsubst %.o, %.d, $(OBJS)) | ||
27 | |||
28 | clean: | ||
29 | rm -f bcsh lex.yy.c syntax.tab.c syntax.tab.h syntax.output | ||
30 | rm -f $(OBJS) $(OBJS:.o=.d) | ||
31 | rm -f $(LFC) $(YFC) $(YFC:.c=.h) | ||
32 | rm -f *~ \ No newline at end of file | ||