Created
January 31, 2018 03:36
-
-
Save marcc-hpc/1106c9589a7d4a70f64ced0de41fc977 to your computer and use it in GitHub Desktop.
Building FastQTL on MARCC - Makefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#PLEASE SPECIFY THE R path here where you built the R math library standalone | |
RMATH=/cm/shared/apps/R/3.4.3/gcc/5.4/lib | |
#compiler | |
CXX=g++ -std=c++11 | |
#internal paths | |
VPATH=$(shell for file in `find src -name *.cpp`; do echo $$(dirname $$file); done) | |
PATH_TABX=lib/Tabix | |
PATH_EIGN=lib/Eigen | |
#compiler flags | |
CXXFLAG_OPTI=-O3 -D_FAST_CORRELATION | |
CXXFLAG_DEBG=-g | |
CXXFLAG_WARN=-Wall -Wextra -Wno-sign-compare | |
CXXFLAG_MACX=-mmacosx-version-min=10.7 -stdlib=libc++ | |
#linker flags | |
LDFLAG_OPTI=-O3 | |
LDFLAG_DEBG=-g | |
LDFLAG_MACX=-mmacosx-version-min=10.7 -stdlib=libc++ | |
#includes | |
INC_BASE=-Isrc -I$(PATH_TABX) -I$(PATH_EIGN) $(BOOST_CFLAGS) $(GSL_CFLAGS) | |
INC_MATH=-I$(RMATH)/include/ | |
INC_MACX=-I/usr/local/include/ | |
#libraries | |
#LIB_BASE=-lm -lboost_iostreams -lboost_program_options -lz -lgsl -lblas | |
LIB_BASE=-lm -lz $(BOOST_LIBS) -lboost_iostreams -lboost_program_options -lgsl -lgslcblas | |
#LIB_MATH=$(RMATH)/nmath/standalone/libRmath.a | |
LIB_MATH=$(RMATH)/libRmath.a | |
LIB_TABX=$(PATH_TABX)/libtabix.a | |
LIB_MACX=-L/usr/local/lib/ | |
LIB_GSL=$(GSL_LIBS) | |
MKLROOT=/cm/shared/intel/compilers_and_libraries_2017.4.196/linux/mkl/ | |
LIB_MKL= -Wl,--start-group $(MKLROOT)/lib/intel64/libmkl_intel_ilp64.a $(MKLROOT)/lib/intel64/libmkl_gnu_thread.a $(MKLROOT)/lib/intel64/libmkl_core.a -Wl,--end-group -lgomp -lpthread -lm -ldl | |
#files (binary, objects, headers & sources) | |
FILE_BIN=bin/fastQTL | |
FILE_O=$(shell for file in `find src -name *.cpp`; do echo obj/$$(basename $$file .cpp).o; done) | |
FILE_H=$(shell find src -name *.h) | |
FILE_CPP=$(shell find src -name *.cpp) | |
#default | |
all: linux | |
#linux release | |
linux: CXXFLAG=$(CXXFLAG_OPTI) $(CXXFLAG_WARN) | |
linux: IFLAG=$(INC_BASE) $(INC_MATH) | |
linux: LIB=$(LIB_MATH) $(LIB_TABX) $(LIB_GSL) $(LIB_MKL) $(LIB_BASE) | |
linux: LDFLAG=$(LDFLAG_OPTI) | |
linux: $(FILE_BIN) | |
#macos release | |
macos: CXXFLAG=$(CXXFLAG_OPTI) $(CXXFLAG_WARN) $(CXXFLAG_MACX) | |
macos: IFLAG=$(INC_BASE) $(INC_MACX) $(INC_MATH) | |
macos: LIB=$(LIB_MACX) $(LIB_MATH) $(LIB_TABX) $(LIB_BASE) | |
macos: LDFLAG=$(LDFLAG_OPTI) $(LDFLAG_MACX) | |
macos: $(FILE_BIN) | |
#debug release | |
debug: CXXFLAG=$(CXXFLAG_DEBG) $(CXXFLAG_WARN) | |
debug: IFLAG=$(INC_BASE) $(INC_MATH) | |
debug: LIB=$(LIB_MATH) $(LIB_TABX) $(LIB_BASE) | |
debug: LDFLAG=$(LDFLAG_DEBG) | |
debug: $(FILE_BIN) | |
#compilation | |
$(LIB_TABX): | |
cd $(PATH_TABX) && make && cd ../.. | |
$(FILE_BIN): $(FILE_O) $(LIB_TABX) | |
$(CXX) $(LDFLAG) $^ $(LIB) -o $@ | |
obj/%.o: %.cpp $(FILE_H) | |
$(CXX) $(CXXFLAG) -o $@ -c $< $(IFLAG) | |
clean: | |
rm -f obj/*.o $(FILE_BIN) | |
cleanall: clean | |
cd $(PATH_TABX) && make clean && cd ../.. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment