diff options
author | Peter Carbonetto | 2017-10-10 13:08:28 -0500 |
---|---|---|
committer | Pjotr Prins | 2017-10-13 15:27:24 +0000 |
commit | a06ac9884b4d4436e8821216cdba8ac83a8dcc07 (patch) | |
tree | 5a2ecfafd009ae54793a6b43e00b3b5185e7bd46 /Makefile.macosx | |
parent | cbd9df92109c11a20571975f3df19c1926dac24b (diff) | |
download | pangemma-a06ac9884b4d4436e8821216cdba8ac83a8dcc07.tar.gz |
Updated/revised Makefile for MacOSX.
Diffstat (limited to 'Makefile.macosx')
-rw-r--r-- | Makefile.macosx | 149 |
1 files changed, 96 insertions, 53 deletions
diff --git a/Makefile.macosx b/Makefile.macosx index 5312288..d2c1d90 100644 --- a/Makefile.macosx +++ b/Makefile.macosx @@ -1,38 +1,78 @@ -#Makefile - +# Generic Makefile for GEMMA +# # Supported platforms -# Unix / Linux LNX +# +# Unix / Linux LNX (default) # Mac MAC +# # Compilation options -# link to LAPACK WITH_LAPACK -# 32-bit binary FORCE_32BIT -# dynamic compilation FORCE_DYNAMIC +# 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 +# +# 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 = MAC +SYS = MAC # LNX|MAC (Linux is the default) # Leave blank after "=" to disable; put "= 1" to enable -# Disable WITH_LAPACK option can slow computation speed significantly and is not recommended -# Disable WITH_ARPACK option only disable -apprx option in the software -WITH_LAPACK = 1 -FORCE_32BIT = -FORCE_DYNAMIC = 1 -DIST_NAME = gemma-0.97.2 +DIST_NAME = gemma-0.97.2 +DEBUG = # DEBUG mode, set DEBUG= 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 -I/usr/local/Cellar/gsl/2.4/include -I./eigen +TRAVIS_CI = # used by TRAVIS for testing +EIGEN_INCLUDE_PATH= +CXX = g++ # -------------------------------------------------------------------- # Edit below this line with caution # -------------------------------------------------------------------- -BIN_DIR = ./bin +BIN_DIR = ./bin SRC_DIR = ./src +TEST_SRC_DIR = ./test/src -CPP = g++ +ifdef CXX # CXX defined in environment + CPP = $(CXX) + CC = $(CXX) +else + CPP = g++ +endif + +ifdef OPENBLAS + WITH_LAPACK = # OPENBLAS usually includes LAPACK +endif -CPPFLAGS = -F /System/Library/Frameworks \ - -O3 -I/usr/local/opt/gsl@1/include \ - -I./eigen -Wc++11-narrowing -Wno-unused-value +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 -LIBS = /usr/local/opt/gsl@1/lib/libgsl.a \ - /usr/local/opt/gsl@1/lib/libgslcblas.a -lz +ifdef SHOW_COMPILER_WARNINGS + CPPFLAGS += -Wall +endif OUTPUT = $(BIN_DIR)/gemma @@ -41,55 +81,59 @@ SOURCES = $(SRC_DIR)/main.cpp HDR = # Detailed libary paths, D for dynamic and S for static +LIBS += -framework Accelerate \ + /usr/local/opt/zlib/lib/libz.a \ + /usr/local/Cellar/gsl/2.4/lib/libgsl.a \ + /usr/local/Cellar/gsl/2.4/lib/libgslcblas.a -LIBS_LNX_D_LAPACK = -llapack -LIBS_MAC_D_LAPACK = -framework Accelerate -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 - -# Options - -SOURCES += $(SRC_DIR)/param.cpp $(SRC_DIR)/gemma.cpp $(SRC_DIR)/io.cpp $(SRC_DIR)/lm.cpp $(SRC_DIR)/lmm.cpp $(SRC_DIR)/vc.cpp $(SRC_DIR)/mvlmm.cpp $(SRC_DIR)/bslmm.cpp $(SRC_DIR)/prdt.cpp $(SRC_DIR)/mathfunc.cpp $(SRC_DIR)/gzstream.cpp $(SRC_DIR)/eigenlib.cpp $(SRC_DIR)/ldr.cpp $(SRC_DIR)/bslmmdap.cpp $(SRC_DIR)/logistic.cpp $(SRC_DIR)/varcov.cpp -HDR += $(SRC_DIR)/param.h $(SRC_DIR)/gemma.h $(SRC_DIR)/io.h $(SRC_DIR)/lm.h $(SRC_DIR)/lmm.h $(SRC_DIR)/vc.h $(SRC_DIR)/mvlmm.h $(SRC_DIR)/bslmm.h $(SRC_DIR)/prdt.h $(SRC_DIR)/mathfunc.h $(SRC_DIR)/gzstream.h $(SRC_DIR)/eigenlib.h - -ifdef WITH_LAPACK - OBJS += $(SRC_DIR)/lapack.o - CPPFLAGS += -DWITH_LAPACK -ifeq ($(SYS), MAC) - LIBS += $(LIBS_MAC_D_LAPACK) -else -ifdef FORCE_DYNAMIC - LIBS += $(LIBS_LNX_D_LAPACK) -else - LIBS += $(LIBS_LNX_S_LAPACK) -endif -endif - SOURCES += $(SRC_DIR)/lapack.cpp - HDR += $(SRC_DIR)/lapack.h -endif - -ifdef FORCE_32BIT - CPPFLAGS += -m32 -else - CPPFLAGS += -m64 -endif +HDR = $(wildcard src/*.h) +SOURCES = $(wildcard src/*.cpp) # all OBJS = $(SOURCES:.cpp=.o) all: $(OUTPUT) +<print-% : ; @echo $* = $($*) + $(OUTPUT): $(OBJS) $(CPP) $(CPPFLAGS) $(OBJS) $(LIBS) -o $(OUTPUT) -$(OBJS) : $(HDR) +$(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 -rf ${SRC_DIR}/*.o ${SRC_DIR}/*~ *~ $(OUTPUT) + 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 @@ -100,4 +144,3 @@ tar: cp -r $(DIST_SUBDIRS) ./$(DIST_NAME)/ tar cvzf $(DIST_NAME).tar.gz ./$(DIST_NAME)/ rm -r ./$(DIST_NAME) - |