Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefiles: honor user-supplied flags #45

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions makefile
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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 \
Expand Down Expand Up @@ -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
Expand Down
28 changes: 14 additions & 14 deletions makefile_mac
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down Expand Up @@ -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
Expand Down