| 1 |
# Makefile for htslib, a C library for high-throughput sequencing data formats. |
| 2 |
# |
| 3 |
# Copyright (C) 2013-2017 Genome Research Ltd. |
| 4 |
# |
| 5 |
# Author: John Marshall <[email protected]> |
| 6 |
# |
| 7 |
# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 8 |
# of this software and associated documentation files (the "Software"), to deal |
| 9 |
# in the Software without restriction, including without limitation the rights |
| 10 |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 11 |
# copies of the Software, and to permit persons to whom the Software is |
| 12 |
# furnished to do so, subject to the following conditions: |
| 13 |
# |
| 14 |
# The above copyright notice and this permission notice shall be included in |
| 15 |
# all copies or substantial portions of the Software. |
| 16 |
# |
| 17 |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 20 |
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 22 |
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 23 |
# DEALINGS IN THE SOFTWARE. |
| 24 |
|
| 25 |
CC = gcc |
| 26 |
AR = ar |
| 27 |
RANLIB = ranlib |
| 28 |
|
| 29 |
# Default libraries to link if configure is not used |
| 30 |
htslib_default_libs = -lz -lm -lbz2 -llzma |
| 31 |
|
| 32 |
CPPFLAGS = |
| 33 |
# TODO: probably update cram code to make it compile cleanly with -Wc++-compat |
| 34 |
# For testing strict C99 support add -std=c99 -D_XOPEN_SOURCE=600 |
| 35 |
#CFLAGS = -g -Wall -O2 -pedantic -std=c99 -D_XOPEN_SOURCE=600 -D__FUNCTION__=__func__ |
| 36 |
CFLAGS = -g -Wall -O2 |
| 37 |
EXTRA_CFLAGS_PIC = -fpic |
| 38 |
LDFLAGS = |
| 39 |
LIBS = $(htslib_default_libs) |
| 40 |
|
| 41 |
prefix = /usr/local |
| 42 |
exec_prefix = $(prefix) |
| 43 |
bindir = $(exec_prefix)/bin |
| 44 |
includedir = $(prefix)/include |
| 45 |
libdir = $(exec_prefix)/lib |
| 46 |
libexecdir = $(exec_prefix)/libexec |
| 47 |
datarootdir = $(prefix)/share |
| 48 |
mandir = $(datarootdir)/man |
| 49 |
man1dir = $(mandir)/man1 |
| 50 |
man5dir = $(mandir)/man5 |
| 51 |
pkgconfigdir= $(libdir)/pkgconfig |
| 52 |
|
| 53 |
MKDIR_P = mkdir -p |
| 54 |
INSTALL = install -p |
| 55 |
INSTALL_DATA = $(INSTALL) -m 644 |
| 56 |
INSTALL_DIR = $(MKDIR_P) -m 755 |
| 57 |
INSTALL_LIB = $(INSTALL_DATA) |
| 58 |
INSTALL_MAN = $(INSTALL_DATA) |
| 59 |
INSTALL_PROGRAM = $(INSTALL) |
| 60 |
|
| 61 |
# Set by config.mk if plugins are enabled |
| 62 |
plugindir = |
| 63 |
|
| 64 |
BUILT_PROGRAMS = \ |
| 65 |
bgzip \ |
| 66 |
htsfile \ |
| 67 |
tabix |
| 68 |
|
| 69 |
BUILT_TEST_PROGRAMS = |
| 70 |
|
| 71 |
BUILT_THRASH_PROGRAMS = |
| 72 |
|
| 73 |
all: lib-static lib-shared $(BUILT_PROGRAMS) plugins |
| 74 |
|
| 75 |
HTSPREFIX = |
| 76 |
include htslib_vars.mk |
| 77 |
|
| 78 |
# If not using GNU make, you need to copy the version number from version.sh |
| 79 |
# into here. |
| 80 |
PACKAGE_VERSION := $(shell ./version.sh) |
| 81 |
LIBHTS_SOVERSION = 2 |
| 82 |
|
| 83 |
# $(NUMERIC_VERSION) is for items that must have a numeric X.Y.Z string |
| 84 |
# even if this is a dirty or untagged Git working tree. |
| 85 |
NUMERIC_VERSION := $(shell ./version.sh numeric) |
| 86 |
|
| 87 |
# Force version.h to be remade if $(PACKAGE_VERSION) has changed. |
| 88 |
version.h: $(if $(wildcard version.h),$(if $(findstring "$(PACKAGE_VERSION)",$(shell cat version.h)),,force)) |
| 89 |
|
| 90 |
version.h: |
| 91 |
echo '#define HTS_VERSION "$(PACKAGE_VERSION)"' > $@ |
| 92 |
|
| 93 |
print-version: |
| 94 |
@echo $(PACKAGE_VERSION) |
| 95 |
|
| 96 |
show-version: |
| 97 |
@echo PACKAGE_VERSION = $(PACKAGE_VERSION) |
| 98 |
@echo NUMERIC_VERSION = $(NUMERIC_VERSION) |
| 99 |
|
| 100 |
.SUFFIXES: .bundle .c .cygdll .dll .o .pico .so |
| 101 |
|
| 102 |
.c.o: |
| 103 |
$(CC) $(CFLAGS) -I. $(CPPFLAGS) -c -o $@ $< |
| 104 |
|
| 105 |
.c.pico: |
| 106 |
$(CC) $(CFLAGS) -I. $(CPPFLAGS) $(EXTRA_CFLAGS_PIC) -c -o $@ $< |
| 107 |
|
| 108 |
|
| 109 |
LIBHTS_OBJS = \ |
| 110 |
kfunc.o \ |
| 111 |
knetfile.o \ |
| 112 |
kstring.o \ |
| 113 |
bcf_sr_sort.o \ |
| 114 |
bgzf.o \ |
| 115 |
errmod.o \ |
| 116 |
faidx.o \ |
| 117 |
hfile.o \ |
| 118 |
hfile_net.o \ |
| 119 |
hts.o \ |
| 120 |
hts_os.o\ |
| 121 |
md5.o \ |
| 122 |
multipart.o \ |
| 123 |
probaln.o \ |
| 124 |
realn.o \ |
| 125 |
regidx.o \ |
| 126 |
sam.o \ |
| 127 |
synced_bcf_reader.o \ |
| 128 |
vcf_sweep.o \ |
| 129 |
tbx.o \ |
| 130 |
textutils.o \ |
| 131 |
thread_pool.o \ |
| 132 |
vcf.o \ |
| 133 |
vcfutils.o \ |
| 134 |
cram/cram_codecs.o \ |
| 135 |
cram/cram_decode.o \ |
| 136 |
cram/cram_encode.o \ |
| 137 |
cram/cram_external.o \ |
| 138 |
cram/cram_index.o \ |
| 139 |
cram/cram_io.o \ |
| 140 |
cram/cram_samtools.o \ |
| 141 |
cram/cram_stats.o \ |
| 142 |
cram/files.o \ |
| 143 |
cram/mFILE.o \ |
| 144 |
cram/open_trace_file.o \ |
| 145 |
cram/pooled_alloc.o \ |
| 146 |
cram/rANS_static.o \ |
| 147 |
cram/sam_header.o \ |
| 148 |
cram/string_alloc.o |
| 149 |
|
| 150 |
PLUGIN_EXT = |
| 151 |
PLUGIN_OBJS = |
| 152 |
|
| 153 |
cram_h = cram/cram.h $(cram_samtools_h) $(cram_sam_header_h) $(cram_structs_h) $(cram_io_h) cram/cram_encode.h cram/cram_decode.h cram/cram_stats.h cram/cram_codecs.h cram/cram_index.h $(htslib_cram_h) |
| 154 |
cram_io_h = cram/cram_io.h $(cram_misc_h) |
| 155 |
cram_misc_h = cram/misc.h $(cram_os_h) |
| 156 |
cram_os_h = cram/os.h $(htslib_hts_endian_h) |
| 157 |
cram_sam_header_h = cram/sam_header.h cram/string_alloc.h cram/pooled_alloc.h $(htslib_khash_h) $(htslib_kstring_h) |
| 158 |
cram_samtools_h = cram/cram_samtools.h $(htslib_sam_h) $(cram_sam_header_h) |
| 159 |
cram_structs_h = cram/cram_structs.h $(htslib_thread_pool_h) cram/string_alloc.h cram/mFILE.h $(htslib_khash_h) |
| 160 |
cram_open_trace_file_h = cram/open_trace_file.h cram/mFILE.h |
| 161 |
bcf_sr_sort_h = bcf_sr_sort.h $(htslib_synced_bcf_reader_h) $(htslib_kbitset_h) |
| 162 |
hfile_internal_h = hfile_internal.h $(htslib_hfile_h) $(textutils_internal_h) |
| 163 |
hts_internal_h = hts_internal.h $(htslib_hts_h) $(textutils_internal_h) |
| 164 |
textutils_internal_h = textutils_internal.h $(htslib_kstring_h) |
| 165 |
thread_pool_internal_h = thread_pool_internal.h $(htslib_thread_pool_h) |
| 166 |
|
| 167 |
|
| 168 |
# To be effective, config.mk needs to appear after most Makefile variables are |
| 169 |
# set but before most rules appear, so that it can both use previously-set |
| 170 |
# variables in its own rules' prerequisites and also update variables for use |
| 171 |
# in later rules' prerequisites. |
| 172 |
|
| 173 |
# If your make doesn't accept -include, change this to 'include' if you are |
| 174 |
# using the configure script or just comment the line out if you are not. |
| 175 |
-include config.mk |
| 176 |
|
| 177 |
# Usually config.h is generated by running configure or config.status, |
| 178 |
# but if those aren't used create a default config.h here. |
| 179 |
config.h: |
| 180 |
echo '/* Default config.h generated by Makefile */' > $@ |
| 181 |
echo '#define HAVE_LIBBZ2 1' >> $@ |
| 182 |
echo '#define HAVE_LIBLZMA 1' >> $@ |
| 183 |
echo '#ifndef __APPLE__' >> $@ |
| 184 |
echo '#define HAVE_LZMA_H 1' >> $@ |
| 185 |
echo '#endif' >> $@ |
| 186 |
echo '#define HAVE_FSEEKO 1' >> $@ |
| 187 |
echo '#define HAVE_DRAND48 1' >> $@ |
| 188 |
|
| 189 |
# And similarly for htslib.pc.tmp ("pkg-config template"). No dependency |
| 190 |
# on htslib.pc.in listed, as if that file is newer the usual way to regenerate |
| 191 |
# this target is via configure or config.status rather than this rule. |
| 192 |
htslib.pc.tmp: |
| 193 |
sed -e '/^static_libs=/s/@static_LIBS@/$(htslib_default_libs)/;s#@[^-][^@]*@##g' htslib.pc.in > $@ |
| 194 |
|
| 195 |
# Create a makefile fragment listing the libraries and LDFLAGS needed for |
| 196 |
# static linking. This can be included by projects that want to build |
| 197 |
# and link against the htslib source tree instead of an installed library. |
| 198 |
htslib_static.mk: htslib.pc.tmp |
| 199 |
sed -n '/^static_libs=/s/[^=]*=/HTSLIB_static_LIBS = /p;/^static_ldflags=/s/[^=]*=/HTSLIB_static_LDFLAGS = /p' $< > $@ |
| 200 |
|
| 201 |
|
| 202 |
lib-static: libhts.a |
| 203 |
|
| 204 |
# $(shell), :=, and ifeq/.../endif are GNU Make-specific. If you don't have |
| 205 |
# GNU Make, comment out the parts of these conditionals that don't apply. |
| 206 |
ifneq "$(origin PLATFORM)" "file" |
| 207 |
PLATFORM := $(shell uname -s) |
| 208 |
endif |
| 209 |
ifeq "$(PLATFORM)" "Darwin" |
| 210 |
SHLIB_FLAVOUR = dylib |
| 211 |
lib-shared: libhts.dylib |
| 212 |
else ifeq "$(findstring CYGWIN,$(PLATFORM))" "CYGWIN" |
| 213 |
SHLIB_FLAVOUR = cygdll |
| 214 |
lib-shared: cyghts-$(LIBHTS_SOVERSION).dll |
| 215 |
else ifeq "$(findstring MSYS,$(PLATFORM))" "MSYS" |
| 216 |
SHLIB_FLAVOUR = dll |
| 217 |
lib-shared: hts-$(LIBHTS_SOVERSION).dll |
| 218 |
else |
| 219 |
SHLIB_FLAVOUR = so |
| 220 |
lib-shared: libhts.so |
| 221 |
endif |
| 222 |
|
| 223 |
BUILT_PLUGINS = $(PLUGIN_OBJS:.o=$(PLUGIN_EXT)) |
| 224 |
|
| 225 |
plugins: $(BUILT_PLUGINS) |
| 226 |
|
| 227 |
|
| 228 |
libhts.a: $(LIBHTS_OBJS) |
| 229 |
@-rm -f $@ |
| 230 |
$(AR) -rc $@ $(LIBHTS_OBJS) |
| 231 |
-$(RANLIB) $@ |
| 232 |
|
| 233 |
print-config: |
| 234 |
@echo LDFLAGS = $(LDFLAGS) |
| 235 |
@echo LIBHTS_OBJS = $(LIBHTS_OBJS) |
| 236 |
@echo LIBS = $(LIBS) |
| 237 |
@echo PLATFORM = $(PLATFORM) |
| 238 |
|
| 239 |
# The target here is libhts.so, as that is the built file that other rules |
| 240 |
# depend upon and that is used when -lhts appears in other program's recipes. |
| 241 |
# As a byproduct invisible to make, libhts.so.NN is also created, as it is the |
| 242 |
# file used at runtime (when $LD_LIBRARY_PATH includes the build directory). |
| 243 |
|
| 244 |
libhts.so: $(LIBHTS_OBJS:.o=.pico) |
| 245 |
$(CC) -shared -Wl,-soname,libhts.so.$(LIBHTS_SOVERSION) $(LDFLAGS) -o $@ $(LIBHTS_OBJS:.o=.pico) $(LIBS) -lpthread |
| 246 |
ln -sf $@ libhts.so.$(LIBHTS_SOVERSION) |
| 247 |
|
| 248 |
# Similarly this also creates libhts.NN.dylib as a byproduct, so that programs |
| 249 |
# when run can find this uninstalled shared library (when $DYLD_LIBRARY_PATH |
| 250 |
# includes this project's build directory). |
| 251 |
|
| 252 |
libhts.dylib: $(LIBHTS_OBJS) |
| 253 |
$(CC) -dynamiclib -install_name $(libdir)/libhts.$(LIBHTS_SOVERSION).dylib -current_version $(NUMERIC_VERSION) -compatibility_version $(LIBHTS_SOVERSION) $(LDFLAGS) -o $@ $(LIBHTS_OBJS) $(LIBS) |
| 254 |
ln -sf $@ libhts.$(LIBHTS_SOVERSION).dylib |
| 255 |
|
| 256 |
cyghts-$(LIBHTS_SOVERSION).dll: $(LIBHTS_OBJS) |
| 257 |
$(CC) -shared -Wl,--out-implib=libhts.dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import $(LDFLAGS) -o $@ -Wl,--whole-archive $(LIBHTS_OBJS) -Wl,--no-whole-archive $(LIBS) -lpthread |
| 258 |
|
| 259 |
hts-$(LIBHTS_SOVERSION).dll: $(LIBHTS_OBJS) |
| 260 |
$(CC) -shared -Wl,--out-implib=hts.dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import $(LDFLAGS) -o $@ -Wl,--whole-archive $(LIBHTS_OBJS) -Wl,--no-whole-archive $(LIBS) -lpthread |
| 261 |
|
| 262 |
|
| 263 |
.pico.so: |
| 264 |
$(CC) -shared -Wl,-E $(LDFLAGS) -o $@ $< $(LIBS) -lpthread |
| 265 |
|
| 266 |
.o.bundle: |
| 267 |
$(CC) -bundle -Wl,-undefined,dynamic_lookup $(LDFLAGS) -o $@ $< $(LIBS) |
| 268 |
|
| 269 |
.o.cygdll: |
| 270 |
$(CC) -shared $(LDFLAGS) -o $@ $< libhts.dll.a $(LIBS) |
| 271 |
|
| 272 |
.o.dll: |
| 273 |
$(CC) -shared $(LDFLAGS) -o $@ $< hts.dll.a $(LIBS) |
| 274 |
|
| 275 |
|
| 276 |
bgzf.o bgzf.pico: bgzf.c config.h $(htslib_hts_h) $(htslib_bgzf_h) $(htslib_hfile_h) $(htslib_thread_pool_h) $(htslib_hts_endian_h) cram/pooled_alloc.h $(htslib_khash_h) |
| 277 |
errmod.o errmod.pico: errmod.c config.h $(htslib_hts_h) $(htslib_ksort_h) $(htslib_hts_os_h) |
| 278 |
kstring.o kstring.pico: kstring.c config.h $(htslib_kstring_h) |
| 279 |
knetfile.o knetfile.pico: knetfile.c config.h $(htslib_hts_log_h) $(htslib_knetfile_h) |
| 280 |
hfile.o hfile.pico: hfile.c config.h $(htslib_hfile_h) $(hfile_internal_h) $(hts_internal_h) $(htslib_khash_h) |
| 281 |
hfile_gcs.o hfile_gcs.pico: hfile_gcs.c config.h $(htslib_hts_h) $(htslib_kstring_h) $(hfile_internal_h) |
| 282 |
hfile_libcurl.o hfile_libcurl.pico: hfile_libcurl.c config.h $(hfile_internal_h) $(htslib_hts_h) $(htslib_kstring_h) $(htslib_khash_h) |
| 283 |
hfile_net.o hfile_net.pico: hfile_net.c config.h $(hfile_internal_h) $(htslib_knetfile_h) |
| 284 |
hfile_s3.o hfile_s3.pico: hfile_s3.c config.h $(hfile_internal_h) $(htslib_hts_h) $(htslib_kstring_h) |
| 285 |
hts.o hts.pico: hts.c config.h $(htslib_hts_h) $(htslib_bgzf_h) $(cram_h) $(htslib_hfile_h) $(htslib_hts_endian_h) version.h $(hts_internal_h) $(hfile_internal_h) $(htslib_hts_os_h) $(htslib_khash_h) $(htslib_kseq_h) $(htslib_ksort_h) |
| 286 |
hts_os.o hts_os.pico: hts_os.c config.h os/rand.c |
| 287 |
vcf.o vcf.pico: vcf.c config.h $(htslib_vcf_h) $(htslib_bgzf_h) $(htslib_tbx_h) $(htslib_hfile_h) $(hts_internal_h) $(htslib_khash_str2int_h) $(htslib_kstring_h) $(htslib_khash_h) $(htslib_kseq_h) $(htslib_hts_endian_h) |
| 288 |
sam.o sam.pico: sam.c config.h $(htslib_sam_h) $(htslib_bgzf_h) $(cram_h) $(hts_internal_h) $(htslib_hfile_h) $(htslib_khash_h) $(htslib_kseq_h) $(htslib_kstring_h) $(htslib_hts_endian_h) |
| 289 |
tbx.o tbx.pico: tbx.c config.h $(htslib_tbx_h) $(htslib_bgzf_h) $(htslib_hts_endian_h) $(hts_internal_h) $(htslib_khash_h) |
| 290 |
faidx.o faidx.pico: faidx.c config.h $(htslib_bgzf_h) $(htslib_faidx_h) $(htslib_hfile_h) $(htslib_khash_h) $(htslib_kstring_h) $(hts_internal_h) |
| 291 |
bcf_sr_sort.o bcf_sr_sort.pico: bcf_sr_sort.c config.h $(bcf_sr_sort_h) $(htslib_khash_str2int_h) |
| 292 |
synced_bcf_reader.o synced_bcf_reader.pico: synced_bcf_reader.c config.h $(htslib_synced_bcf_reader_h) $(htslib_kseq_h) $(htslib_khash_str2int_h) $(htslib_bgzf_h) $(htslib_thread_pool_h) $(bcf_sr_sort_h) |
| 293 |
vcf_sweep.o vcf_sweep.pico: vcf_sweep.c config.h $(htslib_vcf_sweep_h) $(htslib_bgzf_h) |
| 294 |
vcfutils.o vcfutils.pico: vcfutils.c config.h $(htslib_vcfutils_h) $(htslib_kbitset_h) |
| 295 |
kfunc.o kfunc.pico: kfunc.c config.h $(htslib_kfunc_h) |
| 296 |
regidx.o regidx.pico: regidx.c config.h $(htslib_hts_h) $(htslib_kstring_h) $(htslib_kseq_h) $(htslib_khash_str2int_h) $(htslib_regidx_h) $(hts_internal_h) |
| 297 |
md5.o md5.pico: md5.c config.h $(htslib_hts_h) $(htslib_hts_endian_h) |
| 298 |
multipart.o multipart.pico: multipart.c config.h $(htslib_kstring_h) $(hts_internal_h) $(hfile_internal_h) |
| 299 |
plugin.o plugin.pico: plugin.c config.h $(hts_internal_h) $(htslib_kstring_h) |
| 300 |
probaln.o probaln.pico: probaln.c config.h $(htslib_hts_h) |
| 301 |
realn.o realn.pico: realn.c config.h $(htslib_hts_h) $(htslib_sam_h) |
| 302 |
textutils.o textutils.pico: textutils.c config.h $(htslib_hfile_h) $(htslib_kstring_h) $(hts_internal_h) |
| 303 |
|
| 304 |
cram/cram_codecs.o cram/cram_codecs.pico: cram/cram_codecs.c config.h $(cram_h) |
| 305 |
cram/cram_decode.o cram/cram_decode.pico: cram/cram_decode.c config.h $(cram_h) $(cram_os_h) $(htslib_hts_h) |
| 306 |
cram/cram_encode.o cram/cram_encode.pico: cram/cram_encode.c config.h $(cram_h) $(cram_os_h) $(htslib_hts_h) $(htslib_hts_endian_h) |
| 307 |
cram/cram_external.o cram/cram_external.pico: cram/cram_external.c config.h $(htslib_hfile_h) $(cram_h) |
| 308 |
cram/cram_index.o cram/cram_index.pico: cram/cram_index.c config.h $(htslib_bgzf_h) $(htslib_hfile_h) $(hts_internal_h) $(cram_h) $(cram_os_h) |
| 309 |
cram/cram_io.o cram/cram_io.pico: cram/cram_io.c config.h os/lzma_stub.h $(cram_h) $(cram_os_h) $(htslib_hts_h) $(cram_open_trace_file_h) cram/rANS_static.h $(htslib_hfile_h) $(htslib_bgzf_h) $(htslib_faidx_h) $(hts_internal_h) |
| 310 |
cram/cram_samtools.o cram/cram_samtools.pico: cram/cram_samtools.c config.h $(cram_h) $(htslib_sam_h) |
| 311 |
cram/cram_stats.o cram/cram_stats.pico: cram/cram_stats.c config.h $(cram_h) $(cram_os_h) |
| 312 |
cram/files.o cram/files.pico: cram/files.c config.h $(cram_misc_h) |
| 313 |
cram/mFILE.o cram/mFILE.pico: cram/mFILE.c config.h $(htslib_hts_log_h) $(cram_os_h) cram/mFILE.h |
| 314 |
cram/open_trace_file.o cram/open_trace_file.pico: cram/open_trace_file.c config.h $(cram_os_h) $(cram_open_trace_file_h) $(cram_misc_h) $(htslib_hfile_h) $(htslib_hts_log_h) |
| 315 |
cram/pooled_alloc.o cram/pooled_alloc.pico: cram/pooled_alloc.c config.h cram/pooled_alloc.h $(cram_misc_h) |
| 316 |
cram/rANS_static.o cram/rANS_static.pico: cram/rANS_static.c config.h cram/rANS_static.h cram/rANS_byte.h |
| 317 |
cram/sam_header.o cram/sam_header.pico: cram/sam_header.c config.h $(htslib_hts_log_h) $(cram_sam_header_h) cram/string_alloc.h |
| 318 |
cram/string_alloc.o cram/string_alloc.pico: cram/string_alloc.c config.h cram/string_alloc.h |
| 319 |
thread_pool.o thread_pool.pico: thread_pool.c config.h $(thread_pool_internal_h) |
| 320 |
|
| 321 |
|
| 322 |
bgzip: bgzip.o libhts.a |
| 323 |
$(CC) $(LDFLAGS) -o $@ bgzip.o libhts.a $(LIBS) -lpthread |
| 324 |
|
| 325 |
htsfile: htsfile.o libhts.a |
| 326 |
$(CC) $(LDFLAGS) -o $@ htsfile.o libhts.a $(LIBS) -lpthread |
| 327 |
|
| 328 |
tabix: tabix.o libhts.a |
| 329 |
$(CC) $(LDFLAGS) -o $@ tabix.o libhts.a $(LIBS) -lpthread |
| 330 |
|
| 331 |
bgzip.o: bgzip.c config.h $(htslib_bgzf_h) $(htslib_hts_h) |
| 332 |
htsfile.o: htsfile.c config.h $(htslib_hfile_h) $(htslib_hts_h) $(htslib_sam_h) $(htslib_vcf_h) |
| 333 |
tabix.o: tabix.c config.h $(htslib_tbx_h) $(htslib_sam_h) $(htslib_vcf_h) $(htslib_kseq_h) $(htslib_bgzf_h) $(htslib_hts_h) $(htslib_regidx_h) |
| 334 |
|
| 335 |
|
| 336 |
# For tests that might use it, set $REF_PATH explicitly to use only reference |
| 337 |
# areas within the test suite (or set it to ':' to use no reference areas). |
| 338 |
# |
| 339 |
# If using MSYS, avoid poor shell expansion via: |
| 340 |
# MSYS2_ARG_CONV_EXCL="*" make check |
| 341 |
check test: $(BUILT_PROGRAMS) $(BUILT_TEST_PROGRAMS) |
| 342 |
|
| 343 |
install: libhts.a $(BUILT_PROGRAMS) $(BUILT_PLUGINS) installdirs install-$(SHLIB_FLAVOUR) install-pkgconfig |
| 344 |
$(INSTALL_PROGRAM) $(BUILT_PROGRAMS) $(DESTDIR)$(bindir) |
| 345 |
if test -n "$(BUILT_PLUGINS)"; then $(INSTALL_PROGRAM) $(BUILT_PLUGINS) $(DESTDIR)$(plugindir); fi |
| 346 |
$(INSTALL_DATA) htslib/*.h $(DESTDIR)$(includedir)/htslib |
| 347 |
$(INSTALL_DATA) libhts.a $(DESTDIR)$(libdir)/libhts.a |
| 348 |
$(INSTALL_MAN) bgzip.1 htsfile.1 tabix.1 $(DESTDIR)$(man1dir) |
| 349 |
$(INSTALL_MAN) faidx.5 sam.5 vcf.5 $(DESTDIR)$(man5dir) |
| 350 |
|
| 351 |
installdirs: |
| 352 |
$(INSTALL_DIR) $(DESTDIR)$(bindir) $(DESTDIR)$(includedir) $(DESTDIR)$(includedir)/htslib $(DESTDIR)$(libdir) $(DESTDIR)$(man1dir) $(DESTDIR)$(man5dir) $(DESTDIR)$(pkgconfigdir) |
| 353 |
if test -n "$(plugindir)"; then $(INSTALL_DIR) $(DESTDIR)$(plugindir); fi |
| 354 |
|
| 355 |
# After installation, the real file in $(libdir) will be libhts.so.X.Y.Z, |
| 356 |
# with symlinks libhts.so (used via -lhts during linking of client programs) |
| 357 |
# and libhts.so.NN (used by client executables at runtime). |
| 358 |
|
| 359 |
install-so: libhts.so installdirs |
| 360 |
$(INSTALL_LIB) libhts.so $(DESTDIR)$(libdir)/libhts.so.$(PACKAGE_VERSION) |
| 361 |
ln -sf libhts.so.$(PACKAGE_VERSION) $(DESTDIR)$(libdir)/libhts.so |
| 362 |
ln -sf libhts.so.$(PACKAGE_VERSION) $(DESTDIR)$(libdir)/libhts.so.$(LIBHTS_SOVERSION) |
| 363 |
|
| 364 |
install-cygdll: cyghts-$(LIBHTS_SOVERSION).dll installdirs |
| 365 |
$(INSTALL_PROGRAM) cyghts-$(LIBHTS_SOVERSION).dll $(DESTDIR)$(bindir)/cyghts-$(LIBHTS_SOVERSION).dll |
| 366 |
$(INSTALL_PROGRAM) libhts.dll.a $(DESTDIR)$(libdir)/libhts.dll.a |
| 367 |
|
| 368 |
install-dll: hts-$(LIBHTS_SOVERSION).dll installdirs |
| 369 |
$(INSTALL_PROGRAM) hts-$(LIBHTS_SOVERSION).dll $(DESTDIR)$(bindir)/hts-$(LIBHTS_SOVERSION).dll |
| 370 |
$(INSTALL_PROGRAM) hts.dll.a $(DESTDIR)$(libdir)/hts.dll.a |
| 371 |
|
| 372 |
install-dylib: libhts.dylib installdirs |
| 373 |
$(INSTALL_PROGRAM) libhts.dylib $(DESTDIR)$(libdir)/libhts.$(PACKAGE_VERSION).dylib |
| 374 |
ln -sf libhts.$(PACKAGE_VERSION).dylib $(DESTDIR)$(libdir)/libhts.dylib |
| 375 |
ln -sf libhts.$(PACKAGE_VERSION).dylib $(DESTDIR)$(libdir)/libhts.$(LIBHTS_SOVERSION).dylib |
| 376 |
|
| 377 |
# Substitute these pseudo-autoconf variables only at install time |
| 378 |
# so that "make install prefix=/prefix/path" etc continue to work. |
| 379 |
install-pkgconfig: htslib.pc.tmp installdirs |
| 380 |
sed -e 's#@-includedir@#$(includedir)#g;s#@-libdir@#$(libdir)#g;s#@-PACKAGE_VERSION@#$(PACKAGE_VERSION)#g' htslib.pc.tmp > $(DESTDIR)$(pkgconfigdir)/htslib.pc |
| 381 |
chmod 644 $(DESTDIR)$(pkgconfigdir)/htslib.pc |
| 382 |
|
| 383 |
# A pkg-config file (suitable for copying to $PKG_CONFIG_PATH) that provides |
| 384 |
# flags for building against the uninstalled library in this build directory. |
| 385 |
htslib-uninstalled.pc: htslib.pc.tmp |
| 386 |
sed -e 's#@-includedir@#'`pwd`'#g;s#@-libdir@#'`pwd`'#g' htslib.pc.tmp > $@ |
| 387 |
|
| 388 |
|
| 389 |
testclean: |
| 390 |
-rm -f test/*.tmp test/*.tmp.* test/tabix/*.tmp.* test/tabix/FAIL* |
| 391 |
|
| 392 |
mostlyclean: testclean |
| 393 |
-rm -f *.o *.pico cram/*.o cram/*.pico test/*.o test/*.dSYM version.h |
| 394 |
|
| 395 |
clean: mostlyclean clean-$(SHLIB_FLAVOUR) |
| 396 |
-rm -f libhts.a $(BUILT_PROGRAMS) $(BUILT_PLUGINS) $(BUILT_TEST_PROGRAMS) $(BUILT_THRASH_PROGRAMS) |
| 397 |
|
| 398 |
distclean maintainer-clean: clean |
| 399 |
-rm -f config.cache config.h config.log config.mk config.status |
| 400 |
-rm -f TAGS *.pc.tmp *-uninstalled.pc htslib_static.mk |
| 401 |
-rm -rf autom4te.cache |
| 402 |
|
| 403 |
clean-so: |
| 404 |
-rm -f libhts.so libhts.so.* |
| 405 |
|
| 406 |
clean-cygdll: |
| 407 |
-rm -f cyghts-*.dll libhts.dll.a |
| 408 |
|
| 409 |
clean-dll: |
| 410 |
-rm -f hts-*.dll hts.dll.a |
| 411 |
|
| 412 |
clean-dylib: |
| 413 |
-rm -f libhts.dylib libhts.*.dylib |
| 414 |
|
| 415 |
|
| 416 |
tags TAGS: |
| 417 |
ctags -f TAGS *.[ch] cram/*.[ch] htslib/*.h |
| 418 |
|
| 419 |
# We recommend libhts-using programs be built against a separate htslib |
| 420 |
# installation. However if you feel that you must bundle htslib source |
| 421 |
# code with your program, this hook enables Automake-style "make dist" |
| 422 |
# for this subdirectory. If you do bundle an htslib snapshot, please |
| 423 |
# add identifying information to $(PACKAGE_VERSION) as appropriate. |
| 424 |
# (The wildcards attempt to omit non-exported files (.git*, README.md, |
| 425 |
# etc) and other detritus that might be in the top-level directory.) |
| 426 |
distdir: |
| 427 |
@if [ -z "$(distdir)" ]; then echo "Please supply a distdir=DIR argument."; false; fi |
| 428 |
tar -c *.[ch15] [ILMNRchtv]*[ELSbcekmnth] | (cd $(distdir) && tar -x) |
| 429 |
+cd $(distdir) && $(MAKE) distclean |
| 430 |
|
| 431 |
force: |
| 432 |
|
| 433 |
|
| 434 |
.PHONY: all check clean distclean distdir force |
| 435 |
.PHONY: install install-pkgconfig installdirs lib-shared lib-static |
| 436 |
.PHONY: maintainer-clean mostlyclean plugins print-config print-version |
| 437 |
.PHONY: show-version tags test testclean |
| 438 |
.PHONY: clean-so install-so |
| 439 |
.PHONY: clean-cygdll install-cygdll |
| 440 |
.PHONY: clean-dll install-dll |
| 441 |
.PHONY: clean-dylib install-dylib |