@@ -37,6 +37,7 @@ CPPFLAGS =
37
37
# CFLAGS = -g -Wall -O2 -pedantic -std=c99 -D_XOPEN_SOURCE=600
38
38
CFLAGS = -g -Wall -O2 -fvisibility=hidden
39
39
EXTRA_CFLAGS_PIC = -fpic
40
+ TARGET_CFLAGS =
40
41
LDFLAGS = -fvisibility=hidden
41
42
LIBS = $(htslib_default_libs )
42
43
@@ -85,6 +86,7 @@ BUILT_TEST_PROGRAMS = \
85
86
test/test_realn \
86
87
test/test-regidx \
87
88
test/test_str2int \
89
+ test/test_time_funcs \
88
90
test/test_view \
89
91
test/test_index \
90
92
test/test-vcf-api \
@@ -93,7 +95,8 @@ BUILT_TEST_PROGRAMS = \
93
95
test/fuzz/hts_open_fuzzer.o \
94
96
test/test-bcf-translate \
95
97
test/test-parse-reg \
96
- test/test_introspection
98
+ test/test_introspection \
99
+ test/test-bcf_set_variant_type
97
100
98
101
BUILT_THRASH_PROGRAMS = \
99
102
test/thrash_threads1 \
@@ -114,10 +117,16 @@ ALL_CPPFLAGS = -I. $(CPPFLAGS)
114
117
htscodecs.mk :
115
118
echo ' # Default htscodecs.mk generated by Makefile' > $@
116
119
echo ' include $$(HTSPREFIX)htscodecs_bundled.mk' >> $@
120
+ $(srcdir ) /hts_probe_cc.sh ' $(CC)' ' $(CFLAGS) $(CPPFLAGS)' ' $(LDFLAGS)' >> $@
117
121
118
122
srcdir = .
119
123
srcprefix =
120
124
HTSPREFIX =
125
+
126
+ HTS_CFLAGS_AVX2 =
127
+ HTS_CFLAGS_AVX512 =
128
+ HTS_CFLAGS_SSE4 =
129
+
121
130
include htslib_vars.mk
122
131
include htscodecs.mk
123
132
@@ -131,8 +140,8 @@ LIBHTS_SOVERSION = 3
131
140
# is not strictly necessary and should be removed the next time
132
141
# LIBHTS_SOVERSION is bumped (see #1144 and
133
142
# https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryDesignGuidelines.html#//apple_ref/doc/uid/TP40002013-SW23)
134
- MACH_O_COMPATIBILITY_VERSION = 3.1.15
135
- MACH_O_CURRENT_VERSION = 3.1.15
143
+ MACH_O_COMPATIBILITY_VERSION = 3.1.16
144
+ MACH_O_CURRENT_VERSION = 3.1.16
136
145
137
146
# $(NUMERIC_VERSION) is for items that must have a numeric X.Y.Z string
138
147
# even if this is a dirty or untagged Git working tree.
@@ -161,10 +170,10 @@ config_vars.h:
161
170
.SUFFIXES : .bundle .c .cygdll .dll .o .pico .so
162
171
163
172
.c.o :
164
- $(CC ) $(CFLAGS ) $(ALL_CPPFLAGS ) -c -o $@ $<
173
+ $(CC ) $(CFLAGS ) $(TARGET_CFLAGS ) $( ALL_CPPFLAGS ) -c -o $@ $<
165
174
166
175
.c.pico :
167
- $(CC ) $(CFLAGS ) $(ALL_CPPFLAGS ) $(EXTRA_CFLAGS_PIC ) -c -o $@ $<
176
+ $(CC ) $(CFLAGS ) $(TARGET_CFLAGS ) $( ALL_CPPFLAGS ) $(EXTRA_CFLAGS_PIC ) -c -o $@ $<
168
177
169
178
170
179
LIBHTS_OBJS = \
@@ -226,6 +235,7 @@ bcf_sr_sort_h = bcf_sr_sort.h $(htslib_synced_bcf_reader_h) $(htslib_kbitset_h)
226
235
header_h = header.h cram/string_alloc.h cram/pooled_alloc.h $(htslib_khash_h ) $(htslib_kstring_h ) $(htslib_sam_h )
227
236
hfile_internal_h = hfile_internal.h $(htslib_hts_defs_h ) $(htslib_hfile_h ) $(textutils_internal_h )
228
237
hts_internal_h = hts_internal.h $(htslib_hts_h ) $(textutils_internal_h )
238
+ hts_time_funcs_h = hts_time_funcs.h
229
239
sam_internal_h = sam_internal.h $(htslib_sam_h )
230
240
textutils_internal_h = textutils_internal.h $(htslib_kstring_h )
231
241
thread_pool_internal_h = thread_pool_internal.h $(htslib_thread_pool_h )
@@ -253,6 +263,20 @@ config.h:
253
263
echo ' #endif' >> $@
254
264
echo ' #define HAVE_DRAND48 1' >> $@
255
265
echo ' #define HAVE_LIBCURL 1' >> $@
266
+ if [ " x$( HTS_CFLAGS_SSE4) " != " x" ] ; then \
267
+ echo ' #define HAVE_POPCNT 1' >> $@ ; \
268
+ echo ' #define HAVE_SSE4_1 1' >> $@ ; \
269
+ echo ' #define HAVE_SSSE3 1' >> $@ ; \
270
+ echo ' #if defined(HTS_ALLOW_UNALIGNED) && HTS_ALLOW_UNALIGNED == 0' >> $@ ; \
271
+ echo ' #define UBSAN 1' >> $@ ; \
272
+ echo ' #endif' >> $@ ; \
273
+ fi
274
+ if [ " x$( HTS_CFLAGS_AVX2) " != " x" ] ; then \
275
+ echo ' #define HAVE_AVX2 1' >> $@ ; \
276
+ fi
277
+ if [ " x$( HTS_CFLAGS_AVX512) " != " x" ] ; then \
278
+ echo ' #define HAVE_AVX512 1' >> $@ ; \
279
+ fi
256
280
257
281
# And similarly for htslib.pc.tmp ("pkg-config template"). No dependency
258
282
# on htslib.pc.in listed, as if that file is newer the usual way to regenerate
@@ -293,6 +317,9 @@ endif
293
317
294
318
BUILT_PLUGINS = $(PLUGIN_OBJS:.o=$(PLUGIN_EXT ) )
295
319
320
+ ifneq "$(BUILT_PLUGINS ) " ""
321
+ plugins : lib-shared
322
+ endif
296
323
plugins : $(BUILT_PLUGINS )
297
324
298
325
@@ -302,6 +329,10 @@ libhts.a: $(LIBHTS_OBJS)
302
329
-$(RANLIB ) $@
303
330
304
331
print-config :
332
+ @echo HTS_CFLAGS_AVX2 = $(HTS_CFLAGS_AVX2 )
333
+ @echo HTS_CFLAGS_AVX512 = $(HTS_CFLAGS_AVX512 )
334
+ @echo HTS_CFLAGS_SSE4 = $(HTS_CFLAGS_SSE4 )
335
+ @echo HTS_HAVE_NEON = $(HTS_HAVE_NEON )
305
336
@echo LDFLAGS = $(LDFLAGS )
306
337
@echo LIBHTS_OBJS = $(LIBHTS_OBJS )
307
338
@echo LIBS = $(LIBS )
@@ -399,9 +430,9 @@ hfile.o hfile.pico: hfile.c config.h $(htslib_hfile_h) $(hfile_internal_h) $(hts
399
430
hfile_gcs.o hfile_gcs.pico : hfile_gcs.c config.h $(htslib_hts_h ) $(htslib_kstring_h ) $(hfile_internal_h )
400
431
hfile_libcurl.o hfile_libcurl.pico : hfile_libcurl.c config.h $(hfile_internal_h ) $(htslib_hts_h ) $(htslib_kstring_h ) $(htslib_khash_h )
401
432
hfile_s3_write.o hfile_s3_write.pico : hfile_s3_write.c config.h $(hfile_internal_h ) $(htslib_hts_h ) $(htslib_kstring_h ) $(htslib_khash_h )
402
- hfile_s3.o hfile_s3.pico : hfile_s3.c config.h $(hfile_internal_h ) $(htslib_hts_h ) $(htslib_kstring_h )
433
+ hfile_s3.o hfile_s3.pico : hfile_s3.c config.h $(hfile_internal_h ) $(htslib_hts_h ) $(htslib_kstring_h ) $( hts_time_funcs_h )
403
434
hts.o hts.pico : hts.c config.h os/lzma_stub.h $(htslib_hts_h ) $(htslib_bgzf_h ) $(cram_h ) $(htslib_hfile_h ) $(htslib_hts_endian_h ) version.h config_vars.h $(hts_internal_h ) $(hfile_internal_h ) $(sam_internal_h ) $(htslib_hts_expr_h ) $(htslib_hts_os_h ) $(htslib_khash_h ) $(htslib_kseq_h ) $(htslib_ksort_h ) $(htslib_tbx_h ) $(htscodecs_htscodecs_h )
404
- hts_expr.o hts_expr.pico : hts_expr.c config.h $(htslib_hts_expr_h ) $(textutils_internal_h )
435
+ hts_expr.o hts_expr.pico : hts_expr.c config.h $(htslib_hts_expr_h ) $(htslib_hts_log_h ) $( textutils_internal_h )
405
436
hts_os.o hts_os.pico : hts_os.c config.h $(htslib_hts_defs_h ) os/rand.c
406
437
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_sam_h ) $(htslib_khash_h ) $(htslib_kseq_h ) $(htslib_hts_endian_h )
407
438
sam.o sam.pico : sam.c config.h $(htslib_hts_defs_h ) $(htslib_sam_h ) $(htslib_bgzf_h ) $(cram_h ) $(hts_internal_h ) $(sam_internal_h ) $(htslib_hfile_h ) $(htslib_hts_endian_h ) $(htslib_hts_expr_h ) $(header_h ) $(htslib_khash_h ) $(htslib_kseq_h ) $(htslib_kstring_h )
@@ -423,7 +454,7 @@ textutils.o textutils.pico: textutils.c config.h $(htslib_hfile_h) $(htslib_kstr
423
454
424
455
cram/cram_codecs.o cram/cram_codecs.pico : cram/cram_codecs.c config.h $(htslib_hts_endian_h ) $(htscodecs_varint_h ) $(htscodecs_pack_h ) $(htscodecs_rle_h ) $(cram_h )
425
456
cram/cram_decode.o cram/cram_decode.pico : cram/cram_decode.c config.h $(cram_h ) $(cram_os_h ) $(htslib_hts_h )
426
- 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 )
457
+ 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 ) $( textutils_internal_h )
427
458
cram/cram_external.o cram/cram_external.pico : cram/cram_external.c config.h $(htslib_hfile_h ) $(cram_h )
428
459
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 )
429
460
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 ) $(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 )
@@ -435,14 +466,24 @@ cram/string_alloc.o cram/string_alloc.pico: cram/string_alloc.c config.h cram/st
435
466
thread_pool.o thread_pool.pico : thread_pool.c config.h $(thread_pool_internal_h ) $(htslib_hts_log_h )
436
467
437
468
htscodecs/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 )
438
- htscodecs/htscodecs/fqzcomp_qual.o htscodecs/htscodecs/fqzcomp_qual.pico : htscodecs/htscodecs/fqzcomp_qual.c config.h $(htscodecs_fqzcomp_qual_h ) $(htscodecs_varint_h ) $(htscodecs_c_simple_model_h )
469
+ htscodecs/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 )
439
470
htscodecs/htscodecs/htscodecs.o htscodecs/htscodecs/htscodecs.pico : htscodecs/htscodecs/htscodecs.c $(htscodecs_htscodecs_h ) $(htscodecs_version_h )
440
471
htscodecs/htscodecs/pack.o htscodecs/htscodecs/pack.pico : htscodecs/htscodecs/pack.c config.h $(htscodecs_pack_h )
441
- htscodecs/htscodecs/rANS_static4x16pr.o htscodecs/htscodecs/rANS_static4x16pr.pico : htscodecs/htscodecs/rANS_static4x16pr.c config.h $(htscodecs_rANS_word_h ) $(htscodecs_rANS_static4x16_h ) $(htscodecs_varint_h ) $(htscodecs_pack_h ) $(htscodecs_rle_h ) $(htscodecs_utils_h )
472
+ htscodecs/htscodecs/rANS_static32x16pr.o htscodecs/htscodecs/rANS_static32x16pr.pico : htscodecs/htscodecs/rANS_static32x16pr.c config.h $(htscodecs_rANS_word_h ) $(htscodecs_rANS_static4x16_h ) $(htscodecs_rANS_static16_int_h ) $(htscodecs_varint_h ) $(htscodecs_utils_h )
473
+ htscodecs/htscodecs/rANS_static32x16pr_avx2.o htscodecs/htscodecs/rANS_static32x16pr_avx2.pico : htscodecs/htscodecs/rANS_static32x16pr_avx2.c config.h $(htscodecs_rANS_word_h ) $(htscodecs_rANS_static4x16_h ) $(htscodecs_rANS_static16_int_h ) $(htscodecs_varint_h ) $(htscodecs_utils_h ) $(htscodecs_permute_h )
474
+ htscodecs/htscodecs/rANS_static32x16pr_avx512.o htscodecs/htscodecs/rANS_static32x16pr_avx512.pico : htscodecs/htscodecs/rANS_static32x16pr_avx512.c config.h $(htscodecs_rANS_word_h ) $(htscodecs_rANS_static4x16_h ) $(htscodecs_rANS_static16_int_h ) $(htscodecs_varint_h ) $(htscodecs_utils_h )
475
+ htscodecs/htscodecs/rANS_static32x16pr_neon.o htscodecs/htscodecs/rANS_static32x16pr_neon.pico : htscodecs/htscodecs/rANS_static32x16pr_neon.c config.h $(htscodecs_rANS_word_h ) $(htscodecs_rANS_static4x16_h ) $(htscodecs_rANS_static16_int_h ) $(htscodecs_varint_h ) $(htscodecs_utils_h )
476
+ htscodecs/htscodecs/rANS_static32x16pr_sse4.o htscodecs/htscodecs/rANS_static32x16pr_sse4.pico : htscodecs/htscodecs/rANS_static32x16pr_sse4.c config.h $(htscodecs_rANS_word_h ) $(htscodecs_rANS_static4x16_h ) $(htscodecs_rANS_static16_int_h ) $(htscodecs_varint_h ) $(htscodecs_utils_h )
477
+ htscodecs/htscodecs/rANS_static4x16pr.o htscodecs/htscodecs/rANS_static4x16pr.pico : htscodecs/htscodecs/rANS_static4x16pr.c config.h $(htscodecs_rANS_word_h ) $(htscodecs_rANS_static4x16_h ) $(htscodecs_rANS_static16_int_h ) $(htscodecs_pack_h ) $(htscodecs_rle_h ) $(htscodecs_utils_h ) $(htscodecs_rANS_static32x16pr_h )
442
478
htscodecs/htscodecs/rANS_static.o htscodecs/htscodecs/rANS_static.pico : htscodecs/htscodecs/rANS_static.c config.h $(htscodecs_rANS_byte_h ) $(htscodecs_utils_h ) $(htscodecs_rANS_static_h )
443
479
htscodecs/htscodecs/rle.o htscodecs/htscodecs/rle.pico : htscodecs/htscodecs/rle.c config.h $(htscodecs_varint_h ) $(htscodecs_rle_h )
444
- htscodecs/htscodecs/tokenise_name3.o htscodecs/htscodecs/tokenise_name3.pico : htscodecs/htscodecs/tokenise_name3.c config.h $(htscodecs_pooled_alloc_h ) $(htscodecs_arith_dynamic_h ) $(htscodecs_rANS_static4x16_h ) $(htscodecs_tokenise_name3_h ) $(htscodecs_varint_h )
480
+ htscodecs/htscodecs/tokenise_name3.o htscodecs/htscodecs/tokenise_name3.pico : htscodecs/htscodecs/tokenise_name3.c config.h $(htscodecs_pooled_alloc_h ) $(htscodecs_arith_dynamic_h ) $(htscodecs_rANS_static4x16_h ) $(htscodecs_tokenise_name3_h ) $(htscodecs_varint_h ) $(htscodecs_utils_h )
481
+ htscodecs/htscodecs/utils.o htscodecs/htscodecs/utils.pico : htscodecs/htscodecs/utils.c config.h $(htscodecs_utils_h )
445
482
483
+ # Extra CFLAGS for specific files
484
+ htscodecs/htscodecs/rANS_static32x16pr_avx2.o htscodecs/htscodecs/rANS_static32x16pr_avx2.pico : TARGET_CFLAGS = $(HTS_CFLAGS_AVX2 )
485
+ htscodecs/htscodecs/rANS_static32x16pr_avx512.o htscodecs/htscodecs/rANS_static32x16pr_avx512.pico : TARGET_CFLAGS = $(HTS_CFLAGS_AVX512 )
486
+ htscodecs/htscodecs/rANS_static32x16pr_sse4.o htscodecs/htscodecs/rANS_static32x16pr_sse4.pico : TARGET_CFLAGS = $(HTS_CFLAGS_SSE4 )
446
487
447
488
bgzip : bgzip.o libhts.a
448
489
$(CC ) $(LDFLAGS ) -o $@ bgzip.o libhts.a $(LIBS ) -lpthread
@@ -525,16 +566,21 @@ SRC = $(srcprefix)
525
566
#
526
567
# If using MSYS, avoid poor shell expansion via:
527
568
# MSYS2_ARG_CONV_EXCL="*" make check
528
- check test : $( BUILT_PROGRAMS ) $( BUILT_TEST_PROGRAMS ) $( BUILT_PLUGINS ) $(HTSCODECS_TEST_TARGETS )
569
+ check test : all $(HTSCODECS_TEST_TARGETS )
529
570
test/hts_endian
530
571
test/test_expr
531
572
test/test_kfunc
532
573
test/test_kstring
533
574
test/test_str2int
575
+ test/test_time_funcs
534
576
test/fieldarith test/fieldarith.sam
535
577
test/hfile
536
- HTS_PATH=. test/with-shlib.sh test/plugins-dlhts -g ./libhts.$(SHLIB_FLAVOUR )
537
- HTS_PATH=. test/with-shlib.sh test/plugins-dlhts -l ./libhts.$(SHLIB_FLAVOUR )
578
+ if test " x$( BUILT_PLUGINS) " ! = " x" ; then \
579
+ HTS_PATH=. test/with-shlib.sh test/plugins-dlhts -g ./libhts.$(SHLIB_FLAVOUR ) ; \
580
+ fi
581
+ if test " x$( BUILT_PLUGINS) " ! = " x" ; then \
582
+ HTS_PATH=. test/with-shlib.sh test/plugins-dlhts -l ./libhts.$(SHLIB_FLAVOUR ) ; \
583
+ fi
538
584
test/test_bgzf test/bgziptest.txt
539
585
test/test-parse-reg -t test/colons.bam
540
586
cd test/sam_filter && ./filter.sh filter.tst
@@ -597,6 +643,9 @@ test/test-parse-reg: test/test-parse-reg.o libhts.a
597
643
test/test_str2int : test/test_str2int.o libhts.a
598
644
$(CC ) $(LDFLAGS ) -o $@ test/test_str2int.o libhts.a $(LIBS ) -lpthread
599
645
646
+ test/test_time_funcs : test/test_time_funcs.o
647
+ $(CC ) $(LDFLAGS ) -o $@ test/test_time_funcs.o
648
+
600
649
test/test_view : test/test_view.o libhts.a
601
650
$(CC ) $(LDFLAGS ) -o $@ test/test_view.o libhts.a $(LIBS ) -lpthread
602
651
@@ -618,6 +667,9 @@ test/test-bcf-translate: test/test-bcf-translate.o libhts.a
618
667
test/test_introspection : test/test_introspection.o libhts.a
619
668
$(CC ) $(LDFLAGS ) -o $@ test/test_introspection.o libhts.a $(LIBS ) -lpthread
620
669
670
+ test/test-bcf_set_variant_type : test/test-bcf_set_variant_type.o libhts.a
671
+ $(CC ) $(LDFLAGS ) -o $@ test/test-bcf_set_variant_type.o libhts.a $(LIBS ) -lpthread
672
+
621
673
# Extra tests for bundled htscodecs
622
674
test_htscodecs_rans4x8 : htscodecs/tests/rans4x8
623
675
cd htscodecs/tests && srcdir=. && export srcdir && ./rans4x8.test
@@ -685,13 +737,15 @@ test/test-parse-reg.o: test/test-parse-reg.c config.h $(htslib_hts_h) $(htslib_s
685
737
test/test_realn.o : test/test_realn.c config.h $(htslib_hts_h ) $(htslib_sam_h ) $(htslib_faidx_h )
686
738
test/test-regidx.o : test/test-regidx.c config.h $(htslib_kstring_h ) $(htslib_regidx_h ) $(htslib_hts_defs_h ) $(textutils_internal_h )
687
739
test/test_str2int.o : test/test_str2int.c config.h $(textutils_internal_h )
740
+ test/test_time_funcs.o : test/test_time_funcs.c config.h $(hts_time_funcs_h )
688
741
test/test_view.o : test/test_view.c config.h $(cram_h ) $(htslib_sam_h ) $(htslib_vcf_h ) $(htslib_hts_log_h )
689
742
test/test_index.o : test/test_index.c config.h $(htslib_sam_h ) $(htslib_vcf_h )
690
743
test/test-vcf-api.o : test/test-vcf-api.c config.h $(htslib_hts_h ) $(htslib_vcf_h ) $(htslib_kstring_h ) $(htslib_kseq_h )
691
744
test/test-vcf-sweep.o : test/test-vcf-sweep.c config.h $(htslib_vcf_sweep_h )
692
745
test/test-bcf-sr.o : test/test-bcf-sr.c config.h $(htslib_synced_bcf_reader_h )
693
746
test/test-bcf-translate.o : test/test-bcf-translate.c config.h $(htslib_vcf_h )
694
747
test/test_introspection.o : test/test_introspection.c config.h $(htslib_hts_h ) $(htslib_hfile_h )
748
+ test/test-bcf_set_variant_type.o : test/test-bcf_set_variant_type.c config.h $(htslib_hts_h ) vcf.c
695
749
696
750
697
751
test/thrash_threads1 : test/thrash_threads1.o libhts.a
0 commit comments