Debian Codegraph @

Makefile

raw ◀ ▶
3 Debian patches touch this file
1 # Makefile for htslib, a C library for high-throughput sequencing data formats.
2 #
3 # Copyright (C) 2013-2024 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 -lcurl
31
32 CPPFLAGS =
33 # TODO: make the 64-bit support for VCF optional via configure, for now add -DVCF_ALLOW_INT64
34 # to CFLAGS manually, here or in config.mk if the latter exists.
35 # TODO: probably update cram code to make it compile cleanly with -Wc++-compat
36 # For testing strict C99 support add -std=c99 -D_XOPEN_SOURCE=600
37 #CFLAGS = -g -Wall -O2 -pedantic -std=c99 -D_XOPEN_SOURCE=600
38 CFLAGS = -g -Wall -O2 -fvisibility=hidden
•39 EXTRA_CFLAGS_PIC = -fPIC
40 TARGET_CFLAGS =
41 LDFLAGS = -fvisibility=hidden
42 VERSION_SCRIPT_LDFLAGS = -Wl,-version-script,$(srcprefix)htslib.map
43 LIBS = $(htslib_default_libs)
44
45 prefix = /usr/local
46 exec_prefix = $(prefix)
47 bindir = $(exec_prefix)/bin
48 includedir = $(prefix)/include
49 libdir = $(exec_prefix)/lib
50 libexecdir = $(exec_prefix)/libexec
51 datarootdir = $(prefix)/share
52 mandir = $(datarootdir)/man
53 man1dir = $(mandir)/man1
54 man5dir = $(mandir)/man5
55 man7dir = $(mandir)/man7
56 pkgconfigdir= $(libdir)/pkgconfig
57
58 MKDIR_P = mkdir -p
59 INSTALL = install -p
60 INSTALL_DATA = $(INSTALL) -m 644
61 INSTALL_DIR = $(MKDIR_P) -m 755
62 LIB_PERM = 644
63 INSTALL_LIB = $(INSTALL) -m $(LIB_PERM)
64 INSTALL_MAN = $(INSTALL_DATA)
65 INSTALL_PROGRAM = $(INSTALL)
66
67 # Set by config.mk if plugins are enabled
68 plugindir =
69
70 BUILT_PROGRAMS = \
71 annot-tsv \
72 bgzip \
73 htsfile \
74 tabix
75
76 BUILT_TEST_PROGRAMS = \
77 test/hts_endian \
78 test/fieldarith \
79 test/hfile \
80 test/pileup \
81 test/pileup_mod \
82 test/plugins-dlhts \
83 test/sam \
84 test/test_bgzf \
85 test/test_expr \
86 test/test_faidx \
87 test/test_kfunc \
88 test/test_khash \
89 test/test_kstring \
90 test/test_mod \
91 test/test_nibbles \
92 test/test_realn \
93 test/test-regidx \
94 test/test_str2int \
95 test/test_time_funcs \
96 test/test_view \
97 test/test_index \
98 test/test-vcf-api \
99 test/test-vcf-sweep \
100 test/test-bcf-sr \
101 test/fuzz/hts_open_fuzzer.o \
102 test/test-bcf-translate \
103 test/test-parse-reg \
104 test/test_introspection \
105 test/test-bcf_set_variant_type
106
107 BUILT_THRASH_PROGRAMS = \
108 test/thrash_threads1 \
109 test/thrash_threads2 \
110 test/thrash_threads3 \
111 test/thrash_threads4 \
112 test/thrash_threads5 \
113 test/thrash_threads6 \
114 test/thrash_threads7
115
116 all: lib-static lib-shared $(BUILT_PROGRAMS) plugins \
117 $(BUILT_TEST_PROGRAMS) htslib_static.mk htslib-uninstalled.pc
118
119 # Report compiler and version
120 cc-version:
121 -@$(CC) --version 2>/dev/null || true
122 -@$(CC) --qversion 2>/dev/null || true
123 -@$(CC) -V 2>/dev/null || true
124
125 ALL_CPPFLAGS = -I. $(CPPFLAGS)
126
127 # Usually htscodecs.mk is generated by running configure or config.status,
128 # but if those aren't used create a default here.
129 htscodecs.mk:
130 echo '# Default htscodecs.mk generated by Makefile' > $@
131 echo 'include $$(HTSPREFIX)htscodecs_bundled.mk' >> $@
132 $(srcdir)/hts_probe_cc.sh '$(CC)' '$(CFLAGS) $(CPPFLAGS)' '$(LDFLAGS)' >> $@
133
134 srcdir = .
135 srcprefix =
136 HTSPREFIX =
137
138 # Flags for SIMD code
139 HTS_CFLAGS_AVX2 =
140 HTS_CFLAGS_AVX512 =
141 HTS_CFLAGS_SSE4 =
142
143 # Control building of SIMD code. Not used if configure has been run.
144 HTS_BUILD_AVX2 =
145 HTS_BUILD_AVX512 =
146 HTS_BUILD_SSE4 =
147
148 include htslib_vars.mk
149 include htscodecs.mk
150
151 # If not using GNU make, you need to copy the version number from version.sh
152 # into here.
153 PACKAGE_VERSION := $(shell $(srcdir)/version.sh)
154
155 LIBHTS_SOVERSION = 3
156
157 # Version numbers for the Mac dynamic library. Note that the leading 3
158 # is not strictly necessary and should be removed the next time
159 # LIBHTS_SOVERSION is bumped (see #1144 and
160 # 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.22
162 MACH_O_CURRENT_VERSION = 3.1.22
163
164 # Force version.h to be remade if $(PACKAGE_VERSION) has changed.
165 version.h: $(if $(wildcard version.h),$(if $(findstring "$(PACKAGE_VERSION)",$(shell cat version.h)),,force))
166
167 version.h:
168 echo '#define HTS_VERSION_TEXT "$(PACKAGE_VERSION)"' > $@
169
170 print-version:
171 @echo $(PACKAGE_VERSION)
172
173 show-version:
174 @echo PACKAGE_VERSION = $(PACKAGE_VERSION)
175
176 config_vars.h: override escape=$(subst ',\x27,$(subst ",\",$(subst \,\\,$(1))))
177 config_vars.h: override hts_cc_escaped=$(call escape,$(CC))
178 config_vars.h: override hts_cppflags_escaped=$(call escape,$(CPPFLAGS))
179 config_vars.h: override hts_cflags_escaped=$(call escape,$(CFLAGS))
180 config_vars.h: override hts_ldflags_escaped=$(call escape,$(LDFLAGS))
181 config_vars.h: override hts_libs_escaped=$(call escape,$(LIBS))
182
183 config_vars.h:
184 printf '#define HTS_CC "%s"\n#define HTS_CPPFLAGS "%s"\n#define HTS_CFLAGS "%s"\n#define HTS_LDFLAGS "%s"\n#define HTS_LIBS "%s"\n' \
185 '$(hts_cc_escaped)' \
186 '$(hts_cppflags_escaped)' \
187 '$(hts_cflags_escaped)' \
188 '$(hts_ldflags_escaped)' \
•189 '$(hts_libs_escaped)' \
190 | sed 's/-ffile-prefix-map=[^ ]*=.//' \
191 > $@
192
193 .SUFFIXES: .bundle .c .cygdll .dll .o .pico .so
194
195 .c.o:
196 $(CC) $(CFLAGS) $(TARGET_CFLAGS) $(ALL_CPPFLAGS) -c -o $@ $<
197
198 .c.pico:
199 $(CC) $(CFLAGS) $(TARGET_CFLAGS) $(ALL_CPPFLAGS) $(EXTRA_CFLAGS_PIC) -c -o $@ $<
200
201 ref_cache/%.o: ref_cache/%.c
202 $(CC) $(CFLAGS) $(REF_CACHE_EXTRA_C_FLAGS) $(TARGET_CFLAGS) $(ALL_CPPFLAGS) -c -o $@ $<
203
204 LIBHTS_OBJS = \
205 kfunc.o \
206 kstring.o \
207 bcf_sr_sort.o \
208 bgzf.o \
209 errmod.o \
210 faidx.o \
211 header.o \
212 hfile.o \
213 hts.o \
214 hts_expr.o \
215 hts_os.o\
216 md5.o \
217 multipart.o \
218 probaln.o \
219 realn.o \
220 regidx.o \
221 region.o \
222 sam.o \
223 sam_mods.o \
224 simd.o \
225 synced_bcf_reader.o \
226 vcf_sweep.o \
227 tbx.o \
228 textutils.o \
229 thread_pool.o \
230 vcf.o \
231 vcfutils.o \
232 cram/cram_codecs.o \
233 cram/cram_decode.o \
234 cram/cram_encode.o \
235 cram/cram_external.o \
236 cram/cram_index.o \
237 cram/cram_io.o \
238 cram/cram_stats.o \
239 cram/mFILE.o \
240 cram/open_trace_file.o \
241 cram/pooled_alloc.o \
242 cram/string_alloc.o \
243 $(HTSCODECS_OBJS) \
244 $(NONCONFIGURE_OBJS)
245
246 REF_CACHE_OBJS = ref_cache/cmsg_wrap.o \
247 ref_cache/http_parser.o \
248 ref_cache/listener.o \
249 ref_cache/log_files.o \
250 ref_cache/main.o \
251 ref_cache/misc.o \
252 ref_cache/ping.o \
253 ref_cache/poll_wrap_epoll.o \
254 ref_cache/poll_wrap_poll.o \
255 ref_cache/ref_files.o \
256 ref_cache/request_handler.o \
257 ref_cache/sendfile_wrap.o \
258 ref_cache/server.o \
259 ref_cache/transaction.o \
260 ref_cache/upstream.o \
261 cram/pooled_alloc.o \
262 md5.o
263
264 # Without configure we wish to have a rich set of default figures,
265 # but we still need conditional inclusion as we wish to still
266 # support ./configure --disable-blah.
267 NONCONFIGURE_OBJS = hfile_libcurl.o
268
269 PLUGIN_EXT =
270 PLUGIN_OBJS =
271
272 cram_h = cram/cram.h $(cram_samtools_h) $(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)
273 cram_io_h = cram/cram_io.h $(cram_misc_h)
274 cram_misc_h = cram/misc.h
275 cram_os_h = cram/os.h $(htslib_hts_endian_h)
276 cram_samtools_h = cram/cram_samtools.h $(htslib_sam_h)
277 cram_structs_h = cram/cram_structs.h $(htslib_thread_pool_h) $(htslib_cram_h) cram/string_alloc.h cram/mFILE.h $(htslib_khash_h)
278 cram_open_trace_file_h = cram/open_trace_file.h cram/mFILE.h
279 bcf_sr_sort_h = bcf_sr_sort.h $(htslib_synced_bcf_reader_h) $(htslib_kbitset_h)
280 fuzz_settings_h = fuzz_settings.h
281 header_h = header.h cram/string_alloc.h cram/pooled_alloc.h $(htslib_khash_h) $(htslib_kstring_h) $(htslib_sam_h)
282 hfile_internal_h = hfile_internal.h $(htslib_hts_defs_h) $(htslib_hfile_h) $(textutils_internal_h)
283 hts_internal_h = hts_internal.h $(htslib_hts_h) $(textutils_internal_h)
284 hts_time_funcs_h = hts_time_funcs.h
285 sam_internal_h = sam_internal.h $(htslib_sam_h)
286 textutils_internal_h = textutils_internal.h $(htslib_kstring_h)
287 thread_pool_internal_h = thread_pool_internal.h $(htslib_thread_pool_h)
288
289 # To be effective, config.mk needs to appear after most Makefile variables are
290 # set but before most rules appear, so that it can both use previously-set
291 # variables in its own rules' prerequisites and also update variables for use
292 # in later rules' prerequisites.
293
294 # If your make doesn't accept -include, change this to 'include' if you are
295 # using the configure script or just comment the line out if you are not.
296 -include config.mk
297
298 # Add optional built programs here
299 all: $(REF_CACHE_PROGRAMS)
300
301 # Usually config.h is generated by running configure or config.status,
302 # but if those aren't used create a default config.h here.
303 config.h:
304 echo '/* Default config.h generated by Makefile */' > $@
305 echo '#ifndef _XOPEN_SOURCE' >> $@
306 echo '#define _XOPEN_SOURCE 600' >> $@
307 echo '#endif' >> $@
308 echo '#define HAVE_LIBBZ2 1' >> $@
309 echo '#define HAVE_LIBLZMA 1' >> $@
310 echo '#ifndef __APPLE__' >> $@
311 echo '#define HAVE_LZMA_H 1' >> $@
312 echo '#endif' >> $@
313 echo '#define HAVE_DRAND48 1' >> $@
314 echo '#define HAVE_LIBCURL 1' >> $@
315 if [ "x$(HTS_HAVE_CPUID)" != "x" ]; then \
316 echo '#define HAVE_DECL___CPUID_COUNT 1' >> $@ ; \
317 echo '#define HAVE_DECL___GET_CPUID_MAX 1' >> $@ ; \
318 fi
319 if [ "x$(HTS_BUILD_SSE4)" != "x" ]; then \
320 echo '#define HAVE_POPCNT 1' >> $@ ; \
321 echo '#define HAVE_SSE4_1 1' >> $@ ; \
322 echo '#define HAVE_SSSE3 1' >> $@ ; \
323 echo '#if defined(HTS_ALLOW_UNALIGNED) && HTS_ALLOW_UNALIGNED == 0' >> $@ ; \
324 echo '#define UBSAN 1' >> $@ ; \
325 echo '#endif' >> $@ ; \
326 fi
327 if [ "x$(HTS_BUILD_AVX2)" != "x" ] ; then \
328 echo '#define HAVE_AVX2 1' >> $@ ; \
329 fi
330 if [ "x$(HTS_BUILD_AVX512)" != "x" ] ; then \
331 echo '#define HAVE_AVX512 1' >> $@ ; \
332 fi
333 echo '#if defined __x86_64__ || defined __arm__ || defined __aarch64__' >> $@
334 echo '#define HAVE_ATTRIBUTE_CONSTRUCTOR 1' >> $@
335 echo '#endif' >> $@
336 echo '#if (defined(__x86_64__) || defined(_M_X64))' >> $@
337 echo '#define HAVE_ATTRIBUTE_TARGET_SSSE3 1' >> $@
338 echo '#define HAVE_BUILTIN_CPU_SUPPORT_SSSE3 1' >> $@
339 echo '#endif' >> $@
340 echo '#if defined __linux__' >> $@
341 echo '#define HAVE_GETAUXVAL' >> $@
342 echo '#elif defined __FreeBSD__' >> $@
343 echo '#define HAVE_ELF_AUX_INFO' >> $@
344 echo '#elif defined __OpenBSD__' >> $@
345 echo '// Enable extra OpenBSD checks (see simd.c)' >> $@
346 echo '#define HAVE_OPENBSD' >> $@
347 echo '#endif' >> $@
348
349 # And similarly for htslib.pc.tmp ("pkg-config template"). No dependency
350 # on htslib.pc.in listed, as if that file is newer the usual way to regenerate
351 # this target is via configure or config.status rather than this rule.
352 htslib.pc.tmp:
353 sed -e '/^static_libs=/s/@static_LIBS@/$(htslib_default_libs)/;s#@[^-][^@]*@##g' $(srcprefix)htslib.pc.in > $@
354
355 # Create a makefile fragment listing the libraries and LDFLAGS needed for
356 # static linking. This can be included by projects that want to build
357 # and link against the htslib source tree instead of an installed library.
358 htslib_static.mk: htslib.pc.tmp
359 sed -n '/^static_libs=/s/[^=]*=/HTSLIB_static_LIBS = /p;/^static_ldflags=/s/[^=]*=/HTSLIB_static_LDFLAGS = /p' $< > $@
360
361
362 lib-static: libhts.a
363
364 # $(shell), :=, and ifeq/.../endif are GNU Make-specific. If you don't have
365 # GNU Make, comment out the parts of these conditionals that don't apply.
366 ifneq "$(origin PLATFORM)" "file"
367 PLATFORM := $(shell uname -s)
368 endif
369 ifeq "$(PLATFORM)" "Darwin"
370 SHLIB_FLAVOUR = dylib
371 lib-shared: libhts.dylib
372 else ifeq "$(findstring CYGWIN,$(PLATFORM))" "CYGWIN"
373 SHLIB_FLAVOUR = cygdll
374 lib-shared: cyghts-$(LIBHTS_SOVERSION).dll
375 else ifeq "$(findstring MSYS,$(PLATFORM))" "MSYS"
376 SHLIB_FLAVOUR = dll
377 lib-shared: hts-$(LIBHTS_SOVERSION).dll hts-$(LIBHTS_SOVERSION).def hts-$(LIBHTS_SOVERSION).lib
378 else ifeq "$(findstring MINGW,$(PLATFORM))" "MINGW"
379 SHLIB_FLAVOUR = dll
380 lib-shared: hts-$(LIBHTS_SOVERSION).dll hts-$(LIBHTS_SOVERSION).def hts-$(LIBHTS_SOVERSION).lib
381 else
382 SHLIB_FLAVOUR = so
383 lib-shared: libhts.so
384 endif
385
386 BUILT_PLUGINS = $(PLUGIN_OBJS:.o=$(PLUGIN_EXT))
387
388 ifneq "$(BUILT_PLUGINS)" ""
389 plugins: lib-shared
390 endif
391 plugins: $(BUILT_PLUGINS)
392
393
394 libhts.a: $(LIBHTS_OBJS)
395 @-rm -f $@
396 $(AR) -rc $@ $(LIBHTS_OBJS)
397 -$(RANLIB) $@
398
399 print-config:
400 @echo HTS_CFLAGS_AVX2 = $(HTS_CFLAGS_AVX2)
401 @echo HTS_CFLAGS_AVX512 = $(HTS_CFLAGS_AVX512)
402 @echo HTS_CFLAGS_SSE4 = $(HTS_CFLAGS_SSE4)
403 @echo LDFLAGS = $(LDFLAGS)
404 @echo LIBHTS_OBJS = $(LIBHTS_OBJS)
405 @echo LIBS = $(LIBS)
406 @echo PLATFORM = $(PLATFORM)
407
408 # The target here is libhts.so, as that is the built file that other rules
409 # depend upon and that is used when -lhts appears in other program's recipes.
410 # As a byproduct invisible to make, libhts.so.NN is also created, as it is the
411 # file used at runtime (when $LD_LIBRARY_PATH includes the build directory).
412
413 libhts.so: $(LIBHTS_OBJS:.o=.pico)
414 $(CC) -shared -Wl,-soname,libhts.so.$(LIBHTS_SOVERSION) $(VERSION_SCRIPT_LDFLAGS) $(LDFLAGS) -o $@ $(LIBHTS_OBJS:.o=.pico) $(LIBS) -lpthread
415 ln -sf $@ libhts.so.$(LIBHTS_SOVERSION)
416
417 # Similarly this also creates libhts.NN.dylib as a byproduct, so that programs
418 # when run can find this uninstalled shared library (when $DYLD_LIBRARY_PATH
419 # includes this project's build directory).
420
421 libhts.dylib: $(LIBHTS_OBJS)
422 $(CC) -dynamiclib -install_name $(libdir)/libhts.$(LIBHTS_SOVERSION).dylib -current_version $(MACH_O_CURRENT_VERSION) -compatibility_version $(MACH_O_COMPATIBILITY_VERSION) $(LDFLAGS) -o $@ $(LIBHTS_OBJS) $(LIBS)
423 ln -sf $@ libhts.$(LIBHTS_SOVERSION).dylib
424
425 cyghts-$(LIBHTS_SOVERSION).dll libhts.dll.a: $(LIBHTS_OBJS)
426 $(CC) -shared -Wl,--out-implib=libhts.dll.a -Wl,--enable-auto-import $(LDFLAGS) -o $@ -Wl,--whole-archive $(LIBHTS_OBJS) -Wl,--no-whole-archive $(LIBS) -lpthread
427
428 hts-$(LIBHTS_SOVERSION).dll hts.dll.a: $(LIBHTS_OBJS)
429 $(CC) -shared -Wl,--out-implib=hts.dll.a -Wl,--enable-auto-import -Wl,--exclude-all-symbols $(LDFLAGS) -o $@ -Wl,--whole-archive $(LIBHTS_OBJS) -Wl,--no-whole-archive $(LIBS) -lpthread
430
431 hts-$(LIBHTS_SOVERSION).def: hts-$(LIBHTS_SOVERSION).dll
432 gendef hts-$(LIBHTS_SOVERSION).dll
433
434 hts-$(LIBHTS_SOVERSION).lib: hts-$(LIBHTS_SOVERSION).def
435 dlltool -m i386:x86-64 -d hts-$(LIBHTS_SOVERSION).def -l hts-$(LIBHTS_SOVERSION).lib
436
437 # Bundling libraries, binaries, dll dependencies, and licenses into a
438 # single directory. NB: This is not needed for end-users, but a test bed
439 # for maintainers building binary distributions.
440 #
441 # NOTE: only tested on the supported MSYS2/MINGW64 environment.
442 dist-windows: DESTDIR=
443 dist-windows: prefix=dist-windows
444 dist-windows: install
445 cp hts-$(LIBHTS_SOVERSION).def hts-$(LIBHTS_SOVERSION).lib dist-windows/lib
446 cp `ldd hts-$(LIBHTS_SOVERSION).dll| awk '/mingw64/ {print $$3}'` dist-windows/bin
447 mkdir -p dist-windows/share/licenses/htslib
448 -cp -r /mingw64/share/licenses/mingw-w64-libraries \
449 /mingw64/share/licenses/brotli \
450 /mingw64/share/licenses/bzip2 \
451 /mingw64/share/licenses/gcc-libs \
452 /mingw64/share/licenses/libdeflate \
453 /mingw64/share/licenses/libpsl \
454 /mingw64/share/licenses/libtre \
455 /mingw64/share/licenses/libwinpthread \
456 /mingw64/share/licenses/openssl \
457 /mingw64/share/licenses/xz \
458 /mingw64/share/licenses/zlib \
459 /mingw64/share/licenses/zstd \
460 dist-windows/share/licenses/
461 -cp -r /usr/share/licenses/curl \
462 dist-windows/share/licenses/
463 cp LICENSE dist-windows/share/licenses/htslib/
464
465
466 # Target to allow htslib.mk to build all the object files before it
467 # links the shared and static libraries.
468 hts-object-files: $(LIBHTS_OBJS)
469 touch $@
470
471 # On Unix dlopen("libhts.so.NN", RTLD_LAZY) may default to RTLD_LOCAL.
472 # Hence plugins need to link to (shared) libhts.so.NN themselves, as they
473 # may not be able to access libhts symbols via the main program's libhts
474 # if that was dynamically loaded without an explicit RTLD_GLOBAL.
475 %.so: %.pico libhts.so
476 $(CC) -shared -Wl,-E $(LDFLAGS) -o $@ $< libhts.so $(LIBS) -lpthread
477
478 # For programs *statically* linked to libhts.a, on macOS loading a plugin
479 # linked to a shared libhts.NN.dylib would lead to conflicting duplicate
480 # symbols. Fortunately macOS dlopen() defaults to RTLD_GLOBAL so there
481 # is less need for plugins to link back to libhts themselves.
482 %.bundle: %.o
483 $(CC) -bundle -Wl,-undefined,dynamic_lookup $(LDFLAGS) -o $@ $< $(LIBS)
484
485 %.cygdll: %.o libhts.dll.a
486 $(CC) -shared $(LDFLAGS) -o $@ $< libhts.dll.a $(LIBS)
487
488 %.dll: %.o hts.dll.a
489 $(CC) -shared $(LDFLAGS) -o $@ $< hts.dll.a $(LIBS)
490
491
492 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 $(hts_internal_h) $(htslib_khash_h)
493 errmod.o errmod.pico: errmod.c config.h $(htslib_hts_h) $(htslib_ksort_h) $(htslib_hts_os_h)
494 kstring.o kstring.pico: kstring.c config.h $(htslib_kstring_h)
495 header.o header.pico: header.c config.h $(textutils_internal_h) $(header_h)
496 hfile.o hfile.pico: hfile.c config.h $(htslib_hfile_h) $(hfile_internal_h) $(htslib_kstring_h) $(hts_internal_h) $(htslib_khash_h)
497 hfile_gcs.o hfile_gcs.pico: hfile_gcs.c config.h $(htslib_hts_h) $(htslib_kstring_h) $(hfile_internal_h)
498 hfile_libcurl.o hfile_libcurl.pico: hfile_libcurl.c config.h $(hfile_internal_h) $(htslib_hts_h) $(htslib_kstring_h) $(htslib_khash_h)
499 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)
500 hfile_s3.o hfile_s3.pico: hfile_s3.c config.h $(hfile_internal_h) $(htslib_hts_h) $(htslib_kstring_h) $(hts_time_funcs_h)
501 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)
502 hts_expr.o hts_expr.pico: hts_expr.c config.h $(htslib_hts_expr_h) $(htslib_hts_log_h) $(textutils_internal_h)
503 hts_os.o hts_os.pico: hts_os.c config.h $(htslib_hts_defs_h) os/rand.c
504 vcf.o vcf.pico: vcf.c config.h $(fuzz_settings_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)
505 sam.o sam.pico: sam.c config.h $(fuzz_settings_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)
506 sam_mods.o sam_mods.pico: sam_mods.c config.h $(htslib_sam_h) $(textutils_internal_h)
507 simd.o simd.pico: simd.c config.h $(htslib_sam_h) $(sam_internal_h)
508 tbx.o tbx.pico: tbx.c config.h $(htslib_tbx_h) $(htslib_bgzf_h) $(htslib_hts_endian_h) $(hts_internal_h) $(htslib_khash_h)
509 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)
510 bcf_sr_sort.o bcf_sr_sort.pico: bcf_sr_sort.c config.h $(bcf_sr_sort_h) $(htslib_khash_str2int_h) $(htslib_kbitset_h)
511 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)
512 vcf_sweep.o vcf_sweep.pico: vcf_sweep.c config.h $(htslib_vcf_sweep_h) $(htslib_bgzf_h)
513 vcfutils.o vcfutils.pico: vcfutils.c config.h $(htslib_vcfutils_h) $(htslib_kbitset_h)
514 kfunc.o kfunc.pico: kfunc.c config.h $(htslib_kfunc_h)
515 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)
516 region.o region.pico: region.c config.h $(htslib_hts_h) $(htslib_khash_h)
517 md5.o md5.pico: md5.c config.h $(htslib_hts_h) $(htslib_hts_endian_h)
518 multipart.o multipart.pico: multipart.c config.h $(htslib_kstring_h) $(hts_internal_h) $(hfile_internal_h)
519 plugin.o plugin.pico: plugin.c config.h $(hts_internal_h) $(htslib_kstring_h)
520 probaln.o probaln.pico: probaln.c config.h $(htslib_hts_h)
521 realn.o realn.pico: realn.c config.h $(htslib_hts_h) $(htslib_sam_h)
522 textutils.o textutils.pico: textutils.c config.h $(htslib_hfile_h) $(htslib_kstring_h) $(htslib_sam_h) $(hts_internal_h)
523
524 cram/cram_codecs.o cram/cram_codecs.pico: cram/cram_codecs.c config.h $(fuzz_settings_h) $(htslib_hts_endian_h) $(htscodecs_varint_h) $(htscodecs_pack_h) $(htscodecs_rle_h) $(cram_h)
525 cram/cram_decode.o cram/cram_decode.pico: cram/cram_decode.c config.h $(cram_h) $(cram_os_h) $(htslib_hts_h)
526 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)
527 cram/cram_external.o cram/cram_external.pico: cram/cram_external.c config.h $(htscodecs_rANS_static4x16_h) $(htslib_hfile_h) $(cram_h)
528 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)
529 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)
530 cram/cram_stats.o cram/cram_stats.pico: cram/cram_stats.c config.h $(cram_h) $(cram_os_h)
531 cram/mFILE.o cram/mFILE.pico: cram/mFILE.c config.h $(htslib_hts_log_h) $(cram_os_h) cram/mFILE.h
532 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) $(htslib_hts_h)
533 cram/pooled_alloc.o cram/pooled_alloc.pico: cram/pooled_alloc.c config.h cram/pooled_alloc.h $(cram_misc_h)
534 cram/string_alloc.o cram/string_alloc.pico: cram/string_alloc.c config.h cram/string_alloc.h
535 thread_pool.o thread_pool.pico: thread_pool.c config.h $(thread_pool_internal_h) $(htslib_hts_log_h) $(hts_internal_h)
536
537 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)
538 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)
539 htscodecs/htscodecs/htscodecs.o htscodecs/htscodecs/htscodecs.pico: htscodecs/htscodecs/htscodecs.c $(htscodecs_htscodecs_h) $(htscodecs_version_h)
540 htscodecs/htscodecs/pack.o htscodecs/htscodecs/pack.pico: htscodecs/htscodecs/pack.c config.h $(htscodecs_pack_h)
541 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)
542 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)
543 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)
544 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)
545 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)
546 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)
547 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)
548 htscodecs/htscodecs/rle.o htscodecs/htscodecs/rle.pico: htscodecs/htscodecs/rle.c config.h $(htscodecs_varint_h) $(htscodecs_rle_h)
549 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)
550 htscodecs/htscodecs/utils.o htscodecs/htscodecs/utils.pico: htscodecs/htscodecs/utils.c config.h $(htscodecs_utils_h)
551
552 # Extra CFLAGS for specific files
553 htscodecs/htscodecs/rANS_static32x16pr_avx2.o htscodecs/htscodecs/rANS_static32x16pr_avx2.pico: TARGET_CFLAGS = $(HTS_CFLAGS_AVX2)
554 htscodecs/htscodecs/rANS_static32x16pr_avx512.o htscodecs/htscodecs/rANS_static32x16pr_avx512.pico: TARGET_CFLAGS = $(HTS_CFLAGS_AVX512)
555 htscodecs/htscodecs/rANS_static32x16pr_sse4.o htscodecs/htscodecs/rANS_static32x16pr_sse4.pico: TARGET_CFLAGS = $(HTS_CFLAGS_SSE4)
556
557 annot-tsv: annot-tsv.o libhts.a
558 $(CC) $(LDFLAGS) -o $@ annot-tsv.o libhts.a $(LIBS) -lpthread
559
560 bgzip: bgzip.o libhts.a
•561 $(CC) $(LDFLAGS) -o $@ bgzip.o libhts.a $(LIBS) libhts.a -lpthread
562
563 htsfile: htsfile.o libhts.a
•564 $(CC) $(LDFLAGS) -o $@ htsfile.o libhts.a $(LIBS) libhts.a -lpthread
565
566 tabix: tabix.o libhts.a
•567 $(CC) $(LDFLAGS) -o $@ tabix.o libhts.a $(LIBS) libhts.a -lpthread
568
569 ref_cache/ref-cache: $(REF_CACHE_OBJS)
570 $(CC) $(LDFLAGS) $(REF_CACHE_EXTRA_LD_FLAGS) -o $@ $(REF_CACHE_OBJS) -lcurl
571
572 annot-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)
573 bgzip.o: bgzip.c config.h $(htslib_bgzf_h) $(htslib_hts_h) $(htslib_hfile_h)
574 htsfile.o: htsfile.c config.h $(htslib_hfile_h) $(htslib_hts_h) $(htslib_sam_h) $(htslib_vcf_h)
575 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) $(htslib_thread_pool_h)
576
577 # ref_cache dependencies
578 ref_cache_cmsg_wrap_h = ref_cache/cmsg_wrap.h
579 ref_cache_http_parser_h = ref_cache/http_parser.h $(htslib_hts_defs_h) $(ref_cache_types_h)
580 ref_cache_listener_h = ref_cache/listener.h $(ref_cache_types_h)
581 ref_cache_log_files_h = ref_cache/log_files.h $(htslib_hts_defs_h) $(ref_types_h)
582 ref_cache_misc_h = ref_cache/misc.h $(htslib_hts_defs_h)
583 ref_cache_options_h = ref_cache/options.h $(ref_cache_types_h)
584 ref_cache_ping_h = ref_cache/ping.h
585 ref_cache_poll_wrap_h = ref_cache/poll_wrap.h $(ref_cache_types_h)
586 ref_cache_ref_files_h = ref_cache/ref_files.h $(htslib_hts_defs_h) $(ref_cache_types_h)
587 ref_cache_request_handler_h = ref_cache/request_handler.h $(htslib_hts_defs_h) $(ref_cache_types_h)
588 ref_cache_sendfile_wrap_h = ref_cache/sendfile_wrap.h
589 ref_cache_server_h = ref_cache/server.h $(htslib_hts_defs_h) $(ref_cache_types_h)
590 ref_cache_transaction_h = ref_cache/transaction.h $(htslib_hts_defs_h) $(ref_cache_types_h)
591 ref_cache_types_h = ref_cache/types.h
592 ref_cache_upstream_h = ref_cache/upstream.h $(ref_cache_types_h)
593
594 ref_cache/cmsg_wrap.o: ref_cache/cmsg_wrap.c config.h $(ref_cache_cmsg_wrap_h)
595 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
596 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)
597 ref_cache/log_files.o: ref_cache/log_files.c config.h $(ref_cache_log_files_h) $(ref_cache_options_h)
598 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)
599 ref_cache/ping.o: ref_cache/ping.c config.h $(ref_cache_ping_h) $(ref_cache_misc_h) $(ref_cache_options_h)
600 ref_cache/poll_wrap_epoll.o: ref_cache/poll_wrap_epoll.c config.h $(ref_cache_poll_wrap_h) cram/pooled_alloc.h
601 ref_cache/poll_wrap_poll.o: ref_cache/poll_wrap_poll.c config.h $(ref_cache_poll_wrap_h) cram/pooled_alloc.h
602 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)
603 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)
604 ref_cache/sendfile_wrap.o: ref_cache/sendfile_wrap.c config.h $(ref_cache_sendfile_wrap_h)
605 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
606 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
607 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)
608
609 # Runes to check that the htscodecs submodule is present
610 ifdef HTSCODECS_SOURCES
611 htscodecs/htscodecs/%.c: | htscodecs/htscodecs
612 @if test -e htscodecs/.git && test ! -e "$@" ; then \
613 echo "Missing file '$@'" ; \
614 echo " - Do you need to update the htscodecs submodule?" ; \
615 false ; \
616 fi
617
618 htscodecs/htscodecs/%.h: | htscodecs/htscodecs
619 @if test -e htscodecs/.git && test ! -e "$@" ; then \
620 echo "Missing file '$@'" ; \
621 echo " - Do you need to update the htscodecs submodule?" ; \
622 false ; \
623 fi
624
625 htscodecs/htscodecs:
626 @if test -e .git ; then \
627 printf "\\n\\nError: htscodecs submodule files not present for htslib.\\n\
628 Try running: \\n\
629 git submodule update --init --recursive\\n\
630 in the top-level htslib directory and then re-run make.\\n\\n\\n" ; \
631 else \
632 printf "\\n\\nError: htscodecs submodule files not present and this is not a git checkout.\\n\
633 You have an incomplete distribution. Please try downloading one of the\\n\
634 official releases from https://www.htslib.org/\\n" ; \
635 fi
636 @false
637
638 # Build the htscodecs/htscodecs/version.h file if necessary
639 htscodecs/htscodecs/version.h: force | htscodecs/htscodecs
640 @if test -e $(srcdir)/htscodecs/.git && test -e $(srcdir)/htscodecs/configure.ac ; then \
641 vers=`cd $(srcdir)/htscodecs && git describe --always --dirty --match 'v[0-9]\.[0-9]*'` && \
642 case "$$vers" in \
643 v*) vers=$${vers#v} ;; \
644 *) iv=`awk '/^AC_INIT\(htscodecs,/ { match($$0, /[0-9]+(\.[0-9]+)*/); print substr($$0, RSTART, RLENGTH) }' $(srcdir)/htscodecs/configure.ac` ; vers="$$iv$${vers:+-g$$vers}" ;; \
645 esac ; \
646 if ! grep -s -q '"'"$$vers"'"' $@ ; then \
647 echo 'Updating $@ : #define HTSCODECS_VERSION_TEXT "'"$$vers"'"' ; \
648 echo '#define HTSCODECS_VERSION_TEXT "'"$$vers"'"' > $@ ; \
649 fi ; \
650 fi
651 endif
652
653 # Maintainer extra targets built
654 # - compile public headers as C++
655 # Maintainer source code checks
656 # - copyright boilerplate presence
657 # - tab and trailing space detection
658 maintainer-check: test/usepublic.o
659 test/maintainer/check_copyright.pl .
660 test/maintainer/check_spaces.pl .
661
662 # Look for untracked files in the git repository.
663 check-untracked:
664 @if test -e .git && git status --porcelain | grep '^\?'; then \
665 echo 'Untracked files detected (see above). Please either clean up, add to .gitignore, or for test output files consider naming them to match *.tmp or *.tmp.*' ; \
666 false ; \
667 fi
668
669 # Create a shorthand. We use $(SRC) or $(srcprefix) rather than $(srcdir)/
670 # for brevity in test and install rules, and so that build logs do not have
671 # ./ sprinkled throughout.
672 SRC = $(srcprefix)
673
674 # For tests that might use it, set $REF_PATH explicitly to use only reference
675 # areas within the test suite (or set it to ':' to use no reference areas).
676 #
677 # If using MSYS, avoid poor shell expansion via:
678 # MSYS2_ARG_CONV_EXCL="*" make check
679 check test: all $(HTSCODECS_TEST_TARGETS)
680 test/hts_endian
681 test/test_expr
682 test/test_kfunc
683 test/test_khash
684 test/test_kstring
685 test/test_nibbles -v
686 test/test_str2int
687 test/test_time_funcs
688 test/fieldarith test/fieldarith.sam
689 test/hfile
690 if test "x$(BUILT_PLUGINS)" != "x"; then \
691 HTS_PATH=. test/with-shlib.sh test/plugins-dlhts -g ./libhts.$(SHLIB_FLAVOUR); \
692 fi
693 if test "x$(BUILT_PLUGINS)" != "x"; then \
694 HTS_PATH=. test/with-shlib.sh test/plugins-dlhts -l ./libhts.$(SHLIB_FLAVOUR); \
695 fi
696 test/test_bgzf test/bgziptest.txt
697 test/test-parse-reg -t test/colons.bam
698 cd test/faidx && ./test-faidx.sh faidx.tst
699 cd test/sam_filter && ./filter.sh filter.tst
700 cd test/tabix && ./test-tabix.sh tabix.tst
701 cd test/mpileup && ./test-pileup.sh mpileup.tst
702 cd test/fastq && ./test-fastq.sh
703 cd test/base_mods && ./base-mods.sh base-mods.tst
704 REF_PATH=: test/sam test/ce.fa test/faidx/faidx.fa test/faidx/fastqs.fq
705 test/test-regidx
706 cd test && \
707 if test "x$(BUILT_PLUGINS)" != "x"; then \
708 REF_PATH=: HTS_PATH=.. ./with-shlib.sh ./test.pl $(REF_CACHE_TEST_OPTS) $${TEST_OPTS:-} ; \
709 else \
710 REF_PATH=: ./test.pl $(REF_CACHE_TEST_OPTS) $${TEST_OPTS:-} ; \
711 fi
712
713 test/hts_endian: test/hts_endian.o
714 $(CC) $(LDFLAGS) -o $@ test/hts_endian.o $(LIBS)
715
716 # To build the fuzzer, try:
717 # make CC="clang16 -fsanitize=address,undefined,fuzzer" \
718 # CFLAGS="-g -O3 -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION" \
719 # test/fuzz/hts_open_fuzzer
720 test/fuzz/hts_open_fuzzer: test/fuzz/hts_open_fuzzer.o libhts.a
721 $(CC) $(LDFLAGS) -o $@ test/fuzz/hts_open_fuzzer.o libhts.a $(LIBS) -lpthread
722
723 test/fieldarith: test/fieldarith.o libhts.a
724 $(CC) $(LDFLAGS) -o $@ test/fieldarith.o libhts.a $(LIBS) -lpthread
725
726 test/hfile: test/hfile.o libhts.a
727 $(CC) $(LDFLAGS) -o $@ test/hfile.o libhts.a $(LIBS) -lpthread
728
729 test/pileup: test/pileup.o libhts.a
730 $(CC) $(LDFLAGS) -o $@ test/pileup.o libhts.a $(LIBS) -lpthread
731
732 test/pileup_mod: test/pileup_mod.o libhts.a
733 $(CC) $(LDFLAGS) -o $@ test/pileup_mod.o libhts.a $(LIBS) -lpthread
734
735 test/plugins-dlhts: test/plugins-dlhts.o
736 $(CC) $(LDFLAGS) -o $@ test/plugins-dlhts.o $(LIBS)
737
738 test/sam: test/sam.o libhts.a
739 $(CC) $(LDFLAGS) -o $@ test/sam.o libhts.a $(LIBS) -lpthread
740
741 test/test_bgzf: test/test_bgzf.o libhts.a
742 $(CC) $(LDFLAGS) -o $@ test/test_bgzf.o libhts.a $(LIBS) -lpthread
743
744 test/test_expr: test/test_expr.o libhts.a
745 $(CC) $(LDFLAGS) -o $@ test/test_expr.o libhts.a $(LIBS) -lpthread
746
747 test/test_faidx: test/test_faidx.o libhts.a
748 $(CC) $(LDFLAGS) -o $@ test/test_faidx.o libhts.a $(LIBS) -lpthread
749
750 test/test_kfunc: test/test_kfunc.o libhts.a
751 $(CC) $(LDFLAGS) -o $@ test/test_kfunc.o libhts.a $(LIBS) -lpthread
752
753 test/test_khash: test/test_khash.o libhts.a
754 $(CC) $(LDFLAGS) -o $@ test/test_khash.o libhts.a $(LIBS) -lpthread
755
756 test/test_kstring: test/test_kstring.o libhts.a
757 $(CC) $(LDFLAGS) -o $@ test/test_kstring.o libhts.a $(LIBS) -lpthread
758
759 test/test_mod: test/test_mod.o libhts.a
760 $(CC) $(LDFLAGS) -o $@ test/test_mod.o libhts.a $(LIBS) -lpthread
761
762 test/test_nibbles: test/test_nibbles.o libhts.a
763 $(CC) $(LDFLAGS) -o $@ test/test_nibbles.o libhts.a $(LIBS) -lpthread
764
765 test/test_realn: test/test_realn.o libhts.a
766 $(CC) $(LDFLAGS) -o $@ test/test_realn.o libhts.a $(LIBS) -lpthread
767
768 test/test-regidx: test/test-regidx.o libhts.a
769 $(CC) $(LDFLAGS) -o $@ test/test-regidx.o libhts.a $(LIBS) -lpthread
770
771 test/test-parse-reg: test/test-parse-reg.o libhts.a
772 $(CC) $(LDFLAGS) -o $@ test/test-parse-reg.o libhts.a $(LIBS) -lpthread
773
774 test/test_str2int: test/test_str2int.o libhts.a
775 $(CC) $(LDFLAGS) -o $@ test/test_str2int.o libhts.a $(LIBS) -lpthread
776
777 test/test_time_funcs: test/test_time_funcs.o
778 $(CC) $(LDFLAGS) -o $@ test/test_time_funcs.o
779
780 test/test_view: test/test_view.o libhts.a
781 $(CC) $(LDFLAGS) -o $@ test/test_view.o libhts.a $(LIBS) -lpthread
782
783 test/test_index: test/test_index.o libhts.a
784 $(CC) $(LDFLAGS) -o $@ test/test_index.o libhts.a $(LIBS) -lpthread
785
786 test/test-vcf-api: test/test-vcf-api.o libhts.a
787 $(CC) $(LDFLAGS) -o $@ test/test-vcf-api.o libhts.a $(LIBS) -lpthread
788
789 test/test-vcf-sweep: test/test-vcf-sweep.o libhts.a
790 $(CC) $(LDFLAGS) -o $@ test/test-vcf-sweep.o libhts.a $(LIBS) -lpthread
791
792 test/test-bcf-sr: test/test-bcf-sr.o libhts.a
793 $(CC) $(LDFLAGS) -o $@ test/test-bcf-sr.o libhts.a $(LIBS) -lpthread
794
795 test/test-bcf-translate: test/test-bcf-translate.o libhts.a
796 $(CC) $(LDFLAGS) -o $@ test/test-bcf-translate.o libhts.a $(LIBS) -lpthread
797
798 test/test_introspection: test/test_introspection.o libhts.a
799 $(CC) $(LDFLAGS) -o $@ test/test_introspection.o libhts.a $(LIBS) -lpthread
800
801 test/test-bcf_set_variant_type: test/test-bcf_set_variant_type.o libhts.a
802 $(CC) $(LDFLAGS) -o $@ test/test-bcf_set_variant_type.o libhts.a $(LIBS) -lpthread
803
804 # Extra tests for bundled htscodecs
805 test_htscodecs_rans4x8: htscodecs/tests/rans4x8
806 cd htscodecs/tests && srcdir=. && export srcdir && ./rans4x8.test
807
808 test_htscodecs_rans4x16: htscodecs/tests/rans4x16pr
809 cd htscodecs/tests && srcdir=. && export srcdir && ./rans4x16.test
810
811 test_htscodecs_arith: htscodecs/tests/arith_dynamic
812 cd htscodecs/tests && srcdir=. && export srcdir && ./arith.test
813
814 test_htscodecs_tok3: htscodecs/tests/tokenise_name3
815 cd htscodecs/tests && srcdir=. && export srcdir && ./tok3.test
816
817 test_htscodecs_fqzcomp: htscodecs/tests/fqzcomp_qual
818 cd htscodecs/tests && srcdir=. && export srcdir && ./fqzcomp.test
819
820 test_htscodecs_varint: htscodecs/tests/varint
821 cd htscodecs/tests && ./varint
822
823 htscodecs/tests/arith_dynamic: htscodecs/tests/arith_dynamic_test.o $(HTSCODECS_OBJS)
824 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) -lm -lpthread
825
826 htscodecs/tests/fqzcomp_qual: htscodecs/tests/fqzcomp_qual_test.o $(HTSCODECS_OBJS)
827 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) -lm -lpthread
828
829 htscodecs/tests/rans4x16pr: htscodecs/tests/rANS_static4x16pr_test.o $(HTSCODECS_OBJS)
830 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) -lm -lpthread
831
832 htscodecs/tests/rans4x8: htscodecs/tests/rANS_static_test.o $(HTSCODECS_OBJS)
833 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) -lm -lpthread
834
835 htscodecs/tests/tokenise_name3: htscodecs/tests/tokenise_name3_test.o $(HTSCODECS_OBJS)
836 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) -lm -lpthread
837
838 htscodecs/tests/varint: htscodecs/tests/varint_test.o $(HTSCODECS_OBJS)
839 $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) -lm -lpthread
840
841 htscodecs/tests/arith_dynamic_test.o: CPPFLAGS += -Ihtscodecs
842 htscodecs/tests/arith_dynamic_test.o: htscodecs/tests/arith_dynamic_test.c config.h $(htscodecs_arith_dynamic_h)
843 htscodecs/tests/fqzcomp_qual_test.o: CPPFLAGS += -Ihtscodecs
844 htscodecs/tests/fqzcomp_qual_test.o: htscodecs/tests/fqzcomp_qual_test.c config.h $(htscodecs_fqzcomp_qual_h) $(htscodecs_varint_h)
845 htscodecs/tests/rANS_static4x16pr_test.o: CPPFLAGS += -Ihtscodecs
846 htscodecs/tests/rANS_static4x16pr_test.o: htscodecs/tests/rANS_static4x16pr_test.c config.h $(htscodecs_rANS_static4x16_h)
847 htscodecs/tests/rANS_static_test.o: CPPFLAGS += -Ihtscodecs
848 htscodecs/tests/rANS_static_test.o: htscodecs/tests/rANS_static_test.c config.h $(htscodecs_rANS_static_h)
849 htscodecs/tests/tokenise_name3_test.o: CPPFLAGS += -Ihtscodecs
850 htscodecs/tests/tokenise_name3_test.o: htscodecs/tests/tokenise_name3_test.c config.h $(htscodecs_tokenise_name3_h)
851 htscodecs/tests/varint_test.o: CPPFLAGS += -Ihtscodecs
852 htscodecs/tests/varint_test.o: htscodecs/tests/varint_test.c config.h $(htscodecs_varint_h)
853
854 test/hts_endian.o: test/hts_endian.c config.h $(htslib_hts_endian_h)
855 test/fuzz/hts_open_fuzzer.o: test/fuzz/hts_open_fuzzer.c config.h $(htslib_hfile_h) $(htslib_hts_h) $(htslib_sam_h) $(htslib_vcf_h)
856 test/fieldarith.o: test/fieldarith.c config.h $(htslib_sam_h)
857 test/hfile.o: test/hfile.c config.h $(htslib_hfile_h) $(htslib_hts_defs_h) $(htslib_kstring_h)
858 test/pileup.o: test/pileup.c config.h $(htslib_sam_h) $(htslib_kstring_h)
859 test/pileup_mod.o: test/pileup_mod.c config.h $(htslib_sam_h)
860 test/plugins-dlhts.o: test/plugins-dlhts.c config.h
861 test/sam.o: test/sam.c config.h $(htslib_hts_defs_h) $(htslib_sam_h) $(htslib_faidx_h) $(htslib_khash_h) $(htslib_hts_log_h)
862 test/test_bgzf.o: test/test_bgzf.c config.h $(htslib_bgzf_h) $(htslib_hfile_h) $(htslib_hts_log_h) $(hfile_internal_h)
863 test/test_expr.o: test/test_expr.c config.h $(htslib_hts_expr_h)
864 test/test_kfunc.o: test/test_kfunc.c config.h $(htslib_kfunc_h)
865 test/test_khash.o: test/test_khash.c config.h $(htslib_khash_h) $(htslib_kroundup_h)
866 test/test_kstring.o: test/test_kstring.c config.h $(htslib_kstring_h)
867 test/test_mod.o: test/test_mod.c config.h $(htslib_sam_h)
868 test/test_nibbles.o: test/test_nibbles.c config.h $(htslib_sam_h) $(sam_internal_h)
869 test/test-parse-reg.o: test/test-parse-reg.c config.h $(htslib_hts_h) $(htslib_sam_h)
870 test/test_realn.o: test/test_realn.c config.h $(htslib_hts_h) $(htslib_sam_h) $(htslib_faidx_h)
871 test/test-regidx.o: test/test-regidx.c config.h $(htslib_kstring_h) $(htslib_regidx_h) $(htslib_hts_defs_h) $(textutils_internal_h)
872 test/test_str2int.o: test/test_str2int.c config.h $(textutils_internal_h)
873 test/test_time_funcs.o: test/test_time_funcs.c config.h $(hts_time_funcs_h)
874 test/test_view.o: test/test_view.c config.h $(cram_h) $(htslib_sam_h) $(htslib_vcf_h) $(htslib_hts_log_h)
875 test/test_faidx.o: test/test_faidx.c config.h $(htslib_faidx_h)
876 test/test_index.o: test/test_index.c config.h $(htslib_sam_h) $(htslib_vcf_h)
877 test/test-vcf-api.o: test/test-vcf-api.c config.h $(htslib_hts_h) $(htslib_vcf_h) $(htslib_kstring_h) $(htslib_kseq_h)
878 test/test-vcf-sweep.o: test/test-vcf-sweep.c config.h $(htslib_vcf_sweep_h)
879 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)
880 test/test-bcf-translate.o: test/test-bcf-translate.c config.h $(htslib_vcf_h)
881 test/test_introspection.o: test/test_introspection.c config.h $(htslib_hts_h) $(htslib_hfile_h)
882 test/test-bcf_set_variant_type.o: test/test-bcf_set_variant_type.c config.h $(htslib_hts_h) vcf.c
883
884 # Standalone target not added to $(BUILT_TEST_PROGRAMS) as some may not
885 # have a compiler that compiles as C++ when given a .cpp source file.
886 test/usepublic.o: test/usepublic.cpp config.h $(htslib_bgzf_h) $(htslib_cram_h) $(htslib_faidx_h) $(htslib_hfile_h) $(htslib_hts_h) $(htslib_hts_defs_h) $(htslib_hts_endian_h) $(htslib_hts_expr_h) $(htslib_hts_log_h) $(htslib_hts_os_h) $(htslib_kbitset_h) $(htslib_kfunc_h) $(htslib_khash_h) $(htslib_khash_str2int_h) $(htslib_klist_h) $(HTSPREFIX)htslib/knetfile.h $(htslib_kroundup_h) $(htslib_kseq_h) $(htslib_ksort_h) $(htslib_kstring_h) $(htslib_regidx_h) $(htslib_sam_h) $(htslib_synced_bcf_reader_h) $(htslib_tbx_h) $(htslib_thread_pool_h) $(htslib_vcf_h) $(htslib_vcf_sweep_h) $(htslib_vcfutils_h)
887 $(CC) $(CFLAGS) $(TARGET_CFLAGS) $(ALL_CPPFLAGS) -c -o $@ test/usepublic.cpp
888
889
890 test/thrash_threads1: test/thrash_threads1.o libhts.a
891 $(CC) $(LDFLAGS) -o $@ test/thrash_threads1.o libhts.a $(LIBS) -lpthread
892
893 test/thrash_threads2: test/thrash_threads2.o libhts.a
894 $(CC) $(LDFLAGS) -o $@ test/thrash_threads2.o libhts.a $(LIBS) -lpthread
895
896 test/thrash_threads3: test/thrash_threads3.o libhts.a
897 $(CC) $(LDFLAGS) -o $@ test/thrash_threads3.o libhts.a $(LIBS) -lpthread
898
899 test/thrash_threads4: test/thrash_threads4.o libhts.a
900 $(CC) $(LDFLAGS) -o $@ test/thrash_threads4.o libhts.a $(LIBS) -lpthread
901
902 test/thrash_threads5: test/thrash_threads5.o libhts.a
903 $(CC) $(LDFLAGS) -o $@ test/thrash_threads5.o libhts.a $(LIBS) -lpthread
904
905 test/thrash_threads6: test/thrash_threads6.o libhts.a
906 $(CC) $(LDFLAGS) -o $@ test/thrash_threads6.o libhts.a $(LIBS) -lpthread
907
908 test/thrash_threads7: test/thrash_threads7.o libhts.a
909 $(CC) $(LDFLAGS) -o $@ test/thrash_threads7.o libhts.a $(LIBS) -lpthread
910
911 test_thrash: $(BUILT_THRASH_PROGRAMS)
912
913 # Test to ensure the functions in the header files are exported by the shared
914 # library. This currently works by comparing the output from ctags on
915 # the headers with the list of functions exported by the shared library.
916 # Note that functions marked as exported in the .c files and not the public
917 # headers will be missed by this test.
918 test-shlib-exports: header-exports.txt shlib-exports-$(SHLIB_FLAVOUR).txt
919 @echo "Checking shared library exports"
920 @if test ! -s header-exports.txt ; then echo "Error: header-exports.txt empty" ; false ; fi
921 @if test ! -s shlib-exports-$(SHLIB_FLAVOUR).txt ; then echo "Error: shlib-exports-$(SHLIB_FLAVOUR).txt empty" ; false ; fi
922 @! comm -23 header-exports.txt shlib-exports-$(SHLIB_FLAVOUR).txt | grep . || \
923 ( echo "Error: Found unexported symbols (listed above)" ; false )
924
925 # Extract symbols that should be exported from public headers using ctags
926 # Filter out macros in htslib/hts_defs.h.
927 header-exports.txt: test/header_syms.pl htslib/*.h
928 test/header_syms.pl htslib/*.h | sort -u -o $@
929
930 shlib-exports-so.txt: libhts.so
931 nm -D -g libhts.so | awk '$$2 == "T" { sub("@.*", "", $$3); print $$3 }' | sort -u -o $@
932
933 shlib-exports-dylib.txt: libhts.dylib
934 nm -Ug libhts.dylib | awk '$$2 == "T" { sub("^_", "", $$3); print $$3 }' | sort -u -o $@
935
936 shlib-exports-dll.txt: hts.dll.a
937 nm -g hts.dll.a | awk '$$2 == "T" { print $$3 }' | sort -u -o $@
938
939 $(srcprefix)htslib.map: libhts.so
940 LC_ALL=C ; export LC_ALL; \
941 curr_vers=`expr 'X$(PACKAGE_VERSION)' : 'X\([0-9]*\.[0-9.]*\)'` ; \
942 last_vers=`awk '/^HTSLIB_[0-9](\.[0-9]+)+/ { lv = $$1 } END { print lv }' htslib.map` ; \
943 if test "x$$curr_vers" = 'x' || test "x$$last_vers" = 'x' ; then \
944 echo "Version check failed : $$curr_vers / $$las_vers" 1>&2 ; \
945 exit 1 ; \
946 fi && \
947 if test "HTSLIB_$$curr_vers" = "$$last_vers" ; then \
948 echo "Refusing to update $@ - HTSlib version not changed" 1>&2 ; \
949 exit 1 ; \
950 fi && \
951 nm --with-symbol-versions -D -g libhts.so | awk '$$2 ~ /^[DGRT]$$/ && $$3 ~ /@@Base$$/ && $$3 !~ /^(_init|_fini|_edata)@@/ { sub(/@@Base$$/, ";", $$3); print " " $$3 }' > [email protected] && \
952 if [ -s [email protected] ] ; then \
953 cat $@ > [email protected] && \
954 printf '\n%s {\n' "HTSLIB_$$curr_vers" >> [email protected] && \
955 cat [email protected] >> [email protected] && \
956 printf '} %s;\n' "$$last_vers" >> [email protected] && \
957 rm -f [email protected] && \
958 mv [email protected] $@ ; \
959 else \
960 rm -f [email protected] ; \
961 fi
962
963 install: libhts.a $(BUILT_PROGRAMS) $(BUILT_PLUGINS) $(REF_CACHE_PROGRAMS) installdirs install-$(SHLIB_FLAVOUR) install-pkgconfig
964 $(INSTALL_PROGRAM) $(BUILT_PROGRAMS) $(REF_CACHE_PROGRAMS) $(DESTDIR)$(bindir)
965 if test -n "$(BUILT_PLUGINS)"; then $(INSTALL_PROGRAM) $(BUILT_PLUGINS) $(DESTDIR)$(plugindir); fi
966 $(INSTALL_DATA) $(SRC)htslib/*.h $(DESTDIR)$(includedir)/htslib
967 $(INSTALL_DATA) libhts.a $(DESTDIR)$(libdir)/libhts.a
968 $(INSTALL_MAN) $(SRC)annot-tsv.1 $(SRC)bgzip.1 $(SRC)htsfile.1 $(SRC)tabix.1 $(DESTDIR)$(man1dir)
969 if test "x$(REF_CACHE_PROGRAMS)" != "x" ; then \
970 $(INSTALL_MAN) $(SRC)ref_cache/ref-cache.1 $(DESTDIR)$(man1dir) ; \
971 fi
972 $(INSTALL_MAN) $(SRC)faidx.5 $(SRC)sam.5 $(SRC)vcf.5 $(DESTDIR)$(man5dir)
973 $(INSTALL_MAN) $(SRC)htslib-s3-plugin.7 $(DESTDIR)$(man7dir)
974
975 installdirs:
976 $(INSTALL_DIR) $(DESTDIR)$(bindir) $(DESTDIR)$(includedir) $(DESTDIR)$(includedir)/htslib $(DESTDIR)$(libdir) $(DESTDIR)$(man1dir) $(DESTDIR)$(man5dir) $(DESTDIR)$(man7dir) $(DESTDIR)$(pkgconfigdir)
977 if test -n "$(plugindir)"; then $(INSTALL_DIR) $(DESTDIR)$(plugindir); fi
978
979 # After installation, the real file in $(libdir) will be libhts.so.X.Y.Z,
980 # with symlinks libhts.so (used via -lhts during linking of client programs)
981 # and libhts.so.NN (used by client executables at runtime).
982
983 install-so: libhts.so installdirs
984 $(INSTALL_LIB) libhts.so $(DESTDIR)$(libdir)/libhts.so.$(PACKAGE_VERSION)
985 ln -sf libhts.so.$(PACKAGE_VERSION) $(DESTDIR)$(libdir)/libhts.so
986 ln -sf libhts.so.$(PACKAGE_VERSION) $(DESTDIR)$(libdir)/libhts.so.$(LIBHTS_SOVERSION)
987
988 install-cygdll: cyghts-$(LIBHTS_SOVERSION).dll installdirs
989 $(INSTALL_PROGRAM) cyghts-$(LIBHTS_SOVERSION).dll $(DESTDIR)$(bindir)/cyghts-$(LIBHTS_SOVERSION).dll
990 $(INSTALL_PROGRAM) libhts.dll.a $(DESTDIR)$(libdir)/libhts.dll.a
991
992 install-dll: hts-$(LIBHTS_SOVERSION).dll installdirs
993 $(INSTALL_PROGRAM) hts-$(LIBHTS_SOVERSION).dll $(DESTDIR)$(bindir)/hts-$(LIBHTS_SOVERSION).dll
994 $(INSTALL_PROGRAM) hts.dll.a $(DESTDIR)$(libdir)/hts.dll.a
995
996 install-dylib: libhts.dylib installdirs
997 $(INSTALL_PROGRAM) libhts.dylib $(DESTDIR)$(libdir)/libhts.$(PACKAGE_VERSION).dylib
998 ln -sf libhts.$(PACKAGE_VERSION).dylib $(DESTDIR)$(libdir)/libhts.dylib
999 ln -sf libhts.$(PACKAGE_VERSION).dylib $(DESTDIR)$(libdir)/libhts.$(LIBHTS_SOVERSION).dylib
1000
1001 # Substitute these pseudo-autoconf variables only at install time
1002 # so that "make install prefix=/prefix/path" etc continue to work.
1003 install-pkgconfig: htslib.pc.tmp installdirs
1004 sed -e 's#@-includedir@#$(includedir)#g;s#@-libdir@#$(libdir)#g;s#@-PACKAGE_VERSION@#$(PACKAGE_VERSION)#g' htslib.pc.tmp > $(DESTDIR)$(pkgconfigdir)/htslib.pc
1005 chmod 644 $(DESTDIR)$(pkgconfigdir)/htslib.pc
1006
1007 # A pkg-config file (suitable for copying to $PKG_CONFIG_PATH) that provides
1008 # flags for building against the uninstalled library in this build directory.
1009 htslib-uninstalled.pc: htslib.pc.tmp
1010 sed -e "s#@-includedir@#`pwd`#g;s#@-libdir@#`pwd`#g" htslib.pc.tmp > $@
1011
1012
1013 testclean:
1014 -rm -f test/*.tmp test/*.tmp.* test/faidx/*.tmp* \
1015 test/longrefs/*.tmp.* test/ref_cache/*.tmp.* test/tabix/*.tmp.* \
1016 test/bgzf_boundaries/*.tmp.* test/*/FAIL* \
1017 header-exports.txt shlib-exports-$(SHLIB_FLAVOUR).txt
1018 -rm -rf htscodecs/tests/test.out
1019
1020 # Only remove this in git checkouts
1021 DEL_HTSCODECS_VERSION := $(if $(wildcard htscodecs/.git),htscodecs/htscodecs/version.h)
1022
1023 mostlyclean: testclean
1024 -rm -f *.o *.pico cram/*.o cram/*.pico test/*.o test/*.dSYM config_vars.h version.h
1025 -rm -f htscodecs/htscodecs/*.o htscodecs/htscodecs/*.pico $(DEL_HTSCODECS_VERSION)
1026 -rm -f hts-object-files
1027 -rm -f htscodecs/tests/*.o
1028 -rm -f ref_cache/*.o
1029
1030 clean: mostlyclean clean-$(SHLIB_FLAVOUR)
1031 -rm -f libhts.a $(BUILT_PROGRAMS) $(BUILT_PLUGINS) $(BUILT_TEST_PROGRAMS) $(BUILT_THRASH_PROGRAMS) $(REF_CACHE_PROGRAMS)
1032 -rm -f htscodecs/tests/rans4x8 htscodecs/tests/rans4x16pr htscodecs/tests/arith_dynamic htscodecs/tests/tokenise_name3 htscodecs/tests/fqzcomp_qual htscodecs/tests/varint
1033
1034 distclean maintainer-clean: clean
1035 -rm -f config.cache config.h config.log config.mk config.status
1036 -rm -f TAGS *.pc.tmp *-uninstalled.pc htslib_static.mk htscodecs.mk
1037 -rm -rf autom4te.cache
1038
1039 clean-so:
1040 -rm -f libhts.so libhts.so.*
1041
1042 clean-cygdll:
1043 -rm -f cyghts-*.dll libhts.dll.a
1044
1045 clean-dll:
1046 -rm -f hts-*.dll hts.dll.a
1047
1048 clean-dylib:
1049 -rm -f libhts.dylib libhts.*.dylib
1050
1051
1052 tags TAGS:
1053 ctags -f TAGS *.[ch] cram/*.[ch] htslib/*.h
1054
1055 # We recommend libhts-using programs be built against a separate htslib
1056 # installation. However if you feel that you must bundle htslib source
1057 # code with your program, this hook enables Automake-style "make dist"
1058 # for this subdirectory. If you do bundle an htslib snapshot, please
1059 # add identifying information to $(PACKAGE_VERSION) as appropriate.
1060 # (The wildcards attempt to omit non-exported files (.git, .gitignore,
1061 # etc) and other detritus that might be in the top-level directory.)
1062 distdir: htscodecs/htscodecs/version.h
1063 @if [ -z "$(distdir)" ]; then echo "Please supply a distdir=DIR argument."; false; fi
1064 tar -c *.[ch157] [I-R]*[ELSde] [cmors]*[bcemns4] [bhtv]*[bhknpt] htscodecs/*.md htscodecs/[ht]*/*[chp-t0-9] | (cd $(distdir) && tar -x)
1065 +cd $(distdir) && $(MAKE) distclean
1066
1067 force:
1068
1069
1070 .PHONY: all check check-untracked clean distclean distdir force
1071 .PHONY: install install-pkgconfig installdirs lib-shared lib-static
1072 .PHONY: maintainer-check maintainer-clean mostlyclean plugins
1073 .PHONY: print-config print-version show-version tags
1074 .PHONY: test test-shlib-exports test_thrash testclean
1075 .PHONY: clean-so install-so
1076 .PHONY: clean-cygdll install-cygdll
1077 .PHONY: clean-dll install-dll
1078 .PHONY: clean-dylib install-dylib
1079 .PHONY: test_htscodecs_rans4x8 test_htscodecs_rans4x16 test_htscodecs_arith
1080 .PHONY: test_htscodecs_tok3 test_htscodecs_fqzcomp test_htscodecs_varint
1081 .PHONY: cc-version