Skip to content

Commit

Permalink
update makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Zilong-Li committed Aug 14, 2024
1 parent c121bbc commit 39390bd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ admix.*
run.sh
inst/include/htslib*
src/phaseless.so
src/libsrc.*
*.gz
16 changes: 10 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
HTSDIR = ./inst/include/htslib-1.18
CXX = g++

CXXFLAGS = -std=c++17 -Wall -O3 -g -fsanitize=address
# CXXFLAGS = -std=c++17 -Wall -O3 -g -fsanitize=address
# CXXFLAGS = -std=c++17 -Wall -O3 -march=native -DNDEBUG
# CXXFLAGS = -std=c++17 -Wall -O3 -DNDEBUG
CXXFLAGS = -std=c++17 -Wall -O3 -DNDEBUG
INC = -I./src -I./inst/include -I$(HTSDIR)
LDFLAGS = -L$(HTSDIR) -Wl,-rpath,$(HTSDIR)
LIBS = -llzma -lbz2 -lm -lz -lpthread
OBJS = src/main.o src/phaseless.o src/fastphase.o src/admixture.o src/io.o src/utils.o
OBJS = src/phaseless.o src/fastphase.o src/admixture.o src/io.o src/utils.o
libsrc = src/libsrc.a
BINS = phaseless
libhts = $(HTSDIR)/libhts.a
FLOAT = 0
Expand All @@ -24,14 +25,17 @@ all: $(BINS) $(libhts)
%.o: %.cpp
${CXX} ${CXXFLAGS} -o $@ -c $< ${INC}

$(BINS): $(OBJS) $(libhts)
${CXX} ${CXXFLAGS} -o $@ $(OBJS) ${INC} $(libhts) $(LIBS) $(LDFLAGS)
$(BINS): src/main.o $(libsrc) $(libhts)
${CXX} ${CXXFLAGS} -o $@ src/main.o $(libsrc) $(libhts) $(LIBS) $(LDFLAGS) $(INC)

$(libhts):
cd $(HTSDIR) && ./configure --disable-libcurl --without-libdeflate && make -j6

$(libsrc): $(OBJS)
ar -rcs $@ $?

clean:
rm -f $(BINS) $(OBJS)
rm -f $(BINS) src/*.o src/*.a
cd $(HTSDIR) && make clean

impute:
Expand Down
10 changes: 5 additions & 5 deletions tests/Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
HTSDIR = ../inst/include/htslib-1.18
CXX = g++
CXXFLAGS = -std=c++17 -Wall -O3
INC = -I. -I../src -I../inst/include -I$(HTSDIR)
LDFLAGS = -L$(HTSDIR) -Wl,-rpath,$(HTSDIR)
LIBS = -lhts -llzma -lbz2 -lm -lz -lpthread
INC = -I../src -I../inst/include -I$(HTSDIR)
# LDFLAGS = -L$(HTSDIR) -Wl,-rpath,$(HTSDIR)
LIBS = $(HTSDIR)/libhts.a -llzma -lbz2 -lm -lz -lpthread

OBJS = test-main.o test-joint.o test-admixture.o test-fastphase.o test-utils.o

BINS = test-joint.bin test-admixture.bin test-fastphase.bin test-utils.bin

DEPS = ../src/phaseless.o ../src/fastphase.o ../src/admixture.o
DEPS = ../src/libsrc.a

UTILS = test-cli test-io

Expand All @@ -21,7 +21,7 @@ all: $(BINS) $(OBJS)
$(CXX) $(CXXFLAGS) -o $@ -c $< ${INC}

%.bin: %.o test-main.o $(DEPS)
${CXX} ${CXXFLAGS} -o $@ $< test-main.o $(DEPS) $(LDFLAGS) $(LIBS)
${CXX} ${CXXFLAGS} -o $@ $< test-main.o $(DEPS) $(LDFLAGS) $(LIBS) $(INC)

test: $(BINS)
./test-utils.bin --success
Expand Down
2 changes: 1 addition & 1 deletion tests/test-fastphase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ TEST_CASE("fastphasek4", "[test-fastphasek4]")
llike.clear(); // clear future and renew
faith4.updateClusterFreqPI(postProbsZ, tol);
faith4.updateAlleleFreqWithinCluster(postProbsZandG, tol);
// REQUIRE(loglike > prevlike);
REQUIRE(loglike > prevlike);
prevlike = loglike;
}
}
Expand Down

0 comments on commit 39390bd

Please sign in to comment.