This repository has been archived by the owner on Feb 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
85 lines (68 loc) · 1.85 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
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
CXX := clang++
AR := ar
LLVMCOMPONENTS := bitreader mcparser transformutils option
RTTIFLAG := -fno-rtti
RUNDIRFLAG := -Wl,-R,'$$ORIGIN/../lib'
LLVMCONFIG := llvm-config
BIN = bin
LIB = lib
SRC = src
TEST = test
LIBSOURCES = $(SRC)/Analyse.cpp \
$(SRC)/Array.cpp \
$(SRC)/ArrayElement.cpp \
$(SRC)/ArrayTimestamp.cpp \
$(SRC)/DeclInfo.cpp \
$(SRC)/FunctionPattern.cpp \
$(SRC)/KernelASTVisitor.cpp \
$(SRC)/KernelBuiltinFunctions.cpp \
$(SRC)/KernelFunction.cpp \
$(SRC)/KernelInfo.cpp \
$(SRC)/Operation.cpp \
$(SRC)/Warnings.cpp
TESTSOURCES = $(TEST)/ArrayTest.cpp \
$(TEST)/DeAndIncrementTest.cpp \
$(TEST)/Debug.cpp \
$(TEST)/DependenceTest.cpp \
$(TEST)/MathTest.cpp \
$(TEST)/Test.cpp \
$(TEST)/main.cpp
OMPATEST = $(BIN)/ompa-test
OMPALIB = $(LIB)/libompa.a
LIBOBJECTS = $(LIBSOURCES:.cpp=.o)
TESTOBJECTS = $(TESTSOURCES:.cpp=.o)
CLANGLIBS = -lclang \
-lclangFrontend \
-lclangDriver \
-lclangParse \
-lclangSema \
-lclangSerialization \
-lclangAST \
-lclangAnalysis \
-lclangBasic \
-lclangEdit \
-lclangLex
CXXFLAGS := $(shell $(LLVMCONFIG) --cxxflags) $(RTTIFLAG) -I$(shell pwd)
LLVMLDFLAGS := $(shell $(LLVMCONFIG) --ldflags --libs $(LLVMCOMPONENTS))
LIBS = $(CLANGLIBS) $(LLVMLDFLAGS)
DEPENDFILE = .depends
-include $(DEPENDFILE)
all: lib
lib: $(LIBOBJECTS) $(OMPALIB)
dep: $(SOURCES)
$(CXX) -MM $(SOURCES) > $(DEPENDFILE)
%: %.o
$(CXX) -o $@ $< $(LIBS)
$(OMPALIB): $(LIBOBJECTS)
@mkdir -p $(LIB)
$(AR) -o -rs $(OMPALIB) $(LIBOBJECTS)
check: CXXFLAGS += -DDEBUG
check: lib $(TESTOBJECTS) $(OMPALIB)
@mkdir -p $(BIN)
$(CXX) -o $(OMPATEST) $(TESTOBJECTS) $(RUNDIRFLAG) $(OMPALIB) $(LIBS)
$(BIN)/ompa-test
release: clean lib
clean:
@rm -rf $(OMPATEST) $(OMPALIB) $(LIBOBJECTS) $(TESTOBJECTS) $(DEPENDFILE)
@rm -df $(BIN) $(LIB)
.PHONY: check clean release