-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
128 lines (97 loc) · 3.69 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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# EviAnn version
NAME=EviAnn
VERSION = 2.0.0
NCPU = $(shell grep -c '^processor' /proc/cpuinfo 2>/dev/null || sysctl hw.ncpu 2>/dev/null || echo 1)
# Component versions
COMPONENTS = global
##################################################################
# Rules for compilling a working distribution in build (or DEST) #
##################################################################
UPD_INSTALL = $(shell which install) -C
PWD = $(shell pwd)
PREF ?= $(PWD)
# PREF ?= .
BUILDDIR ?= $(PREF)/build
BUILDNAME = $(notdir $(BUILDDIR))
BINDIR = $(BUILDDIR)/inst/bin
LIBDIR = $(BUILDDIR)/inst/lib
INCDIR = $(BUILDDIR)/inst/include
SUBDIRS = $(foreach i,$(COMPONENTS),$(BUILDDIR)/$(i))
# Get info of where things are installed
PKGCONFIGDIR = $(BUILDDIR)/inst/lib/pkgconfig
.PHONY: subdirs $(SUBDIRS)
all: $(SUBDIRS)
$(BUILDDIR)/global: ./configure
mkdir -p $@
test -f $@/Makefile -a $@/Makefile -nt configure.ac || \
(cd $@; $(PWD)/configure --prefix=$(BUILDDIR)/inst --libdir=$(LIBDIR) --enable-swig)
$(MAKE) -C $@ -j $(NCPU) install-special INSTALL="$(UPD_INSTALL)"
configure: configure.ac
autoreconf -fi
SHORTCUTS = ufasta eviann samtools
.PHONY: $(SHORTCUTS)
$(SHORTCUTS):
$(MAKE) -C build/global/$@ install INSTALL="$(UPD_INSTALL)"
#############################################
# Tag all components with EviAnn's version #
#############################################
tag:
git submodule foreach git tag -f $(NAME)-$(VERSION)
git tag -f $(NAME)-$(VERSION)
git submodule foreach git push --tags
git push --tags
###########################################
# Rules for making a tarball distribution #
###########################################
DISTNAME = $(NAME)-$(VERSION)
DISTDIR ?= $(PREF)/distdir
DISTDIST = $(DISTDIR)/$(DISTNAME)
.PHONY: clean_distdir
clean_distdir:
rm -rf $(DISTDIST)
mkdir -p $(DISTDIST)
# For the module that support 'make distdir', create directly the distribution directory
$(DISTDIST)/%:
$(MAKE) -C $(BUILDDIR)/$* -j $(NCPU) distdir distdir="$@"
$(DISTDIST)/global:
cd $(BUILDDIR)/global; make -j $(NCPU) dist && tar zxf global*.tar.gz -C $(DISTDIST)
# For the module that do not support 'make distdir', get a verbatim copy from git
define GIT_TAR =
$(DISTDIST)/$1:
(cd $1; git archive --format=tar --prefix=$1/ HEAD) | (cd $(DISTDIST); tar -x)
endef
define TAR =
$(DISTDIST)/$1:
(tar c $1) | (cd $(DISTDIST); tar -x)
endef
$(foreach d,Flye,$(eval $(call GIT_TAR,$d)))
$(DISTDIST)/install.sh: install.sh.in
install $< $@
$(DISTDIST)/PkgConfig.pm: PkgConfig.pm
install $< $@
$(DISTDIST)/LICENSE: LICENSE
install $< $@
DIST_COMPONENTS = $(foreach comp,$(COMPONENTS),$(DISTDIST)/$(comp))
EXTRA_DIST = $(DISTDIST)/install.sh $(DISTDIST)/PkgConfig.pm $(DISTDIST)/LICENSE
$(DISTNAME).tar.gz: clean_distdir $(DIST_COMPONENTS) $(EXTRA_DIST)
tar -zcPf $@ --xform 's|^$(DISTDIR)||' $(DISTDIST)
$(DISTNAME).tar.bz: clean_distdir $(DIST_COMPONENTS) $(EXTRA_DIST)
tar -jcPf $@ --xform 's|^$(DISTDIR)||' $(DISTDIST)
$(DISTNAME).tar.xz: clean_distdir $(DIST_COMPONENTS) $(EXTRA_DIST)
tar -JcPf $@ --xform 's|^$(DISTDIR)||' $(DISTDIST)
.PHONY: dist dist-all
dist: $(DISTNAME).tar.gz
dist-all: dist $(DISTNAME).tar.xz $(DISTNAME).tar.bz
###############################
# Rules for compiling locally #
###############################
.PHONY: install clean_test_install
TESTDIR ?= $(PREF)/tests
clean_test_install:
rm -rf $(TESTDIR)/$(DISTNAME)
mkdir -p $(TESTDIR)
$(TESTDIR): $(DISTNAME).tar.gz
tar -zxf $< -C $(TESTDIR)
install: clean_test_install $(TESTDIR)
cd $(TESTDIR)/$(DISTNAME); ./install.sh
# @echo -e "**************************************************\n* Installation of $(DISTNAME) successful\n* Distribution available as $(DISTNAME).tar.gz\n**************************************************"