-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (47 loc) · 2.18 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
CLA=clang++
CXX=g++
CXXFLAGS=-std=c++11 -Ofast -DFINAL_CHECK -DSPECIAL_HP -fpermissive
DEPS=src/beam_cky_parser.cc src/beam_cky_parser.h src/backtrace_iter.cc src/Utils/reader.h src/Utils/network.h src/Utils/codon.h src/Utils/utility_v.h src/Utils/common.h src/Utils/base.h
BIN=bin/LinearDesign_2D
UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)
lineardesign_2D: $(DEPS)
@echo "Compiling" $@ "from" $< "..."
chmod +x lineardesign
mkdir -p ./bin
export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
ifeq ($(UNAME_S), Linux)
if $(CXX) $(CXXFLAGS) src/linear_design.cpp -o bin/LinearDesign_2D_debug src/Utils/libraries/LinearDesign_linux64.so; then \
echo "Linux system; compiled with g++; finished."; \
echo "Compilation Succeed!"; \
else \
echo "Try another .so file."; \
if $(CXX) $(CXXFLAGS) src/linear_design.cpp -o bin/LinearDesign_2D src/Utils/libraries/LinearDesign_linux64_old.so; then \
echo "Linux system; compiled with g++; finished."; \
echo "Compilation Succeed!"; \
else \
echo "Compilation failed! Make sure it is either Linux-64 or Mac."; \
fi \
fi
else
if [[ $(UNAME_M) == 'arm64' ]]; then \
if $(CLA) $(CXXFLAGS) src/linear_design.cpp -o bin/LinearDesign_2D src/Utils/libraries/LinearDesign_Mac_M1.so; then \
echo "Mac M1 system; compiled with clang++; finished."; \
echo "Compilation Succeed!"; \
echo "You may encounter a pop-up message at the first run. If so, please go to System Preferences -> Security & Privacy -> General to allow LinearDesign_Mac_M1.so to open. See README.md for details."; \
else \
echo "Compilation failed! Make sure it is either Linux-64 or Mac."; \
fi \
else \
if $(CLA) $(CXXFLAGS) src/linear_design.cpp -o bin/LinearDesign_2D src/Utils/libraries/LinearDesign_Mac_x86.so; then \
echo "Mac x86_64 system; compiled with clang++; finished."; \
echo "Compilation Succeed!"; \
echo "You may encounter a pop-up message at the first run. If so, please go to System Preferences -> Security & Privacy -> General to allow LinearDesign_Mac_x86.so to open. See README.md for details."; \
else \
echo "Compilation failed! Make sure it is either Linux-64 or Mac."; \
fi \
fi
endif
.PHONY : clean
# clean:
# rm -f $(BIN)