File: Makefile

package info (click to toggle)
ea-utils 1.1.2+dfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 840 kB
  • sloc: ansic: 11,459; cpp: 3,752; perl: 426; makefile: 74; sh: 42
file content (100 lines) | stat: -rw-r--r-- 3,073 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#
# $Id: Makefile 670 2013-12-13 16:47:07Z earonesty $

CC=g++
PREFIX?=/usr
BINDIR?=$(PREFIX)/bin
CFLAGS?=-O3 -I. 
CPPFLAGS?=-O3 -I.
# for debugging:
# CFLAGS?=-g -I. 
# CPPFLAGS?=-g -I.

PKG=ea-utils
REL := $(shell svnversion 2>/dev/null | perl -ne 'print $$1 if /:(\d+)/' )
VER := $(shell grep '%define ver' ${PKG}.spec | perl -ne 'print $$1 if / (\S+) *$$/')

SRC=fastq-clipper.c fastq-mcf.c fastq-multx.c fastq-join.c fastq-stats.cpp gcModel.c
BIN=fastq-mcf fastq-multx fastq-join fastq-stats fastq-clipper sam-stats varcall
TOOLS=fastx-graph gtf2bed determine-phred randomFQ alc

all: $(BIN)

debug: 
	CPPFLAGS=-g ${MAKE} $(MFLAGS) varcall

install: $(BIN) $(BINDIR)/fastq-clipper $(BINDIR)/fastq-mcf $(BINDIR)/fastq-multx $(BINDIR)/fastq-join $(BINDIR)/fastq-stats $(BINDIR)/sam-stats $(BINDIR)/varcall $(BINDIR)/fastx-graph $(BINDIR)/determine-phred $(BINDIR)/randomFQ $(BINDIR)/alc

$(BINDIR):
	mkdir -p $(BINDIR)

$(BINDIR)/%: % $(BINDIR)
	cp $< $@

dist: getrel $(PKG).${VER}-${REL}.tar.gz

# these shenanigans are done to ensure than the release in the spec file is the same as the subversion release
# a less verbose way should be possible

getrel:
	grep "${REL}" $(PKG).spec || touch $(PKG).spex

.PHONY: getrel debug

$(PKG).spec: $(PKG).spex
	perl -pe 's/%RELEASE%/${REL}/' $(PKG).spex > $(PKG).spec

$(PKG).tar.gz: Makefile $(TOOLS) $(SRC) $(PKG).spec fastq-lib.cpp fastq-lib.h sam-stats.cpp fastq-stats.cpp gcModel.c gcModel.h varcall.cpp utils.h README CHANGES google sparsehash samtools/*.c 
	rm -rf $(PKG).${VER}-${REL}
	mkdir $(PKG).${VER}-${REL}
	mkdir $(PKG).${VER}-${REL}/tidx
	mkdir $(PKG).${VER}-${REL}/samtools
	cp -nr $^ $(PKG).${VER}-${REL}
	cp -nr tidx/*.cpp tidx/*.h $(PKG).${VER}-${REL}/tidx
	cp -nr samtools/*.c samtools/*.h samtools/Makefile $(PKG).${VER}-${REL}/samtools
	tar --exclude=".svn" -cvzf $(PKG).tar.gz $(PKG).${VER}-${REL}
	rm -rf $(PKG).${VER}-${REL}

disttest: $(PKG).tar.gz
	tar -xzvf $(PKG).tar.gz
	cd $(PKG).${VER}-${REL} && make
	rm -rf $(PKG).${VER}-${REL}

$(PKG).${VER}-${REL}.tar.gz: $(PKG).tar.gz
	cp $< $@

%: %.c fastq-lib.cpp fastq-lib.h 
	$(CC) $(CFLAGS) fastq-lib.cpp -o $@ $< $(LDFLAGS)

%: %.cpp fastq-lib.cpp fastq-lib.h
	$(CC) $(CFLAGS) fastq-lib.cpp -o $@ $< $(LDFLAGS)


%: %.c gcModel.c gcModel.h
	$(CC) $(CFLAGS) gcModel.c -o $@ $< $(LDFLAGS)

%: %.cpp gcModel.c gcModel.h
	$(CC) $(CFLAGS) gcModel.c -o $@ $< $(LDFLAGS)

# why the libbam.a doesn't work?  not sure... *.o works
sam-stats: sam-stats.cpp fastq-lib.h
	$(CC) $(CFLAGS) fastq-lib.cpp $< -lbam -lz -lpthread -o $@ $(LDFLAGS)

samtools/libbam.a: samtools/*.c samtools/*.h
	cd samtools && make libbam.a

varcall: varcall.cpp fastq-lib.cpp tidx/tidx-lib.cpp
ifeq ($(OS),Windows_NT)
	echo varcall: not supported yet
else
	$(CC) $(CFLAGS) fastq-lib.cpp tidx/tidx-lib.cpp -o $@ $< -lgsl -lgslcblas $(LDFLAGS)
endif

fastq-stats: fastq-stats.cpp fastq-lib.cpp gcModel.c
	$(CC) $(CFLAGS) fastq-lib.cpp gcModel.c -o $@ $< $(LDFLAGS)

bam-filter:  bam-filter.cpp 
	$(CC) $(CFLAGS) fastq-lib.cpp -o $@  $< -lbamtools $(LDFLAGS)

clean:
	rm -f *.o $(BIN)