-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
87 lines (69 loc) · 1.73 KB
/
Makefile
File metadata and controls
87 lines (69 loc) · 1.73 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
CC = clang
CCPP = clang++
CFLAGS = -c -g -Wall
SRCDIR = src
INCL = -Iinclude
LLVM = $(shell llvm-config 2> /dev/null; echo $$?)
ifeq ($(LLVM), 127)
MAIN = llvm-not-found cfl-core-c
else
MAIN = cfl-core
endif
LLVMFLAGS = $(shell llvm-config --cxxflags)
LLVMLDFLAGS = $(shell llvm-config --ldflags)
LLVMLIBS = $(shell llvm-config --libs core)
SYSTEMLIBS = $(shell llvm-config --system-libs 2> /dev/null; echo $$?)
ifeq ($(SYSTEM_LIBS), 0)
LLVMLIBS += $(shell llvm-config --system-libs)
endif
LIBS = $(LLVMLIBS)
FLAGS = $(INCL) $(LLVMFLAGS)
ARCH = $(shell getconf LONG_BIT)
ifeq ($(ARCH), 32)
FLAGS += -DARCH_32
else
FLAGS += -DARCH_64
endif
LDFLAGS = $(LLVMLDFLAGS) $(LIBS)
CFILES = \
cfl_ast.o \
cfl_ast.error.o \
cfl_program.o \
cfl_typed_program.o \
cfl_parser.o \
cfl_parser.error.o \
cfl_parser.token.o \
cfl_parser.basic.o \
cfl_parser.operator.o \
cfl_parser.derived.o \
cfl_type.o \
cfl_type.error.o \
cfl_type.equation.o \
cfl_type.hypothesis.o \
cfl_type.generate.o \
cfl_type.program.o \
cfl_type.typed_program.o \
cfl_eval.o
cfl: $(MAIN)
all: libcfl.a cfl-core-c cfl-core
libcfl.a: $(CFILES)
ar cr libcfl.a $(CFILES)
llvm-not-found:
@echo NOTE: LLVM not found.
@echo Building eval-only C version...
cfl-core-c: cfl_main.o libcfl.a
$(CC) -o cfl-core-c $< -L. -lcfl
CPPFILES = \
cfl_compiler.opp \
cfl_compiler.types.opp \
cfl_compiler.heap.opp \
cfl_compiler.library.opp \
cfl_compiler.print.opp
cfl-core: cfl_main.opp $(CPPFILES) libcfl.a
$(CCPP) -o cfl-core $< $(CPPFILES) -L. -lcfl $(LDFLAGS)
clean:
rm -f *.o *.opp
%.o: $(SRCDIR)/%.c
$(CC) $(CFLAGS) $^ $(INCL)
%.opp: $(SRCDIR)/%.cpp
$(CCPP) $(CFLAGS) -o $*.opp $^ $(FLAGS)