-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
108 lines (83 loc) · 2.44 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
99
100
101
102
103
104
105
106
107
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Darwin)
BOOST_MT=-mt
endif
CXX := g++
CXXFLAGS := -pthread -fno-strict-aliasing -std=c++0x -pedantic -Wall
LDFLAGS := -L/opt/local/lib
LIBS := -lpthread -lm
.PHONY: all release debian-release info debug clean debian-clean distclean
DESTDIR := /
PREFIX := /usr/local
MACHINE := $(shell uname -m)
ifeq ($(UNAME_S), Darwin)
CXX=clang++
LD=clang++
LDFLAGS += -L/opt/local/lib # MacPorts Boost doesn't come with pkgconfig
CXXFLAGS += -stdlib=libc++
LDFLAGS += -stdlib=libc++
endif
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
ifeq ($(UNAME_S), Darwin)
LDFLAGS += -L/opt/X11/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
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
clean: dirs
export LDFLAGS
export CXXFLAGS
export LIBS
export DESTDIR
export PREFIX
dirs:
${MAKE} -C src/ ${MAKEFLAGS} CXX=${CXX} NVCC="${NVCC}" NVCC_HOST_CXX="${NVCC_HOST_CXX}" NVCC_CXXFLAGS="${NVCC_CXXFLAGS}" ${MAKECMDGOALS}
debian-release:
${MAKE} -C src/ -${MAKEFLAGS} CXX=${CXX} NVCC="${NVCC}" NVCC_HOST_CXX="${NVCC_HOST_CXX}" NVCC_CXXFLAGS="${NVCC_CXXFLAGS}" release
debian-clean:
${MAKE} -C src/ -${MAKEFLAGS} CXX=${CXX} NVCC="${NVCC}" NVCC_HOST_CXX="${NVCC_HOST_CXX}" NVCC_CXXFLAGS="${NVCC_CXXFLAGS}" clean
debian-install: ${TARGET}
${MAKE} -C src/ -${MAKEFLAGS} CXX=${CXX} NVCC="${NVCC}" NVCC_HOST_CXX="${NVCC_HOST_CXX}" NVCC_CXXFLAGS="${NVCC_CXXFLAGS}" install
install: ${TARGET}
${MAKE} -C src/ ${MAKEFLAGS} CXX=${CXX} NVCC="${NVCC}" NVCC_HOST_CXX="${NVCC_HOST_CXX}" NVCC_CXXFLAGS="${NVCC_CXXFLAGS}" install
distclean:
${MAKE} -C src/ ${MAKEFLAGS} CXX=${CXX} NVCC="${NVCC}" NVCC_HOST_CXX="${NVCC_HOST_CXX}" NVCC_CXXFLAGS="${NVCC_CXXFLAGS}" distclean