@@ -158,8 +158,8 @@ LIBHTS_SOVERSION = 3
158158# is not strictly necessary and should be removed the next time
159159# LIBHTS_SOVERSION is bumped (see #1144 and
160160# https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryDesignGuidelines.html#//apple_ref/doc/uid/TP40002013-SW23)
161- MACH_O_COMPATIBILITY_VERSION = 3.1.21
162- MACH_O_CURRENT_VERSION = 3.1.21
161+ MACH_O_COMPATIBILITY_VERSION = 3.1.22
162+ MACH_O_CURRENT_VERSION = 3.1.22
163163
164164# Force version.h to be remade if $(PACKAGE_VERSION) has changed.
165165version.h : $(if $(wildcard version.h) ,$(if $(findstring "$(PACKAGE_VERSION ) ",$(shell cat version.h) ) ,,force) )
@@ -196,6 +196,8 @@ config_vars.h:
196196.c.pico :
197197 $(CC ) $(CFLAGS ) $(TARGET_CFLAGS ) $(ALL_CPPFLAGS ) $(EXTRA_CFLAGS_PIC ) -c -o $@ $<
198198
199+ ref_cache/% .o : ref_cache/% .c
200+ $(CC ) $(CFLAGS ) $(REF_CACHE_EXTRA_C_FLAGS ) $(TARGET_CFLAGS ) $(ALL_CPPFLAGS ) -c -o $@ $<
199201
200202LIBHTS_OBJS = \
201203 kfunc.o \
@@ -239,6 +241,24 @@ LIBHTS_OBJS = \
239241 $(HTSCODECS_OBJS ) \
240242 $(NONCONFIGURE_OBJS )
241243
244+ REF_CACHE_OBJS = ref_cache/cmsg_wrap.o \
245+ ref_cache/http_parser.o \
246+ ref_cache/listener.o \
247+ ref_cache/log_files.o \
248+ ref_cache/main.o \
249+ ref_cache/misc.o \
250+ ref_cache/ping.o \
251+ ref_cache/poll_wrap_epoll.o \
252+ ref_cache/poll_wrap_poll.o \
253+ ref_cache/ref_files.o \
254+ ref_cache/request_handler.o \
255+ ref_cache/sendfile_wrap.o \
256+ ref_cache/server.o \
257+ ref_cache/transaction.o \
258+ ref_cache/upstream.o \
259+ cram/pooled_alloc.o \
260+ md5.o
261+
242262# Without configure we wish to have a rich set of default figures,
243263# but we still need conditional inclusion as we wish to still
244264# support ./configure --disable-blah.
@@ -273,6 +293,9 @@ thread_pool_internal_h = thread_pool_internal.h $(htslib_thread_pool_h)
273293# using the configure script or just comment the line out if you are not.
274294-include config.mk
275295
296+ # Add optional built programs here
297+ all : $(REF_CACHE_PROGRAMS )
298+
276299# Usually config.h is generated by running configure or config.status,
277300# but if those aren't used create a default config.h here.
278301config.h :
@@ -309,9 +332,17 @@ config.h:
309332 echo ' #define HAVE_ATTRIBUTE_CONSTRUCTOR 1' >> $@
310333 echo ' #endif' >> $@
311334 echo ' #if (defined(__x86_64__) || defined(_M_X64))' >> $@
312- echo ' #define HAVE_ATTRIBUTE_TARGET 1' >> $@
335+ echo ' #define HAVE_ATTRIBUTE_TARGET_SSSE3 1' >> $@
313336 echo ' #define HAVE_BUILTIN_CPU_SUPPORT_SSSE3 1' >> $@
314337 echo ' #endif' >> $@
338+ echo ' #if defined __linux__' >> $@
339+ echo ' #define HAVE_GETAUXVAL' >> $@
340+ echo ' #elif defined __FreeBSD__' >> $@
341+ echo ' #define HAVE_ELF_AUX_INFO' >> $@
342+ echo ' #elif defined __OpenBSD__' >> $@
343+ echo ' // Enable extra OpenBSD checks (see simd.c)' >> $@
344+ echo ' #define HAVE_OPENBSD' >> $@
345+ echo ' #endif' >> $@
315346
316347# And similarly for htslib.pc.tmp ("pkg-config template"). No dependency
317348# on htslib.pc.in listed, as if that file is newer the usual way to regenerate
@@ -493,13 +524,13 @@ cram/cram_decode.o cram/cram_decode.pico: cram/cram_decode.c config.h $(cram_h)
493524cram/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 ) $(textutils_internal_h )
494525cram/cram_external.o cram/cram_external.pico : cram/cram_external.c config.h $(htscodecs_rANS_static4x16_h ) $(htslib_hfile_h ) $(cram_h )
495526cram/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 )
496- cram/cram_io.o cram/cram_io.pico : cram/cram_io.c config.h os/lzma_stub.h $(fuzz_settings_h ) $(cram_h ) $(cram_os_h ) $(htslib_hts_h ) $(cram_open_trace_file_h ) $(htscodecs_rANS_static_h ) $(htscodecs_rANS_static4x16_h ) $(htscodecs_arith_dynamic_h ) $(htscodecs_tokenise_name3_h ) $(htscodecs_fqzcomp_qual_h ) $(htscodecs_varint_h ) $(htslib_hfile_h ) $(htslib_bgzf_h ) $(htslib_faidx_h ) $(hts_internal_h )
527+ cram/cram_io.o cram/cram_io.pico : cram/cram_io.c config.h os/lzma_stub.h $(fuzz_settings_h ) $(cram_h ) $(cram_os_h ) $(htslib_hts_h ) $(hts_internal_h ) $( cram_open_trace_file_h ) $(htscodecs_rANS_static_h ) $(htscodecs_rANS_static4x16_h ) $(htscodecs_arith_dynamic_h ) $(htscodecs_tokenise_name3_h ) $(htscodecs_fqzcomp_qual_h ) $(htscodecs_varint_h ) $(htslib_hfile_h ) $(htslib_bgzf_h ) $(htslib_faidx_h ) $(hts_internal_h )
497528cram/cram_stats.o cram/cram_stats.pico : cram/cram_stats.c config.h $(cram_h ) $(cram_os_h )
498529cram/mFILE.o cram/mFILE.pico : cram/mFILE.c config.h $(htslib_hts_log_h ) $(cram_os_h ) cram/mFILE.h
499530cram/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 ) $(htslib_hts_h )
500531cram/pooled_alloc.o cram/pooled_alloc.pico : cram/pooled_alloc.c config.h cram/pooled_alloc.h $(cram_misc_h )
501532cram/string_alloc.o cram/string_alloc.pico : cram/string_alloc.c config.h cram/string_alloc.h
502- thread_pool.o thread_pool.pico : thread_pool.c config.h $(thread_pool_internal_h ) $(htslib_hts_log_h )
533+ thread_pool.o thread_pool.pico : thread_pool.c config.h $(thread_pool_internal_h ) $(htslib_hts_log_h ) $( hts_internal_h )
503534
504535htscodecs/htscodecs/arith_dynamic.o htscodecs/htscodecs/arith_dynamic.pico : htscodecs/htscodecs/arith_dynamic.c config.h $(htscodecs_arith_dynamic_h ) $(htscodecs_varint_h ) $(htscodecs_pack_h ) $(htscodecs_utils_h ) $(htscodecs_c_simple_model_h )
505536htscodecs/htscodecs/fqzcomp_qual.o htscodecs/htscodecs/fqzcomp_qual.pico : htscodecs/htscodecs/fqzcomp_qual.c config.h $(htscodecs_fqzcomp_qual_h ) $(htscodecs_varint_h ) $(htscodecs_utils_h ) $(htscodecs_c_simple_model_h )
@@ -533,11 +564,46 @@ htsfile: htsfile.o libhts.a
533564tabix : tabix.o libhts.a
534565 $(CC ) $(LDFLAGS ) -o $@ tabix.o libhts.a $(LIBS ) -lpthread
535566
567+ ref_cache/ref-cache : $(REF_CACHE_OBJS )
568+ $(CC ) $(LDFLAGS ) $(REF_CACHE_EXTRA_LD_FLAGS ) -o $@ $(REF_CACHE_OBJS ) -lcurl
569+
536570annot-tsv.o : annot-tsv.c config.h $(htslib_hts_h ) $(htslib_hts_defs_h ) $(htslib_khash_str2int_h ) $(htslib_kstring_h ) $(htslib_kseq_h ) $(htslib_bgzf_h ) $(htslib_regidx_h ) $(textutils_internal_h )
537571bgzip.o : bgzip.c config.h $(htslib_bgzf_h ) $(htslib_hts_h ) $(htslib_hfile_h )
538572htsfile.o : htsfile.c config.h $(htslib_hfile_h ) $(htslib_hts_h ) $(htslib_sam_h ) $(htslib_vcf_h )
539573tabix.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 ) $(htslib_thread_pool_h )
540574
575+ # ref_cache dependencies
576+ ref_cache_cmsg_wrap_h = ref_cache/cmsg_wrap.h
577+ ref_cache_http_parser_h = ref_cache/http_parser.h $(htslib_hts_defs_h ) $(ref_cache_types_h )
578+ ref_cache_listener_h = ref_cache/listener.h $(ref_cache_types_h )
579+ ref_cache_log_files_h = ref_cache/log_files.h $(htslib_hts_defs_h ) $(ref_types_h )
580+ ref_cache_misc_h = ref_cache/misc.h $(htslib_hts_defs_h )
581+ ref_cache_options_h = ref_cache/options.h $(ref_cache_types_h )
582+ ref_cache_ping_h = ref_cache/ping.h
583+ ref_cache_poll_wrap_h = ref_cache/poll_wrap.h $(ref_cache_types_h )
584+ ref_cache_ref_files_h = ref_cache/ref_files.h $(htslib_hts_defs_h ) $(ref_cache_types_h )
585+ ref_cache_request_handler_h = ref_cache/request_handler.h $(htslib_hts_defs_h ) $(ref_cache_types_h )
586+ ref_cache_sendfile_wrap_h = ref_cache/sendfile_wrap.h
587+ ref_cache_server_h = ref_cache/server.h $(htslib_hts_defs_h ) $(ref_cache_types_h )
588+ ref_cache_transaction_h = ref_cache/transaction.h $(htslib_hts_defs_h ) $(ref_cache_types_h )
589+ ref_cache_types_h = ref_cache/types.h
590+ ref_cache_upstream_h = ref_cache/upstream.h $(ref_cache_types_h )
591+
592+ ref_cache/cmsg_wrap.o : ref_cache/cmsg_wrap.c config.h $(ref_cache_cmsg_wrap_h )
593+ ref_cache/http_parser.o : ref_cache/http_parser.c config.h $(ref_cache_http_parser_h ) $(ref_cache_misc_h ) $(ref_cache_options_h ) $(ref_cache_request_handler_h ) $(ref_cache_server_h ) cram/pooled_alloc.h
594+ ref_cache/listener.o : ref_cache/listener.c config.h $(ref_cache_listener_h ) $(ref_cache_misc_h ) $(ref_cache_options_h ) $(ref_cache_poll_wrap_h )
595+ ref_cache/log_files.o : ref_cache/log_files.c config.h $(ref_cache_log_files_h ) $(ref_cache_options_h )
596+ ref_cache/main.o : ref_cache/main.c config.h $(ref_cache_listener_h ) $(ref_cache_log_files_h ) $(ref_cache_misc_h ) $(ref_cache_options_h ) $(ref_cache_ping_h ) $(ref_cache_poll_wrap_h ) $(ref_cache_server_h ) $(ref_cache_upstream_h )
597+ ref_cache/ping.o : ref_cache/ping.c config.h $(ref_cache_ping_h ) $(ref_cache_misc_h ) $(ref_cache_options_h )
598+ ref_cache/poll_wrap_epoll.o : ref_cache/poll_wrap_epoll.c config.h $(ref_cache_poll_wrap_h ) cram/pooled_alloc.h
599+ ref_cache/poll_wrap_poll.o : ref_cache/poll_wrap_poll.c config.h $(ref_cache_poll_wrap_h ) cram/pooled_alloc.h
600+ ref_cache/ref_files.o : ref_cache/ref_files.c config.h $(ref_cache_ref_files_h ) $(ref_cache_misc_h ) $(ref_cache_options_h ) $(ref_cache_upstream_h )
601+ ref_cache/request_handler.o : ref_cache/request_handler.c config.h $(ref_cache_request_handler_h ) $(ref_cache_http_parser_h ) $(ref_cache_misc_h ) $(ref_cache_options_h ) $(ref_cache_ref_files_h ) $(ref_cache_transaction_h ) $(ref_cache_upstream_h )
602+ ref_cache/sendfile_wrap.o : ref_cache/sendfile_wrap.c config.h $(ref_cache_sendfile_wrap_h )
603+ ref_cache/server.o : ref_cache/server.c config.h $(ref_cache_server_h ) $(ref_cache_http_parser_h ) $(ref_cache_listener_h ) $(ref_cache_misc_h ) $(ref_cache_options_h ) $(ref_cache_poll_wrap_h ) $(ref_cache_ref_files_h ) $(ref_cache_request_handler_h ) $(ref_cache_transaction_h ) $(ref_cache_upstream_h ) cram/pooled_alloc.h
604+ ref_cache/transaction.o : ref_cache/transaction.c config.h $(ref_cache_transaction_h ) $(ref_cache_http_parser_h ) $(ref_cache_options_h ) $(ref_cache_poll_wrap_h ) $(ref_cache_ref_files_h ) $(ref_cache_sendfile_wrap_h ) $(ref_cache_server_h ) cram/pooled_alloc.h
605+ ref_cache/upstream.o : ref_cache/upstream.c config.h $(ref_cache_upstream_h ) $(ref_cache_cmsg_wrap_h ) $(ref_cache_misc_h ) $(ref_cache_options_h ) $(ref_cache_poll_wrap_h ) $(htslib_hts_defs_h )
606+
541607# Runes to check that the htscodecs submodule is present
542608ifdef HTSCODECS_SOURCES
543609htscodecs/htscodecs/% .c : | htscodecs/htscodecs
@@ -568,7 +634,7 @@ htscodecs/htscodecs:
568634 @false
569635
570636# Build the htscodecs/htscodecs/version.h file if necessary
571- htscodecs/htscodecs/version.h : force
637+ htscodecs/htscodecs/version.h : force | htscodecs/htscodecs
572638 @if test -e $(srcdir ) /htscodecs/.git && test -e $(srcdir ) /htscodecs/configure.ac ; then \
573639 vers=` cd $( srcdir) /htscodecs && git describe --always --dirty --match ' v[0-9]\.[0-9]*' ` && \
574640 case " $$ vers" in \
@@ -635,7 +701,12 @@ check test: all $(HTSCODECS_TEST_TARGETS)
635701 cd test/base_mods && ./base-mods.sh base-mods.tst
636702 REF_PATH=: test/sam test/ce.fa test/faidx/faidx.fa test/faidx/fastqs.fq
637703 test/test-regidx
638- cd test && REF_PATH=: ./test.pl $$ {TEST_OPTS:-}
704+ cd test && \
705+ if test " x$( BUILT_PLUGINS) " ! = " x" ; then \
706+ REF_PATH=: HTS_PATH=.. ./with-shlib.sh ./test.pl $(REF_CACHE_TEST_OPTS ) $$ {TEST_OPTS:-} ; \
707+ else \
708+ REF_PATH=: ./test.pl $(REF_CACHE_TEST_OPTS ) $$ {TEST_OPTS:-} ; \
709+ fi
639710
640711test/hts_endian : test/hts_endian.o
641712 $(CC ) $(LDFLAGS ) -o $@ test/hts_endian.o $(LIBS )
@@ -803,7 +874,7 @@ test/test_faidx.o: test/test_faidx.c config.h $(htslib_faidx_h)
803874test/test_index.o : test/test_index.c config.h $(htslib_sam_h ) $(htslib_vcf_h )
804875test/test-vcf-api.o : test/test-vcf-api.c config.h $(htslib_hts_h ) $(htslib_vcf_h ) $(htslib_kstring_h ) $(htslib_kseq_h )
805876test/test-vcf-sweep.o : test/test-vcf-sweep.c config.h $(htslib_vcf_sweep_h )
806- test/test-bcf-sr.o : test/test-bcf-sr.c config.h $(htslib_synced_bcf_reader_h ) $(htslib_hts_h ) $(htslib_vcf_h )
877+ test/test-bcf-sr.o : test/test-bcf-sr.c config.h $(htslib_hts_defs_h ) $( htslib_synced_bcf_reader_h ) $(htslib_hts_h ) $(htslib_vcf_h )
807878test/test-bcf-translate.o : test/test-bcf-translate.c config.h $(htslib_vcf_h )
808879test/test_introspection.o : test/test_introspection.c config.h $(htslib_hts_h ) $(htslib_hfile_h )
809880test/test-bcf_set_variant_type.o : test/test-bcf_set_variant_type.c config.h $(htslib_hts_h ) vcf.c
@@ -881,19 +952,21 @@ $(srcprefix)htslib.map: libhts.so
881952 printf ' \n%s {\n' " HTSLIB_$$ curr_vers" >> $@ .new.tmp && \
882953 cat $@ .tmp >> $@ .new.tmp && \
883954 printf ' } %s;\n' " $$ last_vers" >> $@ .new.tmp && \
884- rm -f $@ .tmp && \
885- mv $@ .new.tmp $@ ; \
886- fi ; \
955+ rm -f $@ .tmp && \
956+ mv $@ .new.tmp $@ ; \
887957 else \
888958 rm -f $@ .tmp ; \
889959 fi
890960
891- install : libhts.a $(BUILT_PROGRAMS ) $(BUILT_PLUGINS ) installdirs install-$(SHLIB_FLAVOUR ) install-pkgconfig
892- $(INSTALL_PROGRAM ) $(BUILT_PROGRAMS ) $(DESTDIR )$(bindir )
961+ install : libhts.a $(BUILT_PROGRAMS ) $(BUILT_PLUGINS ) $( REF_CACHE_PROGRAMS ) installdirs install-$(SHLIB_FLAVOUR ) install-pkgconfig
962+ $(INSTALL_PROGRAM ) $(BUILT_PROGRAMS ) $(REF_CACHE_PROGRAMS ) $( DESTDIR )$(bindir )
893963 if test -n " $( BUILT_PLUGINS) " ; then $( INSTALL_PROGRAM) $( BUILT_PLUGINS) $( DESTDIR) $( plugindir) ; fi
894964 $(INSTALL_DATA ) $(SRC ) htslib/* .h $(DESTDIR )$(includedir ) /htslib
895965 $(INSTALL_DATA ) libhts.a $(DESTDIR )$(libdir ) /libhts.a
896966 $(INSTALL_MAN ) $(SRC ) annot-tsv.1 $(SRC ) bgzip.1 $(SRC ) htsfile.1 $(SRC ) tabix.1 $(DESTDIR )$(man1dir )
967+ if test " x$( REF_CACHE_PROGRAMS) " ! = " x" ; then \
968+ $(INSTALL_MAN ) $(SRC ) ref_cache/ref-cache.1 $(DESTDIR )$(man1dir ) ; \
969+ fi
897970 $(INSTALL_MAN ) $(SRC ) faidx.5 $(SRC ) sam.5 $(SRC ) vcf.5 $(DESTDIR )$(man5dir )
898971 $(INSTALL_MAN ) $(SRC ) htslib-s3-plugin.7 $(DESTDIR )$(man7dir )
899972
@@ -932,12 +1005,12 @@ install-pkgconfig: htslib.pc.tmp installdirs
9321005# A pkg-config file (suitable for copying to $PKG_CONFIG_PATH) that provides
9331006# flags for building against the uninstalled library in this build directory.
9341007htslib-uninstalled.pc : htslib.pc.tmp
935- sed -e ' s#@-includedir@#' ` pwd` ' #g;s#@-libdir@#' ` pwd` ' #g ' htslib.pc.tmp > $@
1008+ sed -e " s#@-includedir@#` pwd` #g;s#@-libdir@#` pwd` #g " htslib.pc.tmp > $@
9361009
9371010
9381011testclean :
9391012 -rm -f test/* .tmp test/* .tmp.* test/faidx/* .tmp* \
940- test/longrefs/*.tmp.* test/tabix/*.tmp.* \
1013+ test/longrefs/*.tmp.* test/ref_cache/*.tmp.* test/ tabix/*.tmp.* \
9411014 test/bgzf_boundaries/*.tmp.* test/*/FAIL* \
9421015 header-exports.txt shlib-exports-$(SHLIB_FLAVOUR).txt
9431016 -rm -rf htscodecs/tests/test.out
@@ -950,9 +1023,10 @@ mostlyclean: testclean
9501023 -rm -f htscodecs/htscodecs/* .o htscodecs/htscodecs/* .pico $(DEL_HTSCODECS_VERSION )
9511024 -rm -f hts-object-files
9521025 -rm -f htscodecs/tests/* .o
1026+ -rm -f ref_cache/* .o
9531027
9541028clean : mostlyclean clean-$(SHLIB_FLAVOUR )
955- -rm -f libhts.a $(BUILT_PROGRAMS ) $(BUILT_PLUGINS ) $(BUILT_TEST_PROGRAMS ) $(BUILT_THRASH_PROGRAMS )
1029+ -rm -f libhts.a $(BUILT_PROGRAMS ) $(BUILT_PLUGINS ) $(BUILT_TEST_PROGRAMS ) $(BUILT_THRASH_PROGRAMS ) $( REF_CACHE_PROGRAMS )
9561030 -rm -f htscodecs/tests/rans4x8 htscodecs/tests/rans4x16pr htscodecs/tests/arith_dynamic htscodecs/tests/tokenise_name3 htscodecs/tests/fqzcomp_qual htscodecs/tests/varint
9571031
9581032distclean maintainer-clean : clean
@@ -981,11 +1055,11 @@ tags TAGS:
9811055# code with your program, this hook enables Automake-style "make dist"
9821056# for this subdirectory. If you do bundle an htslib snapshot, please
9831057# add identifying information to $(PACKAGE_VERSION) as appropriate.
984- # (The wildcards attempt to omit non-exported files (.git*, README.md ,
1058+ # (The wildcards attempt to omit non-exported files (.git, .gitignore ,
9851059# etc) and other detritus that might be in the top-level directory.)
986- distdir :
1060+ distdir : htscodecs/htscodecs/version.h
9871061 @if [ -z " $( distdir) " ]; then echo " Please supply a distdir=DIR argument." ; false ; fi
988- tar -c * .[ch15 ] [ILMNRchtv ]* [ELSbcekmnth ] | (cd $( distdir) && tar -x)
1062+ tar -c * .[ch157 ] [I-R ]* [ELSde] [cmors] * [bcemns4] [bhtv] * [bhknpt] htscodecs/ * .md htscodecs/[ht] * / * [chp-t0-9 ] | (cd $( distdir) && tar -x)
9891063 +cd $(distdir ) && $(MAKE ) distclean
9901064
9911065force :
0 commit comments