-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (40 loc) · 1.14 KB
/
Makefile
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
include config.mk
vpath %.h src/
vpath %.c src/
vpath %.l src/
vpath %.y src/
CFLAGS += -D_POSIX_C_SOURCE=200809L
CPPFLAGS += -I ./
CPPFLAGS += -I src/
LDLIBS += -lm -lrelafix
TREE_WALKER_OBJ = scope_annotator.o symbol_annotator.o type_annotator.o type_validator.o executor.o tree_cleaner.o
PARSER_OBJ = rlang.yy.o rlang.tab.o
OBJ = $(PARSER_OBJ) $(TREE_WALKER_OBJ) main.o ast.o builtins.o memory.o print.o scope.o symbol.o value.o
.PHONY : all clean
.PHONY : test
TARGET = rlang
# disable implicit rules
.SUFFIXES:
all: $(TARGET)
$(TARGET) : $(OBJ)
$(CC) $(CFLAGS) -o $(TARGET) $(LDFLAGS) $^ $(LDLIBS)
clean:
rm -f $(OBJ) $(TARGET)
rm -f *.tab.c *.tab.h
rm -f *.yy.c
main.o : main.c
$(CC) $(CFLAGS) -c $(CPPFLAGS) -o $@ $<
%.yy.o : %.yy.c
$(CC) $(CFLAGS) -c $(CPPFLAGS) -o $@ $<
%.o : %.c %.h
$(CC) $(CFLAGS) -c $(CPPFLAGS) -o $@ $<
$(TREE_WALKER_OBJ) : %.o : %.c
$(CC) $(CFLAGS) -c $(CPPFLAGS) -o $@ $<
ast.h print.h : rlang.tab.h
%.tab.c %.tab.h : %.y
$(YACC) $(YFLAGS) -b $* $<
%.yy.c : %.l %.tab.h
$(LEX) -o $@ $<
# test
test : rlang
LD_LIBRARY_PATH="$$(test/get_ld_library_path $(LDFLAGS))" ./rlang < test/unittests.rlang