-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmakefile
More file actions
63 lines (47 loc) · 1.44 KB
/
makefile
File metadata and controls
63 lines (47 loc) · 1.44 KB
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
52
53
54
55
56
57
58
59
60
61
# Configuration variables
# IMPORTANT! If you change these, run make clean
DRAWSHIELD = true
LANG = en
CC = cc
CFLAGS = -g -D LANG=$(LANG)
INC = -I/usr/include/libxml2
LIBS = -lxml2
LEX = flex
YACC = bison
YFLAGS = -vd
OBJECTS = blazonML.o blazon.tab.o lex.yy.o errors.o spelling.o canon.o
# By default, use only flex and bison fragments like 00-whatever.l
# i.e. do NOT match 00ds-extension.l
GRAMMAR = grammar/$(LANG)/[0-9][0-9]-*.y
TOKENS = tokens/$(LANG)/[0-9][0-9]-*.l
# If DRAWSHIELD is define use all flex and bison fragments
ifdef DRAWSHIELD
GRAMMAR = grammar/$(LANG)/[0-9][0-9]*.y
TOKENS = tokens/$(LANG)/[0-9][0-9]*.l
endif
.c.o:
$(CC) $(CFLAGS) -c $(INC) -o $@ $<
default: blazon
blazonML.c: blazonML.h
spelling.c: spelling.h
errors.c: errors.h blazonML.h spelling.h
blazon.y: $(GRAMMAR) errors.h blazonML.h grammar/_top.y grammar/_bottom.y
cat grammar/_top.y > blazon.y; \
for i in $(GRAMMAR); do \
tail -n +2 $$i >> blazon.y; \
done; \
cat grammar/_bottom.y >> blazon.y;
blazon.l: $(TOKENS) tokens/_top.l tokens/_bottom.l
cat tokens/_top.l > blazon.l; \
for i in $(TOKENS); do \
tail -n +2 $$i >> blazon.l; \
done; \
cat tokens/_bottom.l >> blazon.l;
lex.yy.c: blazon.l errors.h blazonML.h blazon.tab.h
$(LEX) blazon.l
blazon.tab.c blazon.tab.h: blazon.y
$(YACC) -o blazon.tab.c $(YFLAGS) blazon.y
blazon: $(OBJECTS)
$(CC) $(CFLAGS) $(LNFLAGS) -o blazon $(OBJECTS) $(LIBS)
clean:
/bin/rm -f $(OBJECTS) blazon.l blazon.tab.c