This repository has been archived by the owner on Mar 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathMakefile
98 lines (75 loc) · 2.06 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
CXX := g++
CXXFLAGS := -pthread -fno-strict-aliasing -std=c++1y -pedantic -Wall
LDFLAGS := -L/opt/local/lib -L/usr/local/lib
LIBS := -lm -lgmp
.PHONY: all release debian-release info debug clean debian-clean distclean asan
DESTDIR := /
PREFIX := /usr/local
MACHINE := $(shell uname -m)
ifeq ($(MACHINE), x86_64)
LIBDIR = lib64
endif
ifeq ($(MACHINE), i686)
LIBDIR = lib
endif
ifdef JAVASCRIPT
CXX := em++
CXXFLAGS += -I/usr/local/include
endif
ifdef X86
CXXFLAGS += -m32
LDFLAGS += -L/usr/lib -m32
endif
ifdef STATIC
LDFLAGS += -static-libgcc -Wl,-Bstatic
endif
ifdef X86
CXXFLAGS += -m32
LDFLAGS += -L/usr/lib -static-libgcc -m32 -Wl,-Bstatic
endif
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Darwin)
LDFLAGS := -L/opt/X11/lib/ -L/usr/local/lib
else
CXXFLAGS += -march=native
endif
all: release
ifneq ($(UNAME_S), Darwin)
release: LDFLAGS += -s
endif
release: CXXFLAGS += -g0 -O3
release: dirs
info: CXXFLAGS += -g3 -O0
info: LDFLAGS += -Wl,--export-dynamic -rdynamic
info: dirs
debug: CXXFLAGS += -g3 -O0 -rdynamic -DNFP_DEBUG
debug: LDFLAGS += -Wl,--export-dynamic -rdynamic
debug: dirs
profile: CXXFLAGS += -g3 -O1
profile: LDFLAGS += -Wl,--export-dynamic -rdynamic
profile: dirs
hardcore: CXXFLAGS += -g0 -Ofast -DNDEBUG
ifeq ($(UNAME_S), Darwin)
hardcore: LDFLAGS += -s
endif
hardcore: dirs
asan: CXXFLAGS += -rdynamic -fsanitize=address
asan: LDFLAGS += -rdynamic -fsanitize=address
asan: CXXFLAGS += -g3 -O0 -fno-omit-frame-pointer
asan: LDFLAGS += -Wl,--export-dynamic
asan: LIBS+= -lbfd -ldw
asan: dirs
clean: dirs
export LDFLAGS
export CXXFLAGS
export LIBS
dirs:
${MAKE} -C examples/ ${MAKEFLAGS} CXX=${CXX} NVCC="${NVCC}" NVCC_HOST_CXX="${NVCC_HOST_CXX}" NVCC_CXXFLAGS="${NVCC_CXXFLAGS}" ${MAKECMDGOALS}
debian-release:
${MAKE} -C examples/ -${MAKEFLAGS} CXX=${CXX} NVCC="${NVCC}" NVCC_HOST_CXX="${NVCC_HOST_CXX}" NVCC_CXXFLAGS="${NVCC_CXXFLAGS}" release
debian-clean:
${MAKE} -C examples/ -${MAKEFLAGS} CXX=${CXX} NVCC="${NVCC}" NVCC_HOST_CXX="${NVCC_HOST_CXX}" NVCC_CXXFLAGS="${NVCC_CXXFLAGS}" release
install: ${TARGET}
true
distclean:
true