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 <jm18@sanger.ac.uk> 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 25CC = gcc 26AR = ar 27RANLIB = ranlib 28 29# Default libraries to link if configure is not used 30htslib_default_libs = -lz -lm -lbz2 -llzma 31 32CPPFLAGS = 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__ 36CFLAGS = -g -Wall -O2 37EXTRA_CFLAGS_PIC = -fpic 38LDFLAGS = 39LIBS = $(htslib_default_libs) 40 41prefix = /usr/local 42exec_prefix = $(prefix) 43bindir = $(exec_prefix)/bin 44includedir = $(prefix)/include 45libdir = $(exec_prefix)/lib 46libexecdir = $(exec_prefix)/libexec 47datarootdir = $(prefix)/share 48mandir = $(datarootdir)/man 49man1dir = $(mandir)/man1 50man5dir = $(mandir)/man5 51pkgconfigdir= $(libdir)/pkgconfig 52 53MKDIR_P = mkdir -p 54INSTALL = install -p 55INSTALL_DATA = $(INSTALL) -m 644 56INSTALL_DIR = $(MKDIR_P) -m 755 57INSTALL_LIB = $(INSTALL_DATA) 58INSTALL_MAN = $(INSTALL_DATA) 59INSTALL_PROGRAM = $(INSTALL) 60 61# Set by config.mk if plugins are enabled 62plugindir = 63 64BUILT_PROGRAMS = \ 65 bgzip \ 66 htsfile \ 67 tabix 68 69BUILT_TEST_PROGRAMS = \ 70 test/hts_endian \ 71 test/fieldarith \ 72 test/hfile \ 73 test/sam \ 74 test/test_bgzf \ 75 test/test_realn \ 76 test/test-regidx \ 77 test/test_view \ 78 test/test-vcf-api \ 79 test/test-vcf-sweep \ 80 test/test-bcf-sr \ 81 test/test-bcf-translate 82 83BUILT_THRASH_PROGRAMS = \ 84 test/thrash_threads1 \ 85 test/thrash_threads2 \ 86 test/thrash_threads3 \ 87 test/thrash_threads4 \ 88 test/thrash_threads5 \ 89 test/thrash_threads6 90 91all: lib-static lib-shared $(BUILT_PROGRAMS) plugins $(BUILT_TEST_PROGRAMS) 92 93HTSPREFIX = 94include htslib_vars.mk 95 96# If not using GNU make, you need to copy the version number from version.sh 97# into here. 98PACKAGE_VERSION := $(shell ./version.sh) 99LIBHTS_SOVERSION = 2 100 101# $(NUMERIC_VERSION) is for items that must have a numeric X.Y.Z string 102# even if this is a dirty or untagged Git working tree. 103NUMERIC_VERSION := $(shell ./version.sh numeric) 104 105# Force version.h to be remade if $(PACKAGE_VERSION) has changed. 106version.h: $(if $(wildcard version.h),$(if $(findstring "$(PACKAGE_VERSION)",$(shell cat version.h)),,force)) 107 108version.h: 109 echo '#define HTS_VERSION "$(PACKAGE_VERSION)"' > $@ 110 111print-version: 112 @echo $(PACKAGE_VERSION) 113 114show-version: 115 @echo PACKAGE_VERSION = $(PACKAGE_VERSION) 116 @echo NUMERIC_VERSION = $(NUMERIC_VERSION) 117 118.SUFFIXES: .bundle .c .cygdll .dll .o .pico .so 119 120.c.o: 121 $(CC) $(CFLAGS) -I. $(CPPFLAGS) -c -o $@ $< 122 123.c.pico: 124 $(CC) $(CFLAGS) -I. $(CPPFLAGS) $(EXTRA_CFLAGS_PIC) -c -o $@ $< 125 126 127LIBHTS_OBJS = \ 128 kfunc.o \ 129 knetfile.o \ 130 kstring.o \ 131 bcf_sr_sort.o \ 132 bgzf.o \ 133 errmod.o \ 134 faidx.o \ 135 hfile.o \ 136 hfile_net.o \ 137 hts.o \ 138 hts_os.o\ 139 md5.o \ 140 multipart.o \ 141 probaln.o \ 142 realn.o \ 143 regidx.o \ 144 sam.o \ 145 synced_bcf_reader.o \ 146 vcf_sweep.o \ 147 tbx.o \ 148 textutils.o \ 149 thread_pool.o \ 150 vcf.o \ 151 vcfutils.o \ 152 cram/cram_codecs.o \ 153 cram/cram_decode.o \ 154 cram/cram_encode.o \ 155 cram/cram_external.o \ 156 cram/cram_index.o \ 157 cram/cram_io.o \ 158 cram/cram_samtools.o \ 159 cram/cram_stats.o \ 160 cram/files.o \ 161 cram/mFILE.o \ 162 cram/open_trace_file.o \ 163 cram/pooled_alloc.o \ 164 cram/rANS_static.o \ 165 cram/sam_header.o \ 166 cram/string_alloc.o 167 168PLUGIN_EXT = 169PLUGIN_OBJS = 170 171cram_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) 172cram_io_h = cram/cram_io.h $(cram_misc_h) 173cram_misc_h = cram/misc.h $(cram_os_h) 174cram_os_h = cram/os.h $(htslib_hts_endian_h) 175cram_sam_header_h = cram/sam_header.h cram/string_alloc.h cram/pooled_alloc.h $(htslib_khash_h) $(htslib_kstring_h) 176cram_samtools_h = cram/cram_samtools.h $(htslib_sam_h) $(cram_sam_header_h) 177cram_structs_h = cram/cram_structs.h $(htslib_thread_pool_h) cram/string_alloc.h $(htslib_khash_h) 178cram_open_trace_file_h = cram/open_trace_file.h cram/mFILE.h 179hfile_internal_h = hfile_internal.h $(htslib_hfile_h) $(textutils_internal_h) 180hts_internal_h = hts_internal.h $(htslib_hts_h) $(textutils_internal_h) 181textutils_internal_h = textutils_internal.h $(htslib_kstring_h) 182thread_pool_internal_h = thread_pool_internal.h $(htslib_thread_pool_h) 183 184 185# To be effective, config.mk needs to appear after most Makefile variables are 186# set but before most rules appear, so that it can both use previously-set 187# variables in its own rules' prerequisites and also update variables for use 188# in later rules' prerequisites. 189 190# If your make doesn't accept -include, change this to 'include' if you are 191# using the configure script or just comment the line out if you are not. 192-include config.mk 193 194# Usually config.h is generated by running configure or config.status, 195# but if those aren't used create a default config.h here. 196config.h: 197 echo '/* Default config.h generated by Makefile */' > $@ 198 echo '#define HAVE_LIBBZ2 1' >> $@ 199 echo '#define HAVE_LIBLZMA 1' >> $@ 200 echo '#define HAVE_LZMA_H 1' >> $@ 201 echo '#define HAVE_FSEEKO 1' >> $@ 202 echo '#define HAVE_DRAND48 1' >> $@ 203 204# And similarly for htslib.pc.tmp ("pkg-config template"). No dependency 205# on htslib.pc.in listed, as if that file is newer the usual way to regenerate 206# this target is via configure or config.status rather than this rule. 207htslib.pc.tmp: 208 sed -e '/^static_libs=/s/@static_LIBS@/$(htslib_default_libs)/;s#@[^-][^@]*@##g' htslib.pc.in > $@ 209 210# Create a makefile fragment listing the libraries and LDFLAGS needed for 211# static linking. This can be included by projects that want to build 212# and link against the htslib source tree instead of an installed library. 213htslib_static.mk: htslib.pc.tmp 214 sed -n '/^static_libs=/s/[^=]*=/HTSLIB_static_LIBS = /p;/^static_ldflags=/s/[^=]*=/HTSLIB_static_LDFLAGS = /p' $< > $@ 215 216 217lib-static: libhts.a 218 219# $(shell), :=, and ifeq/.../endif are GNU Make-specific. If you don't have 220# GNU Make, comment out the parts of these conditionals that don't apply. 221ifneq "$(origin PLATFORM)" "file" 222PLATFORM := $(shell uname -s) 223endif 224ifeq "$(PLATFORM)" "Darwin" 225SHLIB_FLAVOUR = dylib 226lib-shared: libhts.dylib 227else ifeq "$(findstring CYGWIN,$(PLATFORM))" "CYGWIN" 228SHLIB_FLAVOUR = cygdll 229lib-shared: cyghts-$(LIBHTS_SOVERSION).dll 230else ifeq "$(findstring MSYS,$(PLATFORM))" "MSYS" 231SHLIB_FLAVOUR = dll 232lib-shared: hts-$(LIBHTS_SOVERSION).dll 233else 234SHLIB_FLAVOUR = so 235lib-shared: libhts.so 236endif 237 238BUILT_PLUGINS = $(PLUGIN_OBJS:.o=$(PLUGIN_EXT)) 239 240plugins: $(BUILT_PLUGINS) 241 242 243libhts.a: $(LIBHTS_OBJS) 244 @-rm -f $@ 245 $(AR) -rc $@ $(LIBHTS_OBJS) 246 -$(RANLIB) $@ 247 248print-config: 249 @echo LDFLAGS = $(LDFLAGS) 250 @echo LIBHTS_OBJS = $(LIBHTS_OBJS) 251 @echo LIBS = $(LIBS) 252 @echo PLATFORM = $(PLATFORM) 253 254# The target here is libhts.so, as that is the built file that other rules 255# depend upon and that is used when -lhts appears in other program's recipes. 256# As a byproduct invisible to make, libhts.so.NN is also created, as it is the 257# file used at runtime (when $LD_LIBRARY_PATH includes the build directory). 258 259libhts.so: $(LIBHTS_OBJS:.o=.pico) 260 $(CC) -shared -Wl,-soname,libhts.so.$(LIBHTS_SOVERSION) $(LDFLAGS) -o $@ $(LIBHTS_OBJS:.o=.pico) $(LIBS) -lpthread 261 ln -sf $@ libhts.so.$(LIBHTS_SOVERSION) 262 263# Similarly this also creates libhts.NN.dylib as a byproduct, so that programs 264# when run can find this uninstalled shared library (when $DYLD_LIBRARY_PATH 265# includes this project's build directory). 266 267libhts.dylib: $(LIBHTS_OBJS) 268 $(CC) -dynamiclib -install_name $(libdir)/libhts.$(LIBHTS_SOVERSION).dylib -current_version $(NUMERIC_VERSION) -compatibility_version $(LIBHTS_SOVERSION) $(LDFLAGS) -o $@ $(LIBHTS_OBJS) $(LIBS) 269 ln -sf $@ libhts.$(LIBHTS_SOVERSION).dylib 270 271cyghts-$(LIBHTS_SOVERSION).dll: $(LIBHTS_OBJS) 272 $(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 273 274hts-$(LIBHTS_SOVERSION).dll: $(LIBHTS_OBJS) 275 $(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 276 277 278.pico.so: 279 $(CC) -shared -Wl,-E $(LDFLAGS) -o $@ $< $(LIBS) -lpthread 280 281.o.bundle: 282 $(CC) -bundle -Wl,-undefined,dynamic_lookup $(LDFLAGS) -o $@ $< $(LIBS) 283 284.o.cygdll: 285 $(CC) -shared $(LDFLAGS) -o $@ $< libhts.dll.a $(LIBS) 286 287.o.dll: 288 $(CC) -shared $(LDFLAGS) -o $@ $< hts.dll.a $(LIBS) 289 290 291bgzf.o bgzf.pico: bgzf.c config.h $(htslib_hts_h) $(htslib_bgzf_h) $(htslib_hfile_h) $(htslib_thread_pool_h) cram/pooled_alloc.h $(htslib_khash_h) 292errmod.o errmod.pico: errmod.c config.h $(htslib_hts_h) $(htslib_ksort_h) 293kstring.o kstring.pico: kstring.c config.h $(htslib_kstring_h) 294knetfile.o knetfile.pico: knetfile.c config.h $(htslib_hts_log_h) $(htslib_knetfile_h) 295hfile.o hfile.pico: hfile.c config.h $(htslib_hfile_h) $(hfile_internal_h) $(hts_internal_h) $(htslib_khash_h) 296hfile_gcs.o hfile_gcs.pico: hfile_gcs.c config.h $(htslib_hts_h) $(htslib_kstring_h) $(hfile_internal_h) 297hfile_libcurl.o hfile_libcurl.pico: hfile_libcurl.c config.h $(hfile_internal_h) $(htslib_hts_h) $(htslib_kstring_h) 298hfile_net.o hfile_net.pico: hfile_net.c config.h $(hfile_internal_h) $(htslib_knetfile_h) 299hfile_s3.o hfile_s3.pico: hfile_s3.c config.h $(hfile_internal_h) $(htslib_hts_h) $(htslib_kstring_h) 300hts.o hts.pico: hts.c config.h $(htslib_hts_h) $(htslib_bgzf_h) $(cram_h) $(hfile_internal_h) $(htslib_hfile_h) version.h $(hts_internal_h) $(htslib_khash_h) $(htslib_kseq_h) $(htslib_ksort_h) 301hts_os.o hts_os.pico: hts_os.c config.h os/rand.c 302vcf.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) 303sam.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) 304tbx.o tbx.pico: tbx.c config.h $(htslib_tbx_h) $(htslib_bgzf_h) $(hts_internal_h) $(htslib_khash_h) 305faidx.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) 306bcf_sr_sort.o bcf_sr_sort.pico: bcf_sr_sort.c config.h bcf_sr_sort.h $(htslib_kseq_h) $(htslib_khash_str2int_h) 307synced_bcf_reader.o synced_bcf_reader.pico: synced_bcf_reader.c config.h bcf_sr_sort.h $(htslib_synced_bcf_reader_h) $(htslib_kseq_h) $(htslib_khash_str2int_h) $(htslib_bgzf_h) $(htslib_thread_pool_h) 308vcf_sweep.o vcf_sweep.pico: vcf_sweep.c config.h $(htslib_vcf_sweep_h) $(htslib_bgzf_h) 309vcfutils.o vcfutils.pico: vcfutils.c config.h $(htslib_vcfutils_h) $(htslib_kbitset_h) 310kfunc.o kfunc.pico: kfunc.c config.h $(htslib_kfunc_h) 311regidx.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) 312md5.o md5.pico: md5.c config.h $(htslib_hts_h) $(htslib_hts_endian_h) 313multipart.o multipart.pico: multipart.c config.h $(htslib_kstring_h) $(hts_internal_h) $(hfile_internal_h) 314plugin.o plugin.pico: plugin.c config.h $(hts_internal_h) $(htslib_kstring_h) 315probaln.o probaln.pico: probaln.c config.h $(htslib_hts_h) 316realn.o realn.pico: realn.c config.h $(htslib_hts_h) $(htslib_sam_h) 317textutils.o textutils.pico: textutils.c config.h $(htslib_hfile_h) $(htslib_kstring_h) $(hts_internal_h) 318 319cram/cram_codecs.o cram/cram_codecs.pico: cram/cram_codecs.c config.h $(cram_h) 320cram/cram_decode.o cram/cram_decode.pico: cram/cram_decode.c config.h $(cram_h) $(cram_os_h) $(htslib_hts_h) 321cram/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) 322cram/cram_external.o cram/cram_external.pico: cram/cram_external.c config.h $(htslib_hfile_h) $(cram_h) 323cram/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) 324cram/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) 325cram/cram_samtools.o cram/cram_samtools.pico: cram/cram_samtools.c config.h $(cram_h) $(htslib_sam_h) 326cram/cram_stats.o cram/cram_stats.pico: cram/cram_stats.c config.h $(cram_h) $(cram_os_h) 327cram/files.o cram/files.pico: cram/files.c config.h $(cram_misc_h) 328cram/mFILE.o cram/mFILE.pico: cram/mFILE.c config.h $(cram_os_h) cram/mFILE.h 329cram/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) 330cram/pooled_alloc.o cram/pooled_alloc.pico: cram/pooled_alloc.c config.h cram/pooled_alloc.h $(cram_misc_h) 331cram/rANS_static.o cram/rANS_static.pico: cram/rANS_static.c config.h cram/rANS_static.h cram/rANS_byte.h 332cram/sam_header.o cram/sam_header.pico: cram/sam_header.c config.h $(cram_sam_header_h) cram/string_alloc.h 333cram/string_alloc.o cram/string_alloc.pico: cram/string_alloc.c config.h cram/string_alloc.h 334thread_pool.o thread_pool.pico: thread_pool.c config.h $(thread_pool_internal_h) 335 336 337bgzip: bgzip.o libhts.a 338 $(CC) $(LDFLAGS) -o $@ bgzip.o libhts.a $(LIBS) -lpthread 339 340htsfile: htsfile.o libhts.a 341 $(CC) $(LDFLAGS) -o $@ htsfile.o libhts.a $(LIBS) -lpthread 342 343tabix: tabix.o libhts.a 344 $(CC) $(LDFLAGS) -o $@ tabix.o libhts.a $(LIBS) -lpthread 345 346bgzip.o: bgzip.c config.h $(htslib_bgzf_h) $(htslib_hts_h) 347htsfile.o: htsfile.c config.h $(htslib_hfile_h) $(htslib_hts_h) $(htslib_sam_h) $(htslib_vcf_h) 348tabix.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) 349 350 351# For tests that might use it, set $REF_PATH explicitly to use only reference 352# areas within the test suite (or set it to ':' to use no reference areas). 353# 354# If using MSYS, avoid poor shell expansion via: 355# MSYS2_ARG_CONV_EXCL="*" make check 356check test: $(BUILT_PROGRAMS) $(BUILT_TEST_PROGRAMS) 357 test/hts_endian 358 test/fieldarith test/fieldarith.sam 359 test/hfile 360 test/test_bgzf test/bgziptest.txt 361 cd test/tabix && ./test-tabix.sh tabix.tst 362 REF_PATH=: test/sam test/ce.fa test/faidx.fa 363 test/test-regidx 364 cd test && REF_PATH=: ./test.pl $${TEST_OPTS:-} 365 366test/hts_endian: test/hts_endian.o 367 $(CC) $(LDFLAGS) -o $@ test/hts_endian.o $(LIBS) 368 369test/fieldarith: test/fieldarith.o libhts.a 370 $(CC) $(LDFLAGS) -o $@ test/fieldarith.o libhts.a $(LIBS) -lpthread 371 372test/hfile: test/hfile.o libhts.a 373 $(CC) $(LDFLAGS) -o $@ test/hfile.o libhts.a $(LIBS) -lpthread 374 375test/sam: test/sam.o libhts.a 376 $(CC) $(LDFLAGS) -o $@ test/sam.o libhts.a $(LIBS) -lpthread 377 378test/test_bgzf: test/test_bgzf.o libhts.a 379 $(CC) $(LDFLAGS) -o $@ test/test_bgzf.o libhts.a -lz $(LIBS) -lpthread 380 381test/test_realn: test/test_realn.o libhts.a 382 $(CC) $(LDFLAGS) -o $@ test/test_realn.o libhts.a $(LIBS) -lpthread 383 384test/test-regidx: test/test-regidx.o libhts.a 385 $(CC) $(LDFLAGS) -o $@ test/test-regidx.o libhts.a $(LIBS) -lpthread 386 387test/test_view: test/test_view.o libhts.a 388 $(CC) $(LDFLAGS) -o $@ test/test_view.o libhts.a $(LIBS) -lpthread 389 390test/test-vcf-api: test/test-vcf-api.o libhts.a 391 $(CC) $(LDFLAGS) -o $@ test/test-vcf-api.o libhts.a $(LIBS) -lpthread 392 393test/test-vcf-sweep: test/test-vcf-sweep.o libhts.a 394 $(CC) $(LDFLAGS) -o $@ test/test-vcf-sweep.o libhts.a $(LIBS) -lpthread 395 396test/test-bcf-sr: test/test-bcf-sr.o libhts.a 397 $(CC) $(LDFLAGS) -o $@ test/test-bcf-sr.o libhts.a -lz $(LIBS) -lpthread 398 399test/test-bcf-translate: test/test-bcf-translate.o libhts.a 400 $(CC) $(LDFLAGS) -o $@ test/test-bcf-translate.o libhts.a -lz $(LIBS) -lpthread 401 402test/hts_endian.o: test/hts_endian.c $(htslib_hts_endian_h) 403test/fieldarith.o: test/fieldarith.c config.h $(htslib_sam_h) 404test/hfile.o: test/hfile.c config.h $(htslib_hfile_h) $(htslib_hts_defs_h) 405test/sam.o: test/sam.c config.h $(htslib_hts_defs_h) $(htslib_sam_h) $(htslib_faidx_h) $(htslib_kstring_h) 406test/test_bgzf.o: test/test_bgzf.c $(htslib_bgzf_h) $(htslib_hfile_h) 407test/test-realn.o: test/test_realn.c $(htslib_hts_h) $(htslib_sam_h) $(htslib_faidx_h) 408test/test-regidx.o: test/test-regidx.c config.h $(htslib_regidx_h) $(hts_internal_h) 409test/test_view.o: test/test_view.c config.h $(cram_h) $(htslib_sam_h) 410test/test-vcf-api.o: test/test-vcf-api.c config.h $(htslib_hts_h) $(htslib_vcf_h) $(htslib_kstring_h) $(htslib_kseq_h) 411test/test-vcf-sweep.o: test/test-vcf-sweep.c config.h $(htslib_vcf_sweep_h) 412test/test-bcf-sr.o: test/test-bcf-sr.c config.h $(htslib_vcf_sweep_h) bcf_sr_sort.h 413test/test-bcf-translate.o: test/test-bcf-translate.c config.h 414 415 416test/thrash_threads1: test/thrash_threads1.o libhts.a 417 $(CC) $(LDFLAGS) -o $@ test/thrash_threads1.o libhts.a -lz $(LIBS) -lpthread 418 419test/thrash_threads2: test/thrash_threads2.o libhts.a 420 $(CC) $(LDFLAGS) -o $@ test/thrash_threads2.o libhts.a -lz $(LIBS) -lpthread 421 422test/thrash_threads3: test/thrash_threads3.o libhts.a 423 $(CC) $(LDFLAGS) -o $@ test/thrash_threads3.o libhts.a -lz $(LIBS) -lpthread 424 425test/thrash_threads4: test/thrash_threads4.o libhts.a 426 $(CC) $(LDFLAGS) -o $@ test/thrash_threads4.o libhts.a -lz $(LIBS) -lpthread 427 428test/thrash_threads5: test/thrash_threads5.o libhts.a 429 $(CC) $(LDFLAGS) -o $@ test/thrash_threads5.o libhts.a -lz $(LIBS) -lpthread 430 431test/thrash_threads6: test/thrash_threads6.o libhts.a 432 $(CC) $(LDFLAGS) -o $@ test/thrash_threads6.o libhts.a -lz $(LIBS) -lpthread 433 434test_thrash: $(BUILT_THRASH_PROGRAMS) 435 436 437install: libhts.a $(BUILT_PROGRAMS) $(BUILT_PLUGINS) installdirs install-$(SHLIB_FLAVOUR) install-pkgconfig 438 $(INSTALL_PROGRAM) $(BUILT_PROGRAMS) $(DESTDIR)$(bindir) 439 if test -n "$(BUILT_PLUGINS)"; then $(INSTALL_PROGRAM) $(BUILT_PLUGINS) $(DESTDIR)$(plugindir); fi 440 $(INSTALL_DATA) htslib/*.h $(DESTDIR)$(includedir)/htslib 441 $(INSTALL_DATA) libhts.a $(DESTDIR)$(libdir)/libhts.a 442 $(INSTALL_MAN) bgzip.1 htsfile.1 tabix.1 $(DESTDIR)$(man1dir) 443 $(INSTALL_MAN) faidx.5 sam.5 vcf.5 $(DESTDIR)$(man5dir) 444 445installdirs: 446 $(INSTALL_DIR) $(DESTDIR)$(bindir) $(DESTDIR)$(includedir) $(DESTDIR)$(includedir)/htslib $(DESTDIR)$(libdir) $(DESTDIR)$(man1dir) $(DESTDIR)$(man5dir) $(DESTDIR)$(pkgconfigdir) 447 if test -n "$(plugindir)"; then $(INSTALL_DIR) $(DESTDIR)$(plugindir); fi 448 449# After installation, the real file in $(libdir) will be libhts.so.X.Y.Z, 450# with symlinks libhts.so (used via -lhts during linking of client programs) 451# and libhts.so.NN (used by client executables at runtime). 452 453install-so: libhts.so installdirs 454 $(INSTALL_LIB) libhts.so $(DESTDIR)$(libdir)/libhts.so.$(PACKAGE_VERSION) 455 ln -sf libhts.so.$(PACKAGE_VERSION) $(DESTDIR)$(libdir)/libhts.so 456 ln -sf libhts.so.$(PACKAGE_VERSION) $(DESTDIR)$(libdir)/libhts.so.$(LIBHTS_SOVERSION) 457 458install-cygdll: cyghts-$(LIBHTS_SOVERSION).dll installdirs 459 $(INSTALL_PROGRAM) cyghts-$(LIBHTS_SOVERSION).dll $(DESTDIR)$(bindir)/cyghts-$(LIBHTS_SOVERSION).dll 460 $(INSTALL_PROGRAM) libhts.dll.a $(DESTDIR)$(libdir)/libhts.dll.a 461 462install-dll: hts-$(LIBHTS_SOVERSION).dll installdirs 463 $(INSTALL_PROGRAM) hts-$(LIBHTS_SOVERSION).dll $(DESTDIR)$(bindir)/hts-$(LIBHTS_SOVERSION).dll 464 $(INSTALL_PROGRAM) hts.dll.a $(DESTDIR)$(libdir)/hts.dll.a 465 466install-dylib: libhts.dylib installdirs 467 $(INSTALL_PROGRAM) libhts.dylib $(DESTDIR)$(libdir)/libhts.$(PACKAGE_VERSION).dylib 468 ln -sf libhts.$(PACKAGE_VERSION).dylib $(DESTDIR)$(libdir)/libhts.dylib 469 ln -sf libhts.$(PACKAGE_VERSION).dylib $(DESTDIR)$(libdir)/libhts.$(LIBHTS_SOVERSION).dylib 470 471# Substitute these pseudo-autoconf variables only at install time 472# so that "make install prefix=/prefix/path" etc continue to work. 473install-pkgconfig: htslib.pc.tmp installdirs 474 sed -e 's#@-includedir@#$(includedir)#g;s#@-libdir@#$(libdir)#g;s#@-PACKAGE_VERSION@#$(PACKAGE_VERSION)#g' htslib.pc.tmp > $(DESTDIR)$(pkgconfigdir)/htslib.pc 475 chmod 644 $(DESTDIR)$(pkgconfigdir)/htslib.pc 476 477# A pkg-config file (suitable for copying to $PKG_CONFIG_PATH) that provides 478# flags for building against the uninstalled library in this build directory. 479htslib-uninstalled.pc: htslib.pc.tmp 480 sed -e 's#@-includedir@#'`pwd`'#g;s#@-libdir@#'`pwd`'#g' htslib.pc.tmp > $@ 481 482 483testclean: 484 -rm -f test/*.tmp test/*.tmp.* test/tabix/*.tmp.* test/tabix/FAIL* 485 486mostlyclean: testclean 487 -rm -f *.o *.pico cram/*.o cram/*.pico test/*.o test/*.dSYM version.h 488 489clean: mostlyclean clean-$(SHLIB_FLAVOUR) 490 -rm -f libhts.a $(BUILT_PROGRAMS) $(BUILT_PLUGINS) $(BUILT_TEST_PROGRAMS) $(BUILT_THRASH_PROGRAMS) 491 492distclean maintainer-clean: clean 493 -rm -f config.cache config.h config.log config.mk config.status 494 -rm -f TAGS *.pc.tmp *-uninstalled.pc htslib_static.mk 495 -rm -rf autom4te.cache 496 497clean-so: 498 -rm -f libhts.so libhts.so.* 499 500clean-cygdll: 501 -rm -f cyghts-*.dll libhts.dll.a 502 503clean-dll: 504 -rm -f hts-*.dll hts.dll.a 505 506clean-dylib: 507 -rm -f libhts.dylib libhts.*.dylib 508 509 510tags TAGS: 511 ctags -f TAGS *.[ch] cram/*.[ch] htslib/*.h 512 513# We recommend libhts-using programs be built against a separate htslib 514# installation. However if you feel that you must bundle htslib source 515# code with your program, this hook enables Automake-style "make dist" 516# for this subdirectory. If you do bundle an htslib snapshot, please 517# add identifying information to $(PACKAGE_VERSION) as appropriate. 518# (The wildcards attempt to omit non-exported files (.git*, README.md, 519# etc) and other detritus that might be in the top-level directory.) 520distdir: 521 @if [ -z "$(distdir)" ]; then echo "Please supply a distdir=DIR argument."; false; fi 522 tar -c *.[ch15] [ILMNRchtv]*[ELSbcekmnth] | (cd $(distdir) && tar -x) 523 +cd $(distdir) && $(MAKE) distclean 524 525force: 526 527 528.PHONY: all check clean distclean distdir force 529.PHONY: install install-pkgconfig installdirs lib-shared lib-static 530.PHONY: maintainer-clean mostlyclean plugins print-config print-version 531.PHONY: show-version tags test testclean 532.PHONY: clean-so install-so 533.PHONY: clean-cygdll install-cygdll 534.PHONY: clean-dll install-dll 535.PHONY: clean-dylib install-dylib 536