diff --git a/Makefile b/Makefile index 9755156..23871c1 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,21 @@ CXX ?= g++ -CXXFLAGS = -std=c++11 -Wall -Wextra -Wno-missing-field-initializers -Wshadow -g -O2 -LIBS = -lm -lz -lpthread +CXXFLAGS = -std=c++11 -Wall -Wextra -Wno-missing-field-initializers -Wshadow -g -O2 +LIBS = -lm -lz -lpthread -PREFIX = $(DESTDIR)/usr/local -BINDIR = $(PREFIX)/bin -MANDIR = $(PREFIX)/share/man/man1 -MANPAGE = ococo.1 +PREFIX = $(DESTDIR)/usr/local +BINDIR = $(PREFIX)/bin +MANDIR = $(PREFIX)/share/man/man1 +MANPAGE = ococo.1 + +HTSLIBDIR = ext/htslib +HTSLIB = $(HTSLIBDIR)/libhts.a export CXX export CXXFLAGS +export HTSLIBDIR +export HTSLIB + .PHONY: all clean install ococo all: ococo @@ -18,14 +24,13 @@ install: ococo install ococo $(BINDIR)/ococo install $(MANPAGE) $(MANDIR)/$(MANPAGE) -ococo: - $(MAKE) -C ./ext/htslib lib-static +ococo: $(HTSLIB) $(MAKE) -C ./src - $(CXX) $(CXXFLAGS) $(DFLAGS) ./src/*.o -o $@ -L. $(LIBS) ./ext/htslib/libhts.a + $(CXX) $(CXXFLAGS) $(DFLAGS) ./src/*.o -o $@ -L. $(LIBS) $(HTSLIB) -ext/htslib/libhts.a: - $(MAKE) -C ext/htslib lib-static +$(HTSLIB): + $(MAKE) -C $(HTSLIBDIR) lib-static clean: $(MAKE) -C ext/htslib clean diff --git a/src/Makefile b/src/Makefile index 7d63f39..bd23375 100644 --- a/src/Makefile +++ b/src/Makefile @@ -5,11 +5,11 @@ all: misc.o main.o params.o HEADERS=types.h stats.h version.h main.o: main.cpp consensus.h caller.h version.h $(HEADERS) - $(CXX) $(CXXFLAGS) $(DFLAGS) -c $< -I ../ext/htslib/ + $(CXX) $(CXXFLAGS) $(DFLAGS) -c $< -I ../$(HTSLIB) %.o: %.cpp %.h $(HEADERS) - $(CXX) $(CXXFLAGS) $(DFLAGS) -c $< -I ../ext/htslib/ + $(CXX) $(CXXFLAGS) $(DFLAGS) -c $< -I ../$(HTSLIB) clean: rm -f *.o