-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
59 lines (42 loc) · 1.9 KB
/
Makefile
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
# Create "make test"
.PHONY: testshpec testshunit2 test clean build
BIN=./bin
BIN2=./static
SOURCE=./src
LIBPATH=$(shell dirname $(shell which samtools) | sed 's/bin/lib/')
NIM_PATHS= --colors:on --noNimblePath --path:/local/giovanni/bamtocov/nimbledeps/pkgs/hts-0.3.17 --path:/local/giovanni/bamtocov/nimbledeps/pkgs/docopt-0.6.8 --path:/local/giovanni/bamtocov/nimbledeps/pkgs/regex-0.19.0 --path:/local/giovanni/bamtocov/nimbledeps/pkgs/unicodedb-0.9.0 --path:/local/giovanni/bamtocov/nimbledeps/pkgs/lapper-0.1.7
VERSION := $(shell grep version bamtocov.nimble | grep -o "[0-9]\\+\.[0-9]\.[0-9]\\+")
LIST=$(BIN)/bamtocov $(BIN)/bamtocounts $(BIN)/covtotarget $(BIN)/bamcountrefs $(BIN)/gff2bed $(BIN)/bamtocounts_legacy $(BIN)/bamtarget
STATIC=$(BIN2)/bamtocov $(BIN2)/bamtocounts $(BIN2)/covtotarget $(BIN2)/bamcountrefs $(BIN2)/gff2bed $(BIN2)/bamtocounts_legacy $(BIN2)/bamtarget
$(BIN)/%: $(SOURCE)/%.nim $(SOURCE)/covutils.nim bamtocov.nimble
nim c $(NIM_PATHS) -d:NimblePkgVersion=$(VERSION) -d:danger --opt:speed --out:$@ $<
all: $(LIST)
./hts_nim_static_builder:
wget "https://github.com/brentp/hts-nim/releases/download/v0.2.8/hts_nim_static_builder"
chmod +x hts_nim_static_builder
static: $(STATIC)
$(BIN2)/%: $(SOURCE)/%.nim bamtocov.nimble ./hts_nim_static_builder
mkdir -p $(BIN2)
echo target: $@
echo base: $(shell basename $@)
./hts_nim_static_builder -n bamtocov.nimble -s $< -- -d:NimblePkgVersion=$(VERSION)
mv ./$(shell basename $@) $(BIN2)
test: testshpec
testall: testbash testshpec testshunit2
testshpec:
@echo " --- Test shpec --- "
./tests/bin/shpec ./tests/shpec/bamtocov.sh
testshunit2:
@echo " --- Test shunit2 --- "
./tests/unit/bamtocov-base.sh
testbash:
@echo " --- Test (legacy) --- "
bash tests/all.sh
build:
nimble build
clean:
@echo "Cleaning..."
@for i in $(LIST); \
do \
if [ -e "$$i" ]; then rm -f $$i; echo "Removing $$i"; else echo "$$i Not found"; fi \
done