11# Makefile for htslib, a C library for high-throughput sequencing data formats.
22#
3- # Copyright (C) 2013-2019 Genome Research Ltd.
3+ # Copyright (C) 2013-2020 Genome Research Ltd.
44#
55# Author: John Marshall <jm18@sanger.ac.uk>
66#
@@ -74,8 +74,10 @@ BUILT_TEST_PROGRAMS = \
7474 test/fieldarith \
7575 test/hfile \
7676 test/pileup \
77+ test/plugins-dlhts \
7778 test/sam \
7879 test/test_bgzf \
80+ test/test_kfunc \
7981 test/test_kstring \
8082 test/test_realn \
8183 test/test-regidx \
@@ -98,7 +100,8 @@ BUILT_THRASH_PROGRAMS = \
98100 test/thrash_threads6 \
99101 test/thrash_threads7
100102
101- all : lib-static lib-shared $(BUILT_PROGRAMS ) plugins $(BUILT_TEST_PROGRAMS )
103+ all : lib-static lib-shared $(BUILT_PROGRAMS ) plugins $(BUILT_TEST_PROGRAMS ) \
104+ htslib_static.mk htslib-uninstalled.pc
102105
103106HTSPREFIX =
104107include htslib_vars.mk
@@ -304,11 +307,11 @@ hts-$(LIBHTS_SOVERSION).dll hts.dll.a: $(LIBHTS_OBJS)
304307hts-object-files : $(LIBHTS_OBJS )
305308 touch $@
306309
307- . pico.so:
308- $(CC ) -shared -Wl,-E $(LDFLAGS ) -o $@ $< $(LIBS ) -lpthread
310+ % .so : % . pico libhts .so
311+ $(CC ) -shared -Wl,-E $(LDFLAGS ) -o $@ $< libhts.so $(LIBS ) -lpthread
309312
310- .o. bundle :
311- $(CC ) -bundle -Wl,-undefined,dynamic_lookup $(LDFLAGS ) -o $@ $< $(LIBS )
313+ % . bundle : % .o libhts.dylib
314+ $(CC ) -bundle -Wl,-undefined,dynamic_lookup $(LDFLAGS ) -o $@ $< libhts.dylib $(LIBS )
312315
313316% .cygdll : % .o libhts.dll.a
314317 $(CC ) -shared $(LDFLAGS ) -o $@ $< libhts.dll.a $(LIBS )
@@ -350,7 +353,7 @@ textutils.o textutils.pico: textutils.c config.h $(htslib_hfile_h) $(htslib_kstr
350353
351354cram/cram_codecs.o cram/cram_codecs.pico : cram/cram_codecs.c config.h $(cram_h )
352355cram/cram_decode.o cram/cram_decode.pico : cram/cram_decode.c config.h $(cram_h ) $(cram_os_h ) $(htslib_hts_h )
353- 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 )
356+ cram/cram_encode.o cram/cram_encode.pico : cram/cram_encode.c config.h $(cram_h ) $(cram_os_h ) $(sam_internal_h ) $( htslib_hts_h ) $(htslib_hts_endian_h )
354357cram/cram_external.o cram/cram_external.pico : cram/cram_external.c config.h $(htslib_hfile_h ) $(cram_h )
355358cram/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 )
356359cram/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 )
@@ -361,7 +364,7 @@ cram/open_trace_file.o cram/open_trace_file.pico: cram/open_trace_file.c config.
361364cram/pooled_alloc.o cram/pooled_alloc.pico : cram/pooled_alloc.c config.h cram/pooled_alloc.h $(cram_misc_h )
362365cram/rANS_static.o cram/rANS_static.pico : cram/rANS_static.c config.h cram/rANS_static.h cram/rANS_byte.h
363366cram/string_alloc.o cram/string_alloc.pico : cram/string_alloc.c config.h cram/string_alloc.h
364- thread_pool.o thread_pool.pico : thread_pool.c config.h $(thread_pool_internal_h )
367+ thread_pool.o thread_pool.pico : thread_pool.c config.h $(thread_pool_internal_h ) $( htslib_hts_log_h )
365368
366369
367370bgzip : bgzip.o libhts.a
@@ -375,7 +378,7 @@ tabix: tabix.o libhts.a
375378
376379bgzip.o : bgzip.c config.h $(htslib_bgzf_h ) $(htslib_hts_h )
377380htsfile.o : htsfile.c config.h $(htslib_hfile_h ) $(htslib_hts_h ) $(htslib_sam_h ) $(htslib_vcf_h )
378- 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 )
381+ 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 ) $( htslib_hts_defs_h ) $( htslib_hts_log_h )
379382
380383# Maintainer source code checks
381384# - copyright boilerplate presence
@@ -389,12 +392,15 @@ maintainer-check:
389392#
390393# If using MSYS, avoid poor shell expansion via:
391394# MSYS2_ARG_CONV_EXCL="*" make check
392- check test : $(BUILT_PROGRAMS ) $(BUILT_TEST_PROGRAMS )
395+ check test : $(BUILT_PROGRAMS ) $(BUILT_TEST_PROGRAMS ) $( BUILT_PLUGINS )
393396 test/hts_endian
397+ test/test_kfunc
394398 test/test_kstring
395399 test/test_str2int
396400 test/fieldarith test/fieldarith.sam
397401 test/hfile
402+ HTS_PATH=. test/with-shlib.sh test/plugins-dlhts -g ./libhts.$(SHLIB_FLAVOUR )
403+ HTS_PATH=. test/with-shlib.sh test/plugins-dlhts -l ./libhts.$(SHLIB_FLAVOUR )
398404 test/test_bgzf test/bgziptest.txt
399405 test/test-parse-reg -t test/colons.bam
400406 cd test/tabix && ./test-tabix.sh tabix.tst
@@ -418,12 +424,18 @@ test/hfile: test/hfile.o libhts.a
418424test/pileup : test/pileup.o libhts.a
419425 $(CC ) $(LDFLAGS ) -o $@ test/pileup.o libhts.a $(LIBS ) -lpthread
420426
427+ test/plugins-dlhts : test/plugins-dlhts.o
428+ $(CC ) $(LDFLAGS ) -o $@ test/plugins-dlhts.o $(LIBS )
429+
421430test/sam : test/sam.o libhts.a
422431 $(CC ) $(LDFLAGS ) -o $@ test/sam.o libhts.a $(LIBS ) -lpthread
423432
424433test/test_bgzf : test/test_bgzf.o libhts.a
425434 $(CC ) $(LDFLAGS ) -o $@ test/test_bgzf.o libhts.a -lz $(LIBS ) -lpthread
426435
436+ test/test_kfunc : test/test_kfunc.o libhts.a
437+ $(CC ) $(LDFLAGS ) -o $@ test/test_kfunc.o libhts.a -lz $(LIBS ) -lpthread
438+
427439test/test_kstring : test/test_kstring.o libhts.a
428440 $(CC ) $(LDFLAGS ) -o $@ test/test_kstring.o libhts.a -lz $(LIBS ) -lpthread
429441
@@ -436,8 +448,8 @@ test/test-regidx: test/test-regidx.o libhts.a
436448test/test-parse-reg : test/test-parse-reg.o libhts.a
437449 $(CC ) $(LDFLAGS ) -o $@ test/test-parse-reg.o libhts.a $(LIBS ) -lpthread
438450
439- test/test_str2int : test/test_str2int.o
440- $(CC ) $(LDFLAGS ) -o $@ test/test_str2int.o
451+ test/test_str2int : test/test_str2int.o libhts.a
452+ $(CC ) $(LDFLAGS ) -o $@ test/test_str2int.o libhts.a $( LIBS ) -lpthread
441453
442454test/test_view : test/test_view.o libhts.a
443455 $(CC ) $(LDFLAGS ) -o $@ test/test_view.o libhts.a $(LIBS ) -lpthread
@@ -462,8 +474,10 @@ test/fuzz/hts_open_fuzzer.o: test/fuzz/hts_open_fuzzer.c config.h $(htslib_hfile
462474test/fieldarith.o : test/fieldarith.c config.h $(htslib_sam_h )
463475test/hfile.o : test/hfile.c config.h $(htslib_hfile_h ) $(htslib_hts_defs_h ) $(htslib_kstring_h )
464476test/pileup.o : test/pileup.c config.h $(htslib_sam_h ) $(htslib_kstring_h )
477+ test/plugins-dlhts.o : test/plugins-dlhts.c config.h
465478test/sam.o : test/sam.c config.h $(htslib_hts_defs_h ) $(htslib_sam_h ) $(htslib_faidx_h ) $(htslib_khash_h ) $(htslib_hts_log_h )
466479test/test_bgzf.o : test/test_bgzf.c config.h $(htslib_bgzf_h ) $(htslib_hfile_h ) $(hfile_internal_h )
480+ test/test_kfunc.o : test/test_kfunc.c config.h $(htslib_kfunc_h )
467481test/test_kstring.o : test/test_kstring.c config.h $(htslib_kstring_h )
468482test/test-parse-reg.o : test/test-parse-reg.c config.h $(htslib_hts_h ) $(htslib_sam_h )
469483test/test_realn.o : test/test_realn.c config.h $(htslib_hts_h ) $(htslib_sam_h ) $(htslib_faidx_h )
@@ -494,8 +508,10 @@ test/thrash_threads5: test/thrash_threads5.o libhts.a
494508
495509test/thrash_threads6 : test/thrash_threads6.o libhts.a
496510 $(CC ) $(LDFLAGS ) -o $@ test/thrash_threads6.o libhts.a -lz $(LIBS ) -lpthread
511+
497512test/thrash_threads7 : test/thrash_threads7.o libhts.a
498513 $(CC ) $(LDFLAGS ) -o $@ test/thrash_threads7.o libhts.a -lz $(LIBS ) -lpthread
514+
499515test_thrash : $(BUILT_THRASH_PROGRAMS )
500516
501517# Test to ensure the functions in the header files are exported by the shared
@@ -620,8 +636,9 @@ force:
620636
621637.PHONY : all check clean distclean distdir force
622638.PHONY : install install-pkgconfig installdirs lib-shared lib-static
623- .PHONY : maintainer-clean mostlyclean plugins print-config print-version
624- .PHONY : show-version tags test testclean
639+ .PHONY : maintainer-check maintainer-clean mostlyclean plugins
640+ .PHONY : print-config print-version show-version tags
641+ .PHONY : test test-shlib-exports test_thrash testclean
625642.PHONY : clean-so install-so
626643.PHONY : clean-cygdll install-cygdll
627644.PHONY : clean-dll install-dll
0 commit comments