-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
71 lines (53 loc) · 1.7 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
Sources=main.cpp ncvis.cpp knntable.cpp
Executable=ncvis
CFlags=-c -Wall -std=c++14 -fopenmp -fPIC -O3 -ffast-math -I $(CONDA_PREFIX)/include
DebugCFlags=-c -Wall -std=c++14 -fopenmp -fPIC -O3 -g3 -DDEBUG -ffast-math -I $(CONDA_PREFIX)/include
# For Linux:
# LDFlags=-lm -lgomp
# DebugLDFlags=-lm -lgomp
# CC=g++
# For Mac:
# Don't forget to run for proper dynamic linking:
# $ export DYLD_LIBRARY_PATH=$CONDA_PREFIX/lib:$DYLD_LIBRARY_PATH
LDFlags=-lm -fopenmp=libiomp5
DebugLDFlags=-lm -fopenmp=libiomp5
CC=clang++
ObjectDir=obj/
SourceDir=src/
BinDir=bin/
LibDir=lib/
Objects=$(Sources:.cpp=.o)
CSources=$(addprefix $(SourceDir),$(Sources))
CObjects=$(addprefix $(ObjectDir),$(Objects))
CExecutable=$(addprefix $(BinDir),$(Executable))
all: $(CExecutable)
DebugObjects=$(Sources:.cpp=_debug.o)
DebugCObjects=$(addprefix $(ObjectDir),$(DebugObjects))
DebugCExecutable=$(addprefix $(BinDir),$(Executable)_debug)
debug: $(DebugCExecutable)
$(DebugCExecutable): $(DebugCObjects) .bin_dir
$(CC) $(DebugLDFlags) $(DebugCObjects) -o $@
$(ObjectDir)%_debug.o: $(SourceDir)%.cpp .object_dir .lib_dir
$(CC) $(DebugCFlags) $< -o $@
$(Executable): $(CExecutable)
$(CExecutable): $(CObjects) .bin_dir
$(CC) $(LDFlags) $(CObjects) -o $@
$(ObjectDir)%.o: $(SourceDir)%.cpp .object_dir .lib_dir
$(CC) $(CFlags) $< -o $@
.object_dir:
mkdir -p $(ObjectDir)
touch .object_dir
.bin_dir:
mkdir -p $(BinDir)
touch .bin_dir
.lib_dir:
mkdir -p $(LibDir)
touch .lib_dir
.PHONY: wrapper clean libs
clean:
rm -rf $(ObjectDir) $(BinDir) build wrapper/*.cpp ncvis.egg-info build .object_dir .bin_dir *.so
wrapper: libs $(CSources)
pip install -e . --user || pip install -e .
libs: .lib_dir
git submodule init
git submodule update