diff --git a/makefile b/makefile index bce2834..1c2b4c9 100644 --- a/makefile +++ b/makefile @@ -1,19 +1,19 @@ -all: kmc - +all: kmc kmc_dump kmc_tools + KMC_BIN_DIR = bin KMC_MAIN_DIR = kmer_counter KMC_API_DIR = kmc_api KMC_DUMP_DIR = kmc_dump KMC_TOOLS_DIR = kmc_tools -CC = g++ -CFLAGS = -Wall -O3 -m64 -static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -std=c++11 -CLINK = -lm -static -O3 -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -std=c++11 +CXX ?= g++ +CFLAGS = -Wall -O3 -m64 -static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -std=c++11 +CLINK = -lm -static -O3 -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -std=c++11 KMC_TOOLS_CFLAGS = -Wall -O3 -m64 -static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -std=c++14 KMC_TOOLS_CLINK = -lm -static -O3 -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -std=c++14 -DISABLE_ASMLIB = false +DISABLE_ASMLIB ?= false KMC_OBJS = \ $(KMC_MAIN_DIR)/kmer_counter.o \ @@ -34,7 +34,7 @@ RADULS_OBJS = \ $(KMC_MAIN_DIR)/raduls_sse2.o \ $(KMC_MAIN_DIR)/raduls_sse41.o \ $(KMC_MAIN_DIR)/raduls_avx2.o \ -$(KMC_MAIN_DIR)/raduls_avx.o +$(KMC_MAIN_DIR)/raduls_avx.o KMC_LIBS = \ $(KMC_MAIN_DIR)/libs/libz.a \ @@ -63,46 +63,46 @@ $(KMC_TOOLS_DIR)/percent_progress.o KMC_TOOLS_LIBS = \ $(KMC_TOOLS_DIR)/libs/libz.a \ -$(KMC_TOOLS_DIR)/libs/libbz2.a +$(KMC_TOOLS_DIR)/libs/libbz2.a ifeq ($(DISABLE_ASMLIB),true) CFLAGS += -DDISABLE_ASMLIB KMC_TOOLS_CFLAGS += -DDISABLE_ASMLIB else KMC_LIBS += \ - $(KMC_MAIN_DIR)/libs/libaelf64.a + $(KMC_MAIN_DIR)/libs/libaelf64.a KMC_TOOLS_LIBS += \ - $(KMC_TOOLS_DIR)/libs/libaelf64.a -endif + $(KMC_TOOLS_DIR)/libs/libaelf64.a +endif $(KMC_OBJS) $(KMC_DUMP_OBJS) $(KMC_API_OBJS): %.o: %.cpp - $(CC) $(CFLAGS) -c $< -o $@ + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CFLAGS) -c $< -o $@ $(KMC_TOOLS_OBJS): %.o: %.cpp - $(CC) $(KMC_TOOLS_CFLAGS) -c $< -o $@ + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(KMC_TOOLS_CFLAGS) -c $< -o $@ $(KMC_MAIN_DIR)/raduls_sse2.o: $(KMC_MAIN_DIR)/raduls_sse2.cpp - $(CC) $(CFLAGS) -msse2 -c $< -o $@ + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CFLAGS) -msse2 -c $< -o $@ $(KMC_MAIN_DIR)/raduls_sse41.o: $(KMC_MAIN_DIR)/raduls_sse41.cpp - $(CC) $(CFLAGS) -msse4.1 -c $< -o $@ + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CFLAGS) -msse4.1 -c $< -o $@ $(KMC_MAIN_DIR)/raduls_avx.o: $(KMC_MAIN_DIR)/raduls_avx.cpp - $(CC) $(CFLAGS) -mavx -fabi-version=0 -c $< -o $@ + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CFLAGS) -mavx -fabi-version=0 -c $< -o $@ $(KMC_MAIN_DIR)/raduls_avx2.o: $(KMC_MAIN_DIR)/raduls_avx2.cpp - $(CC) $(CFLAGS) -mavx2 -mfma -fabi-version=0 -c $< -o $@ + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CFLAGS) -mavx2 -mfma -fabi-version=0 -c $< -o $@ $(KMC_MAIN_DIR)/instrset_detect.o: $(KMC_MAIN_DIR)/libs/vectorclass/instrset_detect.cpp - $(CC) $(CFLAGS) -c $< -o $@ - -kmc: $(KMC_OBJS) $(RADULS_OBJS) $(KMC_MAIN_DIR)/instrset_detect.o + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CFLAGS) -c $< -o $@ + +kmc: $(KMC_OBJS) $(RADULS_OBJS) $(KMC_MAIN_DIR)/instrset_detect.o -mkdir -p $(KMC_BIN_DIR) - $(CC) $(CLINK) -o $(KMC_BIN_DIR)/$@ $^ $(KMC_LIBS) + $(CXX) -o $(KMC_BIN_DIR)/$@ $^ $(KMC_LIBS) $(LDFLAGS) $(CLINK) kmc_dump: $(KMC_DUMP_OBJS) $(KMC_API_OBJS) -mkdir -p $(KMC_BIN_DIR) - $(CC) $(CLINK) -o $(KMC_BIN_DIR)/$@ $^ - + $(CXX) -o $(KMC_BIN_DIR)/$@ $^ $(LDFLAGS) $(CLINK) + kmc_tools: $(KMC_TOOLS_OBJS) $(KMC_API_OBJS) -mkdir -p $(KMC_BIN_DIR) - $(CC) $(KMC_TOOLS_CLINK) -o $(KMC_BIN_DIR)/$@ $^ $(KMC_TOOLS_LIBS) - + $(CXX) -o $(KMC_BIN_DIR)/$@ $^ $(KMC_TOOLS_LIBS) $(LDFLAGS) $(KMC_TOOLS_CLINK) + clean: -rm $(KMC_MAIN_DIR)/*.o -rm $(KMC_API_DIR)/*.o diff --git a/makefile_mac b/makefile_mac index c3c8b5e..2f04ca6 100644 --- a/makefile_mac +++ b/makefile_mac @@ -1,18 +1,18 @@ all: kmc kmc_dump kmc_tools - + KMC_BIN_DIR = bin KMC_MAIN_DIR = kmer_counter KMC_API_DIR = kmc_api KMC_DUMP_DIR = kmc_dump KMC_TOOLS_DIR = kmc_tools -CC = /usr/local/gcc-6.3.0/bin/g++ -CFLAGS = -Wall -O3 -m64 -static-libgcc -static-libstdc++ -fopenmp -pthread -std=c++11 -CLINK = -lm -fopenmp -static-libgcc -static-libstdc++ -O3 -pthread -std=c++11 +CXX ?= /usr/local/gcc-6.3.0/bin/g++ +CFLAGS = -Wall -O3 -m64 -static-libgcc -static-libstdc++ -fopenmp -pthread -std=c++11 +CLINK = -lm -fopenmp -static-libgcc -static-libstdc++ -O3 -pthread -std=c++11 KMC_TOOLS_CFLAGS = -Wall -O3 -m64 -static-libgcc -static-libstdc++ -pthread -std=c++14 KMC_TOOLS_CLINK = -lm -static-libgcc -static-libstdc++ -O3 -pthread -std=c++14 -DISABLE_ASMLIB = false +DISABLE_ASMLIB ?= false KMC_OBJS = \ $(KMC_MAIN_DIR)/kmer_counter.o \ @@ -65,28 +65,28 @@ ifeq ($(DISABLE_ASMLIB),true) KMC_TOOLS_CFLAGS += -DDISABLE_ASMLIB else KMC_LIBS += \ - $(KMC_MAIN_DIR)/libs/libamac64.a + $(KMC_MAIN_DIR)/libs/libamac64.a KMC_TOOLS_LIBS += \ $(KMC_TOOLS_DIR)/libs/libamac64.a -endif +endif $(KMC_OBJS) $(KMC_DUMP_OBJS) $(KMC_API_OBJS): %.o: %.cpp - $(CC) $(CFLAGS) -c $< -o $@ + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(CFLAGS) -c $< -o $@ $(KMC_TOOLS_OBJS): %.o: %.cpp - $(CC) $(KMC_TOOLS_CFLAGS) -c $< -o $@ + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(KMC_TOOLS_CFLAGS) -c $< -o $@ -kmc: $(KMC_OBJS) +kmc: $(KMC_OBJS) -mkdir -p $(KMC_BIN_DIR) - $(CC) $(CLINK) -o $(KMC_BIN_DIR)/$@ $^ $(KMC_LIBS) + $(CXX) -o $(KMC_BIN_DIR)/$@ $^ $(KMC_LIBS) $(LDFLAGS) $(CLINK) kmc_dump: $(KMC_DUMP_OBJS) $(KMC_API_OBJS) -mkdir -p $(KMC_BIN_DIR) - $(CC) $(CLINK) -o $(KMC_BIN_DIR)/$@ $^ + $(CXX) -o $(KMC_BIN_DIR)/$@ $^ $(LDFLAGS) $(CLINK) kmc_tools: $(KMC_TOOLS_OBJS) $(KMC_API_OBJS) -mkdir -p $(KMC_BIN_DIR) - $(CC) $(KMC_TOOLS_CLINK) -o $(KMC_BIN_DIR)/$@ $^ $(KMC_TOOLS_LIBS) - + $(CXX) -o $(KMC_BIN_DIR)/$@ $^ $(KMC_TOOLS_LIBS) $(LDFLAGS) $(KMC_TOOLS_CLINK) + clean: -rm $(KMC_MAIN_DIR)/*.o -rm $(KMC_API_DIR)/*.o