-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
98 lines (92 loc) · 2.69 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
86
87
88
89
90
91
92
93
94
95
96
97
98
BREWINST=.brew_packages_installed_
ifneq ($(MAKECMDGOALS),quartic)
ifeq ("$(wildcard $(BREWINST))","")
ifeq ($(shell command -v brew 2> /dev/null),)
$(error Please install homebrew first!)
endif
# check if homebrew is installed
HBPACK=$(shell brew ls --versions gmp gcc boost)
ifeq ($(shell echo $(HBPACK)),)
$(warning Please install gmp, boost and gcc homebrew packages through the command:)
$(warning > brew install gmp boost gcc)
$(error Aborting...)
endif
ifeq ($(shell echo $(HBPACK)|grep gmp),)
$(warning Please install gmp homebrew packages through the command:)
$(warning > brew install gmp)
$(error Aborting...)
GMPPAK=0
else
GMPPAK=1
endif
ifeq ($(shell echo $(HBPACK)|grep gcc),)
$(warning Please install gcc homebrew packages through the command:)
$(warning > brew install gcc)
$(error Aborting...)
GCCPAK=0
else
$(shell CC=$[$CC+1])
GCCPAK=1
endif
ifeq ($(shell echo $(HBPACK)|grep boost),)
$(warning Please install boost homebrew packages through the command:)
$(warning > brew install boost)
$(error Aborting...)
BOOSTPAK=0
else
BOOSTPAK=1
endif
ifeq ($(GMPPAK),1)
ifeq ($(GCCPAK),1)
ifeq ($(BOOSTPAK),1)
$(shell touch $(BREWINST))
endif
endif
endif
endif
endif
ifneq ($(shell command -v brew 2> /dev/null),)
ifeq ($(HBDIR),)
HBDIR=$(shell brew --prefix)
endif
endif
ifeq (,$(findstring intercept,$(CXX)))
#check if GNU g++ is installed
ifneq ("$(wildcard $(HBDIR))","")
CXXHB=$(shell ls $(HBDIR)/bin/g++-[0-9]* | sort -t - -k 2 -n | tail -1)
ifneq ("$(wildcard $(CXXHB))","")
CXX=$(shell basename $(CXXHB))
$(info Found GNU $(CXX) from homebrew)
else
CXX=g++
endif
else
$(info Homebrew not installed, I am going to use g++)
CXX=g++
endif
endif
ifneq ($(HBDIR),)
HBLIBS=-L $(HBDIR)/lib -lmpc -lmpfr -lgmp -lgmpxx
HBHDRS=-I $(HBDIR)/include
else
HBLIBS=-lmpc -lmpfr -lgmp -lgmpxx
HBHDRS=
endif
LIBS=$(HBLIBS)
CXXFLAGS= -Wall -Wno-pessimizing-move -std=c++17 -O3
CXXFLAGSMP=$(CXXFLAGS) $(HBHDRS)
HEADERS=./quartic.hpp ./pvector.hpp
LDFLAGS=-lm $(LIBS)
all: quartic quartic_mp quartic_cmplx accuracytest statanalysis
quartic: quartic.cpp $(HEADERS)
$(CXX) $(CXXFLAGS) -o quartic quartic.cpp
quartic_mp: quartic_mp.cpp $(HEADERS)
$(CXX) $(CXXFLAGSMP) $(LDFLAGS) -o quartic_mp quartic_mp.cpp
quartic_cmplx: quartic_cmplx.cpp $(HEADERS)
$(CXX) $(CXXFLAGSMP) $(LDFLAGS) -o quartic_cmplx quartic_cmplx.cpp
accuracytest: accuracytest.cpp $(HEADERS)
$(CXX) $(CXXFLAGSMP) $(LDFLAGS) -o accuracytest accuracytest.cpp
statanalysis: statanalysis.cpp $(HEADERS)
$(CXX) $(CXXFLAGSMP) $(LDFLAGS) -o statanalysis statanalysis.cpp
clean:
rm -f quartic quartic_mp quartic_cmplx accuracytest statanalysis *.o $(BREWINST)