blob: 7fd518d35a6e65063d6def45fd07518d367231da (
plain)
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
# Generic Makefile for GEMMA
#
# Supported platforms
#
# Unix / Linux LNX (default)
# Mac MAC
#
# Compilation options
# static compilation FORCE_STATIC
#
# Examples:
#
# Make GEMMA on Linux with OPENBLAS support:
#
# make WITH_OPENBLAS=1
#
# Disable debug info and checks (slightly faster release mode)
#
# make WITH_OPENBLAS=1 DEBUG=
#
# Force static compilation
#
# make FORCE_STATIC=1
#
# Run tests with
#
# make check
#
# Run quick (development) tests with
#
# make fast-check
#
# Run full (lengthy) tests with
#
# make check-all
#
# See also the INSTALL.md document in the source tree at
#
# https://github.com/genetics-statistics/GEMMA/blob/master/INSTALL.md
# Set this variable to either LNX or MAC
SYS = LNX # LNX|MAC (Linux is the default)
# Leave blank after "=" to disable; put "= 1" to enable
DIST_NAME = gemma-0.97.3
DEBUG = 1 # DEBUG mode, set DEBUG=0 for a release
SHOW_COMPILER_WARNINGS =
WITH_LAPACK = 1
WITH_OPENBLAS = # Defaults to LAPACK - OPENBLAS may be faster
FORCE_STATIC = # Static linking of libraries
GCC_FLAGS = -O3 # extra flags -Wl,--allow-multiple-definition
TRAVIS_CI = # used by TRAVIS for testing
EIGEN_INCLUDE_PATH=/usr/include/eigen3
# --------------------------------------------------------------------
# Edit below this line with caution
# --------------------------------------------------------------------
BIN_DIR = ./bin
SRC_DIR = ./src
TEST_SRC_DIR = ./test/src
ifdef CXX # CXX defined in environment
CPP = $(CXX)
CC = $(CXX)
else
CPP = g++
endif
ifdef WITH_OPENBLAS
OPENBLAS=1
# WITH_LAPACK = # OPENBLAS usually includes LAPACK
CPPFLAGS += -DOPENBLAS
endif
ifdef DEBUG
CPPFLAGS += -g $(GCC_FLAGS) -std=gnu++11 -isystem/$(EIGEN_INCLUDE_PATH) -Icontrib/catch-1.9.7 -Isrc
else
# release mode
CPPFLAGS += -DNDEBUG $(GCC_FLAGS) -std=gnu++11 -isystem/$(EIGEN_INCLUDE_PATH) -Icontrib/catch-1.9.7 -Isrc
endif
ifdef SHOW_COMPILER_WARNINGS
CPPFLAGS += -Wall
endif
ifndef FORCE_STATIC
LIBS = -lgsl -lgslcblas -pthread -lz
else
ifndef TRAVIS_CI # Travis static compile we cheat a little
CPPFLAGS += -static
endif
endif
OUTPUT = $(BIN_DIR)/gemma
SOURCES = $(SRC_DIR)/main.cpp
HDR =
# Detailed libary paths, D for dynamic and S for static
LIBS_LNX_D_LAPACK = -llapack
LIBS_LNX_D_BLAS = -lblas
LIBS_LNX_D_OPENBLAS = -lopenblas
LIBS_MAC_D_LAPACK = -framework Accelerate
# LIBS_LNX_S_LAPACK = /usr/lib/libgsl.a /usr/lib/libgslcblas.a /usr/lib/lapack/liblapack.a -lz
LIBS_LNX_S_LAPACK = /usr/lib/lapack/liblapack.a -lgfortran /usr/lib/atlas-base/libatlas.a /usr/lib/libblas/libblas.a -Wl,--allow-multiple-definition
ifdef WITH_LAPACK
ifeq ($(SYS), MAC)
LIBS += $(LIBS_MAC_D_LAPACK)
else
ifndef FORCE_STATIC
ifdef WITH_OPENBLAS
LIBS += $(LIBS_LNX_D_OPENBLAS)
else
LIBS += $(LIBS_LNX_D_BLAS)
endif
LIBS += $(LIBS_LNX_D_LAPACK)
else
LIBS += $(LIBS_LNX_S_LAPACK)
endif
endif
endif
HDR = $(wildcard src/*.h)
SOURCES = $(wildcard src/*.cpp)
# all
OBJS = $(SOURCES:.cpp=.o)
all: $(OUTPUT)
$(OUTPUT): $(OBJS)
$(CPP) $(CPPFLAGS) $(OBJS) $(LIBS) -o $(OUTPUT)
$(OBJS) : $(HDR)
.cpp.o:
$(CPP) $(CPPFLAGS) $(HEADERS) -c $*.cpp -o $*.o
.SUFFIXES : .cpp .c .o $(SUFFIXES)
unittests: all contrib/catch-1.9.7/catch.hpp $(TEST_SRC_DIR)/unittests-main.o $(TEST_SRC_DIR)/unittests-math.o
$(CPP) $(CPPFLAGS) $(TEST_SRC_DIR)/unittests-main.o $(TEST_SRC_DIR)/unittests-math.o $(filter-out src/main.o, $(OBJS)) $(LIBS) -o ./bin/unittests-gemma
./bin/unittests-gemma
fast-check: all unittests
rm -vf test/output/*
cd test && ./dev_test_suite.sh | tee ../dev_test.log
grep -q 'success rate: 100%' dev_test.log
slow-check: all
rm -vf test/output/*
cd test && ./test_suite.sh | tee ../test.log
grep -q 'success rate: 100%' test.log
lengthy-check: all
rm -vf test/output/*
cd test && ./lengthy_test_suite.sh | tee ../lengthy_test.log
grep -q 'success rate: 100%' lengthy_test.log
check: fast-check slow-check
check-all: check lengthy-check
clean:
rm -vf $(SRC_DIR)/*.o
rm -vf $(SRC_DIR)/*~
rm -vf $(TEST_SRC_DIR)/*.o
rm -vf $(OUTPUT)
rm -vf ./bin/unittests-gemma
DIST_COMMON = COPYING.txt README.txt Makefile
DIST_SUBDIRS = src doc example bin
tar:
mkdir -p ./$(DIST_NAME)
cp $(DIST_COMMON) ./$(DIST_NAME)/
cp -r $(DIST_SUBDIRS) ./$(DIST_NAME)/
tar cvzf $(DIST_NAME).tar.gz ./$(DIST_NAME)/
rm -r ./$(DIST_NAME)
|