-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathMakefile_MacOS
63 lines (46 loc) · 1.68 KB
/
Makefile_MacOS
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
LLVM_BASE := $(shell brew --prefix llvm)
BOOST_BASE := $(shell brew --prefix boost)
CPU_BRAND := $(shell sysctl -n machdep.cpu.brand_string)
ifneq (,$(findstring Apple,$(CPU_BRAND)))
CPU_FLAGS := -mcpu=apple-m1
else
CPU_FLAGS := -march=native
endif
COMPILER = $(LLVM_BASE)/bin/clang++
CFLAGS = -g -MMD -MP -std=c++11 \
-O3 $(CPU_FLAGS) -pipe \
-mllvm -polly \
-mllvm -polly-parallel \
-mllvm -polly-vectorizer=stripmine \
-mllvm -polly-position=early \
-mllvm -polly-dump-before-file=before-polly.ll \
-fopenmp -I$(BOOST_BASE)/include -I./
WFLAGS = -pedantic -Wignored-qualifiers -Wreturn-type -Wunused-variable -Wno-c11-extensions
OPTGTK =
LIBS = -L$(LLVM_BASE)/lib -L$(BOOST_BASE)/lib -lboost_system -L./ -Wl,-rpath,./ -lai
SRCDIR = .
SHARE_DIR = share
SHARE_SOURCES = $(wildcard ./$(SHARE_DIR)/*.cpp)
SOURCES = $(wildcard *.cpp)
OBJDIR = ./obj
SHARE_OBJDIR = ./$(SHARE_DIR)/obj
OBJECTS = $(addprefix $(OBJDIR)/, $(notdir $(SOURCES:.cpp=.o)))
SHARE_OBJECTS = $(addprefix $(SHARE_OBJDIR)/, $(notdir $(SHARE_SOURCES:.cpp=.o)))
DEPENDS = $(OBJECTS:.o=.d)
SHARE_DEPENDS = $(SHARE_OBJECTS:.o=.d)
HEADERS = $(SOURCES:.cpp=.hpp)
SHARE_HEADERS = $(SHARE_SOURCES:.cpp=.hpp)
TARGET = system.exe
$(TARGET): $(OBJECTS) $(SHARE_OBJECTS)
$(COMPILER) $(OBJECTS) $(SHARE_OBJECTS) $(CFLAGS) $(WFLAGS) $(LIBS) -o $@
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp $(SRCDIR)/%.hpp
$(COMPILER) $< -c $(CFLAGS) $(WFLAGS) $(OPTGTK) -o $@
$(SHARE_OBJDIR)/%.o: $(SHARE_DIR)/%.cpp $(SHARE_DIR)/%.hpp
$(COMPILER) $< -c $(CFLAGS) $(WFLAGS) -o $@
test:
echo $(SHARE_OBJECTS)
test1:
echo $(SHARE_DEPENDS)
clean:
-rm -f $(OBJECTS) $(SHARE_OBJECTS) $(DEPENDS) $(SHARE_DEPENDS) $(TARGET)
-include $(DEPENDS) $(SHARE_DEPENDS)