Skip to content

Commit

Permalink
Fix wrong include and refactor Makefile to build cleanly on macOS (#146)
Browse files Browse the repository at this point in the history
* Fix wrong included file

* Refactor makefile and fix it to build cleanly on macOS
  • Loading branch information
milot-mirdita authored Mar 21, 2021
1 parent f119872 commit b014034
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
32 changes: 24 additions & 8 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
C++ = g++
CFLAGS = -c -g -O3 -pedantic -std=c++11 -fopenmp
CXXFLAGS := -c -g -O3 -pedantic -std=c++11

all: kmer_counter
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
CXX := clang++
else
CXX := g++
endif

kmer_counter: kmer2read_distr.o ctime.o taxonomy.o kraken_processing.o
$(C++) -o kmer2read_distr ctime.o kmer2read_distr.o taxonomy.o kraken_processing.o -lgomp
IS_CLANG := $(findstring clang++,$(CXX))
ifeq ($(IS_CLANG),clang++)
CXXFLAGS += -Xpreprocessor -fopenmp
LDFLAGS += -lomp
else
CXXFLAGS += -fopenmp
LDFLAGS += -lgomp
endif

all: kmer2read_distr

kmer2read_distr: kmer2read_distr.o ctime.o taxonomy.o kraken_processing.o
$(CXX) -o $@ $^ $(LDFLAGS)

clean:
rm -f *.o
rm -f *.o

%.o: %.cpp
$(CXX) $(CXXFLAGS) $<

%.o: %.cpp
$(C++) $(CFLAGS) $*.cpp
2 changes: 1 addition & 1 deletion src/ctime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Jennifer Lu, [email protected]
* Updated: 2018/09/06
*/
#include "time.h"
#include "ctime.h"

/*************************************************************************
* METHOD: timeval_subtract
Expand Down

0 comments on commit b014034

Please sign in to comment.