From: Kevin Murray Date: Mon, 27 Apr 2015 16:04:30 +1000 Subject: Makefile cleaning for debian --- Makefile | 53 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index fec7050..3cabbbd 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,31 @@ PROGRAM_NAME = scythe -VERSION = 0.991 +VERSION = 0.994 CC = gcc DEBUG ?= 0 -CFLAGS = -Wall -pedantic -DVERSION=$(VERSION) -std=gnu99 ifeq ($(DEBUG), 1) CFLAGS += -g -O0 -else +else CFLAGS += -O3 endif + ARCHIVE = $(PROGRAM_NAME)_$(VERSION) -LDFLAGS = -lz -lm +override CFLAGS += -Wall -pedantic -DVERSION=$(VERSION) -std=gnu99 -fPIC +override LDFLAGS += -lz -lm LDTESTFLAGS = -lcheck SDIR = src -OBJS = match.o scythe.o util.o prob.o -LOBJS = match.o util.o prob.o +LOBJS = match.o util.o prob.o +OBJS = $(LOBJS) scythe.o + +.PHONY: clean distclean dist testclean lib test all debian debian-clean +all: scythe test-scythe libscythe.so -.PHONY: clean default all distclean dist tests testclean lib +# Executables +scythe: $(OBJS) + $(CC) $(CFLAGS) $(OBJS) -o scythe $(LDFLAGS) -default: all +test-scythe: $(LOBJS) tests.o + $(CC) $(CFLAGS) $(LOBJS) tests.o -o test-scythe $(LDFLAGS) $(LDTESTFLAGS) %.o: $(SDIR)/%.c $(CC) $(CFLAGS) -c $< -o $@ @@ -27,31 +34,41 @@ match.o: $(SDIR)/scythe.h scythe.o: $(SDIR)/kseq.h $(SDIR)/scythe.h util.o: $(SDIR)/kseq.h $(SDIR)/scythe.h prob.o: $(SDIR)/scythe.h -test.o: $(SDIR)/scythe.h -valgrind: build +# special case, source is not ./src/tests.c +tests.o: $(SDIR)/scythe.h src/tests/tests.c + $(CC) $(CFLAGS) -c src/tests/tests.c -o $@ + +valgrind: scythe valgrind --leak-check=full --show-reachable=yes ./scythe -a solexa_adapters.fa test.fastq -test: clean match.o util.o prob.o test.o - $(CC) $(CFLAGS) $? -o test $(LDFLAGS) $(LDTESTFLAGS) && ./test +test: test-scythe + ./test-scythe testclean: - rm -rf ./tests + rm -rf ./tests ./test-scythe clean: - rm -rf *.o ./scythe *.dSYM + rm -rf *.o ./scythe ./test-scythe ./libscythe.so *.dSYM distclean: clean rm -rf *.tar.gz dist: - tar -zcf $(ARCHIVE).tar.gz src Makefile + tar -zcf $(ARCHIVE).tar.gz src Makefile illumina_adapters.fa -all: $(OBJS) - $(CC) $(CFLAGS) $? -o scythe $(LDFLAGS) lib: libscythe.so -libscythe.so: CFLAGS += -fpic libscythe.so: $(LOBJS) $(CC) $(CFLAGS) -shared -o $@ $^ $(LDFLAGS) + +debian: + mkdir -p scythe-debian + cp -r debian src Makefile illumina_adapters.fa scythe-debian + tar -zcf $(ARCHIVE).orig.tar.gz src Makefile illumina_adapters.fa + +debian-clean: + rm -f scythe_*.deb scythe*.dsc scythe_*.build scythe_*.changes scythe_*.debian.tar.* scythe_*.orig.tar.gz + rm -rf scythe-debian + $(MAKE) clean distclean