Debian Codegraph @

Makefile

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