modified: src1/input.c
[GalaxyCodeBases.git] / c_cpp / lib / htslib / Makefile
blob9a44b6263bbe79f5245e15db1803e9fb65faa35e
1 # Makefile for htslib, a C library for high-throughput sequencing data formats.
3 # Copyright (C) 2013-2017 Genome Research Ltd.
5 # Author: John Marshall <jm18@sanger.ac.uk>
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:
14 # The above copyright notice and this permission notice shall be included in
15 # all copies or substantial portions of the Software.
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.
25 CC = gcc
26 AR = ar
27 RANLIB = ranlib
29 # Default libraries to link if configure is not used
30 htslib_default_libs = -lz -lm -lbz2 -llzma
32 CPPFLAGS =
33 # TODO: probably update cram code to make it compile cleanly with -Wc++-compat
34 # For testing strict C99 support add -std=c99 -D_XOPEN_SOURCE=600
35 #CFLAGS = -g -Wall -O2 -pedantic -std=c99 -D_XOPEN_SOURCE=600 -D__FUNCTION__=__func__
36 CFLAGS = -g -Wall -O2
37 EXTRA_CFLAGS_PIC = -fpic
38 LDFLAGS =
39 LIBS = $(htslib_default_libs)
41 prefix = /usr/local
42 exec_prefix = $(prefix)
43 bindir = $(exec_prefix)/bin
44 includedir = $(prefix)/include
45 libdir = $(exec_prefix)/lib
46 libexecdir = $(exec_prefix)/libexec
47 datarootdir = $(prefix)/share
48 mandir = $(datarootdir)/man
49 man1dir = $(mandir)/man1
50 man5dir = $(mandir)/man5
51 pkgconfigdir= $(libdir)/pkgconfig
53 MKDIR_P = mkdir -p
54 INSTALL = install -p
55 INSTALL_DATA = $(INSTALL) -m 644
56 INSTALL_DIR = $(MKDIR_P) -m 755
57 INSTALL_LIB = $(INSTALL_DATA)
58 INSTALL_MAN = $(INSTALL_DATA)
59 INSTALL_PROGRAM = $(INSTALL)
61 # Set by config.mk if plugins are enabled
62 plugindir =
64 BUILT_PROGRAMS = \
65 bgzip \
66 htsfile \
67 tabix
69 BUILT_TEST_PROGRAMS = \
70 test/hts_endian \
71 test/fieldarith \
72 test/hfile \
73 test/sam \
74 test/test_bgzf \
75 test/test-regidx \
76 test/test_view \
77 test/test-vcf-api \
78 test/test-vcf-sweep \
79 test/test-bcf-sr
81 BUILT_THRASH_PROGRAMS = \
82 test/thrash_threads1 \
83 test/thrash_threads2 \
84 test/thrash_threads3 \
85 test/thrash_threads4 \
86 test/thrash_threads5 \
87 test/thrash_threads6
89 all: lib-static lib-shared $(BUILT_PROGRAMS) plugins $(BUILT_TEST_PROGRAMS)
91 HTSPREFIX =
92 include htslib_vars.mk
95 PACKAGE_VERSION = 1.5
96 LIBHTS_SOVERSION = 2
99 # $(NUMERIC_VERSION) is for items that must have a numeric X.Y.Z string
100 # even if this is a dirty or untagged Git working tree.
101 NUMERIC_VERSION = $(PACKAGE_VERSION)
103 # If building from a Git repository, replace $(PACKAGE_VERSION) with the Git
104 # description of the working tree: either a release tag with the same value
105 # as $(PACKAGE_VERSION) above, or an exact description likely based on a tag.
106 # Much of this is also GNU Make-specific. If you don't have GNU Make and/or
107 # are not building from a Git repository, comment out this conditional.
108 ifneq "$(wildcard .git)" ""
109 original_version := $(PACKAGE_VERSION)
110 PACKAGE_VERSION := $(shell git describe --always --dirty)
112 # Unless the Git description matches /\d*\.\d*(\.\d*)?/, i.e., is exactly a tag
113 # with a numeric name, revert $(NUMERIC_VERSION) to the original version number
114 # written above, but with the patchlevel field bumped to 255.
115 ifneq "$(subst ..,.,$(subst 0,,$(subst 1,,$(subst 2,,$(subst 3,,$(subst 4,,$(subst 5,,$(subst 6,,$(subst 7,,$(subst 8,,$(subst 9,,$(PACKAGE_VERSION))))))))))))" "."
116 empty :=
117 NUMERIC_VERSION := $(subst $(empty) ,.,$(wordlist 1,2,$(subst ., ,$(original_version))) 255)
118 endif
120 # Force version.h to be remade if $(PACKAGE_VERSION) has changed.
121 version.h: $(if $(wildcard version.h),$(if $(findstring "$(PACKAGE_VERSION)",$(shell cat version.h)),,force))
122 endif
124 version.h:
125 echo '#define HTS_VERSION "$(PACKAGE_VERSION)"' > $@
127 print-version:
128 @echo $(PACKAGE_VERSION)
131 .SUFFIXES: .bundle .c .cygdll .dll .o .pico .so
133 .c.o:
134 $(CC) $(CFLAGS) -I. $(CPPFLAGS) -c -o $@ $<
136 .c.pico:
137 $(CC) $(CFLAGS) -I. $(CPPFLAGS) $(EXTRA_CFLAGS_PIC) -c -o $@ $<
140 LIBHTS_OBJS = \
141 kfunc.o \
142 knetfile.o \
143 kstring.o \
144 bcf_sr_sort.o \
145 bgzf.o \
146 errmod.o \
147 faidx.o \
148 hfile.o \
149 hfile_net.o \
150 hts.o \
151 md5.o \
152 multipart.o \
153 probaln.o \
154 realn.o \
155 regidx.o \
156 sam.o \
157 synced_bcf_reader.o \
158 vcf_sweep.o \
159 tbx.o \
160 textutils.o \
161 thread_pool.o \
162 vcf.o \
163 vcfutils.o \
164 cram/cram_codecs.o \
165 cram/cram_decode.o \
166 cram/cram_encode.o \
167 cram/cram_external.o \
168 cram/cram_index.o \
169 cram/cram_io.o \
170 cram/cram_samtools.o \
171 cram/cram_stats.o \
172 cram/files.o \
173 cram/mFILE.o \
174 cram/open_trace_file.o \
175 cram/pooled_alloc.o \
176 cram/rANS_static.o \
177 cram/sam_header.o \
178 cram/string_alloc.o
180 PLUGIN_EXT =
181 PLUGIN_OBJS =
183 cram_h = cram/cram.h $(cram_samtools_h) $(cram_sam_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)
184 cram_io_h = cram/cram_io.h $(cram_misc_h)
185 cram_misc_h = cram/misc.h $(cram_os_h)
186 cram_os_h = cram/os.h $(htslib_hts_endian_h)
187 cram_sam_header_h = cram/sam_header.h cram/string_alloc.h cram/pooled_alloc.h $(htslib_khash_h) $(htslib_kstring_h)
188 cram_samtools_h = cram/cram_samtools.h $(htslib_sam_h) $(cram_sam_header_h)
189 cram_structs_h = cram/cram_structs.h $(htslib_thread_pool_h) cram/string_alloc.h $(htslib_khash_h)
190 cram_open_trace_file_h = cram/open_trace_file.h cram/mFILE.h
191 hfile_internal_h = hfile_internal.h $(htslib_hfile_h)
192 hts_internal_h = hts_internal.h $(htslib_hts_h)
193 thread_pool_internal_h = thread_pool_internal.h $(htslib_thread_pool_h)
196 # To be effective, config.mk needs to appear after most Makefile variables are
197 # set but before most rules appear, so that it can both use previously-set
198 # variables in its own rules' prerequisites and also update variables for use
199 # in later rules' prerequisites.
201 # If your make doesn't accept -include, change this to 'include' if you are
202 # using the configure script or just comment the line out if you are not.
203 -include config.mk
205 # Usually config.h is generated by running configure or config.status,
206 # but if those aren't used create a default config.h here.
207 config.h:
208 echo '/* Default config.h generated by Makefile */' > $@
209 echo '#define HAVE_LIBBZ2 1' >> $@
210 echo '#define HAVE_LIBLZMA 1' >> $@
212 # And similarly for htslib.pc.tmp ("pkg-config template"). No dependency
213 # on htslib.pc.in listed, as if that file is newer the usual way to regenerate
214 # this target is via configure or config.status rather than this rule.
215 htslib.pc.tmp:
216 sed -e '/^static_libs=/s/@static_LIBS@/$(htslib_default_libs)/;s#@[^-][^@]*@##g' htslib.pc.in > $@
218 # Create a makefile fragment listing the libraries and LDFLAGS needed for
219 # static linking. This can be included by projects that want to build
220 # and link against the htslib source tree instead of an installed library.
221 htslib_static.mk: htslib.pc.tmp
222 sed -n '/^static_libs=/s/[^=]*=/HTSLIB_static_LIBS = /p;/^static_ldflags=/s/[^=]*=/HTSLIB_static_LDFLAGS = /p' $< > $@
225 lib-static: libhts.a
227 # $(shell), :=, and ifeq/.../endif are GNU Make-specific. If you don't have
228 # GNU Make, comment out the parts of these conditionals that don't apply.
229 ifneq "$(origin PLATFORM)" "file"
230 PLATFORM := $(shell uname -s)
231 endif
232 ifeq "$(PLATFORM)" "Darwin"
233 SHLIB_FLAVOUR = dylib
234 lib-shared: libhts.dylib
235 else ifeq "$(findstring CYGWIN,$(PLATFORM))" "CYGWIN"
236 SHLIB_FLAVOUR = cygdll
237 lib-shared: cyghts-$(LIBHTS_SOVERSION).dll
238 else
239 SHLIB_FLAVOUR = so
240 lib-shared: libhts.so
241 endif
243 BUILT_PLUGINS = $(PLUGIN_OBJS:.o=$(PLUGIN_EXT))
245 plugins: $(BUILT_PLUGINS)
248 libhts.a: $(LIBHTS_OBJS)
249 @-rm -f $@
250 $(AR) -rc $@ $(LIBHTS_OBJS)
251 -$(RANLIB) $@
253 print-config:
254 @echo LDFLAGS = $(LDFLAGS)
255 @echo LIBHTS_OBJS = $(LIBHTS_OBJS)
256 @echo LIBS = $(LIBS)
257 @echo PLATFORM = $(PLATFORM)
259 # The target here is libhts.so, as that is the built file that other rules
260 # depend upon and that is used when -lhts appears in other program's recipes.
261 # As a byproduct invisible to make, libhts.so.NN is also created, as it is the
262 # file used at runtime (when $LD_LIBRARY_PATH includes the build directory).
264 libhts.so: $(LIBHTS_OBJS:.o=.pico)
265 $(CC) -shared -Wl,-soname,libhts.so.$(LIBHTS_SOVERSION) $(LDFLAGS) -o $@ $(LIBHTS_OBJS:.o=.pico) $(LIBS) -lpthread
266 ln -sf $@ libhts.so.$(LIBHTS_SOVERSION)
268 # Similarly this also creates libhts.NN.dylib as a byproduct, so that programs
269 # when run can find this uninstalled shared library (when $DYLD_LIBRARY_PATH
270 # includes this project's build directory).
272 libhts.dylib: $(LIBHTS_OBJS)
273 $(CC) -dynamiclib -install_name $(libdir)/libhts.$(LIBHTS_SOVERSION).dylib -current_version $(NUMERIC_VERSION) -compatibility_version $(LIBHTS_SOVERSION) $(LDFLAGS) -o $@ $(LIBHTS_OBJS) $(LIBS)
274 ln -sf $@ libhts.$(LIBHTS_SOVERSION).dylib
276 cyghts-$(LIBHTS_SOVERSION).dll: $(LIBHTS_OBJS)
277 $(CC) -shared -Wl,--out-implib=libhts.dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import $(LDFLAGS) -o $@ -Wl,--whole-archive $(LIBHTS_OBJS) -Wl,--no-whole-archive $(LIBS) -lpthread
280 .pico.so:
281 $(CC) -shared -Wl,-E $(LDFLAGS) -o $@ $< $(LIBS) -lpthread
283 .o.bundle:
284 $(CC) -bundle -Wl,-undefined,dynamic_lookup $(LDFLAGS) -o $@ $< $(LIBS)
286 .o.cygdll:
287 $(CC) -shared $(LDFLAGS) -o $@ $< libhts.dll.a $(LIBS)
290 bgzf.o bgzf.pico: bgzf.c config.h $(htslib_hts_h) $(htslib_bgzf_h) $(htslib_hfile_h) $(htslib_thread_pool_h) cram/pooled_alloc.h $(htslib_khash_h)
291 errmod.o errmod.pico: errmod.c config.h $(htslib_hts_h) $(htslib_ksort_h)
292 kstring.o kstring.pico: kstring.c config.h $(htslib_kstring_h)
293 knetfile.o knetfile.pico: knetfile.c config.h $(htslib_hts_log_h) $(htslib_knetfile_h)
294 hfile.o hfile.pico: hfile.c config.h $(htslib_hfile_h) $(hfile_internal_h) $(hts_internal_h) $(htslib_khash_h)
295 hfile_gcs.o hfile_gcs.pico: hfile_gcs.c config.h $(htslib_hts_h) $(htslib_kstring_h) $(hfile_internal_h)
296 hfile_libcurl.o hfile_libcurl.pico: hfile_libcurl.c config.h $(hfile_internal_h) $(htslib_hts_h) $(htslib_kstring_h)
297 hfile_net.o hfile_net.pico: hfile_net.c config.h $(hfile_internal_h) $(htslib_knetfile_h)
298 hfile_s3.o hfile_s3.pico: hfile_s3.c config.h $(hts_internal_h) $(hfile_internal_h) $(htslib_hts_h) $(htslib_kstring_h)
299 hts.o hts.pico: hts.c config.h $(htslib_hts_h) $(htslib_bgzf_h) $(cram_h) $(hfile_internal_h) $(htslib_hfile_h) version.h $(hts_internal_h) $(htslib_khash_h) $(htslib_kseq_h) $(htslib_ksort_h)
300 vcf.o vcf.pico: vcf.c config.h $(htslib_vcf_h) $(htslib_bgzf_h) $(htslib_tbx_h) $(htslib_hfile_h) $(hts_internal_h) $(htslib_khash_str2int_h) $(htslib_kstring_h) $(htslib_khash_h) $(htslib_kseq_h) $(htslib_hts_endian_h)
301 sam.o sam.pico: sam.c config.h $(htslib_sam_h) $(htslib_bgzf_h) $(cram_h) $(hts_internal_h) $(htslib_hfile_h) $(htslib_khash_h) $(htslib_kseq_h) $(htslib_kstring_h) $(htslib_hts_endian_h)
302 tbx.o tbx.pico: tbx.c config.h $(htslib_tbx_h) $(htslib_bgzf_h) $(hts_internal_h) $(htslib_khash_h)
303 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)
304 bcf_sr_sort.o bcf_sr_sort.pico: bcf_sr_sort.c config.h bcf_sr_sort.h $(htslib_kseq_h) $(htslib_khash_str2int_h)
305 synced_bcf_reader.o synced_bcf_reader.pico: synced_bcf_reader.c config.h bcf_sr_sort.h $(htslib_synced_bcf_reader_h) $(htslib_kseq_h) $(htslib_khash_str2int_h) $(htslib_bgzf_h) $(htslib_thread_pool_h)
306 vcf_sweep.o vcf_sweep.pico: vcf_sweep.c config.h $(htslib_vcf_sweep_h) $(htslib_bgzf_h)
307 vcfutils.o vcfutils.pico: vcfutils.c config.h $(htslib_vcfutils_h) $(htslib_kbitset_h)
308 kfunc.o kfunc.pico: kfunc.c config.h $(htslib_kfunc_h)
309 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)
310 md5.o md5.pico: md5.c config.h $(htslib_hts_h) $(htslib_hts_endian_h)
311 multipart.o multipart.pico: multipart.c config.h $(htslib_kstring_h) $(hts_internal_h) $(hfile_internal_h)
312 plugin.o plugin.pico: plugin.c config.h $(hts_internal_h) $(htslib_kstring_h)
313 probaln.o probaln.pico: probaln.c config.h $(htslib_hts_h)
314 realn.o realn.pico: realn.c config.h $(htslib_hts_h) $(htslib_sam_h)
315 textutils.o textutils.pico: textutils.c config.h $(htslib_hfile_h) $(htslib_kstring_h) $(hts_internal_h)
317 cram/cram_codecs.o cram/cram_codecs.pico: cram/cram_codecs.c config.h $(cram_h)
318 cram/cram_decode.o cram/cram_decode.pico: cram/cram_decode.c config.h $(cram_h) $(cram_os_h) $(htslib_hts_h)
319 cram/cram_encode.o cram/cram_encode.pico: cram/cram_encode.c config.h $(cram_h) $(cram_os_h) $(htslib_hts_h) $(htslib_hts_endian_h)
320 cram/cram_external.o cram/cram_external.pico: cram/cram_external.c config.h $(htslib_hfile_h) $(cram_h)
321 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)
322 cram/cram_io.o cram/cram_io.pico: cram/cram_io.c config.h $(cram_h) $(cram_os_h) $(htslib_hts_h) $(cram_open_trace_file_h) cram/rANS_static.h $(htslib_hfile_h) $(htslib_bgzf_h) $(htslib_faidx_h) $(hts_internal_h)
323 cram/cram_samtools.o cram/cram_samtools.pico: cram/cram_samtools.c config.h $(cram_h) $(htslib_sam_h)
324 cram/cram_stats.o cram/cram_stats.pico: cram/cram_stats.c config.h $(cram_h) $(cram_os_h)
325 cram/files.o cram/files.pico: cram/files.c config.h $(cram_misc_h)
326 cram/mFILE.o cram/mFILE.pico: cram/mFILE.c config.h $(cram_os_h) cram/mFILE.h
327 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)
328 cram/pooled_alloc.o cram/pooled_alloc.pico: cram/pooled_alloc.c config.h cram/pooled_alloc.h $(cram_misc_h)
329 cram/rANS_static.o cram/rANS_static.pico: cram/rANS_static.c config.h cram/rANS_static.h cram/rANS_byte.h
330 cram/sam_header.o cram/sam_header.pico: cram/sam_header.c config.h $(cram_sam_header_h) cram/string_alloc.h
331 cram/string_alloc.o cram/string_alloc.pico: cram/string_alloc.c config.h cram/string_alloc.h
332 thread_pool.o thread_pool.pico: thread_pool.c config.h $(thread_pool_internal_h)
335 bgzip: bgzip.o libhts.a
336 $(CC) $(LDFLAGS) -o $@ bgzip.o libhts.a $(LIBS) -lpthread
338 htsfile: htsfile.o libhts.a
339 $(CC) $(LDFLAGS) -o $@ htsfile.o libhts.a $(LIBS) -lpthread
341 tabix: tabix.o libhts.a
342 $(CC) $(LDFLAGS) -o $@ tabix.o libhts.a $(LIBS) -lpthread
344 bgzip.o: bgzip.c config.h $(htslib_bgzf_h) $(htslib_hts_h)
345 htsfile.o: htsfile.c config.h $(htslib_hfile_h) $(htslib_hts_h) $(htslib_sam_h) $(htslib_vcf_h)
346 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)
349 # For tests that might use it, set $REF_PATH explicitly to use only reference
350 # areas within the test suite (or set it to ':' to use no reference areas).
351 check test: $(BUILT_PROGRAMS) $(BUILT_TEST_PROGRAMS)
352 test/hts_endian
353 test/fieldarith test/fieldarith.sam
354 test/hfile
355 test/test_bgzf test/bgziptest.txt
356 cd test/tabix && ./test-tabix.sh tabix.tst
357 REF_PATH=: test/sam test/ce.fa test/faidx.fa
358 test/test-regidx
359 cd test && REF_PATH=: ./test.pl
361 test/hts_endian: test/hts_endian.o
362 $(CC) $(LDFLAGS) -o $@ test/hts_endian.o $(LIBS)
364 test/fieldarith: test/fieldarith.o libhts.a
365 $(CC) $(LDFLAGS) -o $@ test/fieldarith.o libhts.a $(LIBS) -lpthread
367 test/hfile: test/hfile.o libhts.a
368 $(CC) $(LDFLAGS) -o $@ test/hfile.o libhts.a $(LIBS) -lpthread
370 test/sam: test/sam.o libhts.a
371 $(CC) $(LDFLAGS) -o $@ test/sam.o libhts.a $(LIBS) -lpthread
373 test/test_bgzf: test/test_bgzf.o libhts.a
374 $(CC) $(LDFLAGS) -o $@ test/test_bgzf.o libhts.a -lz $(LIBS) -lpthread
376 test/test-regidx: test/test-regidx.o libhts.a
377 $(CC) $(LDFLAGS) -o $@ test/test-regidx.o libhts.a $(LIBS) -lpthread
379 test/test_view: test/test_view.o libhts.a
380 $(CC) $(LDFLAGS) -o $@ test/test_view.o libhts.a $(LIBS) -lpthread
382 test/test-vcf-api: test/test-vcf-api.o libhts.a
383 $(CC) $(LDFLAGS) -o $@ test/test-vcf-api.o libhts.a $(LIBS) -lpthread
385 test/test-vcf-sweep: test/test-vcf-sweep.o libhts.a
386 $(CC) $(LDFLAGS) -o $@ test/test-vcf-sweep.o libhts.a $(LIBS) -lpthread
388 test/test-bcf-sr: test/test-bcf-sr.o libhts.a
389 $(CC) $(LDFLAGS) -o $@ test/test-bcf-sr.o libhts.a -lz $(LIBS) -lpthread
391 test/hts_endian.o: test/hts_endian.c $(htslib_hts_endian_h)
392 test/fieldarith.o: test/fieldarith.c config.h $(htslib_sam_h)
393 test/hfile.o: test/hfile.c config.h $(htslib_hfile_h) $(htslib_hts_defs_h)
394 test/sam.o: test/sam.c config.h $(htslib_hts_defs_h) $(htslib_sam_h) $(htslib_faidx_h) $(htslib_kstring_h)
395 test/test_bgzf.o: test/test_bgzf.c $(htslib_bgzf_h) $(htslib_hfile_h)
396 test/test-regidx.o: test/test-regidx.c config.h $(htslib_regidx_h) $(hts_internal_h)
397 test/test_view.o: test/test_view.c config.h $(cram_h) $(htslib_sam_h)
398 test/test-vcf-api.o: test/test-vcf-api.c config.h $(htslib_hts_h) $(htslib_vcf_h) $(htslib_kstring_h) $(htslib_kseq_h)
399 test/test-vcf-sweep.o: test/test-vcf-sweep.c config.h $(htslib_vcf_sweep_h)
400 test/test-bcf-sr.o: test/test-bcf-sr.c config.h $(htslib_vcf_sweep_h) bcf_sr_sort.h
403 test/thrash_threads1: test/thrash_threads1.o libhts.a
404 $(CC) $(LDFLAGS) -o $@ test/thrash_threads1.o libhts.a -lz $(LIBS) -lpthread
406 test/thrash_threads2: test/thrash_threads2.o libhts.a
407 $(CC) $(LDFLAGS) -o $@ test/thrash_threads2.o libhts.a -lz $(LIBS) -lpthread
409 test/thrash_threads3: test/thrash_threads3.o libhts.a
410 $(CC) $(LDFLAGS) -o $@ test/thrash_threads3.o libhts.a -lz $(LIBS) -lpthread
412 test/thrash_threads4: test/thrash_threads4.o libhts.a
413 $(CC) $(LDFLAGS) -o $@ test/thrash_threads4.o libhts.a -lz $(LIBS) -lpthread
415 test/thrash_threads5: test/thrash_threads5.o libhts.a
416 $(CC) $(LDFLAGS) -o $@ test/thrash_threads5.o libhts.a -lz $(LIBS) -lpthread
418 test/thrash_threads6: test/thrash_threads6.o libhts.a
419 $(CC) $(LDFLAGS) -o $@ test/thrash_threads6.o libhts.a -lz $(LIBS) -lpthread
421 test_thrash: $(BUILT_THRASH_PROGRAMS)
424 install: libhts.a $(BUILT_PROGRAMS) $(BUILT_PLUGINS) installdirs install-$(SHLIB_FLAVOUR) install-pkgconfig
425 $(INSTALL_PROGRAM) $(BUILT_PROGRAMS) $(DESTDIR)$(bindir)
426 if test -n "$(BUILT_PLUGINS)"; then $(INSTALL_PROGRAM) $(BUILT_PLUGINS) $(DESTDIR)$(plugindir); fi
427 $(INSTALL_DATA) htslib/*.h $(DESTDIR)$(includedir)/htslib
428 $(INSTALL_DATA) libhts.a $(DESTDIR)$(libdir)/libhts.a
429 $(INSTALL_MAN) htsfile.1 tabix.1 $(DESTDIR)$(man1dir)
430 $(INSTALL_MAN) faidx.5 sam.5 vcf.5 $(DESTDIR)$(man5dir)
432 installdirs:
433 $(INSTALL_DIR) $(DESTDIR)$(bindir) $(DESTDIR)$(includedir) $(DESTDIR)$(includedir)/htslib $(DESTDIR)$(libdir) $(DESTDIR)$(man1dir) $(DESTDIR)$(man5dir) $(DESTDIR)$(pkgconfigdir)
434 if test -n "$(plugindir)"; then $(INSTALL_DIR) $(DESTDIR)$(plugindir); fi
436 # After installation, the real file in $(libdir) will be libhts.so.X.Y.Z,
437 # with symlinks libhts.so (used via -lhts during linking of client programs)
438 # and libhts.so.NN (used by client executables at runtime).
440 install-so: libhts.so installdirs
441 $(INSTALL_LIB) libhts.so $(DESTDIR)$(libdir)/libhts.so.$(PACKAGE_VERSION)
442 ln -sf libhts.so.$(PACKAGE_VERSION) $(DESTDIR)$(libdir)/libhts.so
443 ln -sf libhts.so.$(PACKAGE_VERSION) $(DESTDIR)$(libdir)/libhts.so.$(LIBHTS_SOVERSION)
445 install-cygdll: cyghts-$(LIBHTS_SOVERSION).dll installdirs
446 $(INSTALL_PROGRAM) cyghts-$(LIBHTS_SOVERSION).dll $(DESTDIR)$(bindir)/cyghts-$(LIBHTS_SOVERSION).dll
447 $(INSTALL_PROGRAM) libhts.dll.a $(DESTDIR)$(libdir)/libhts.dll.a
449 install-dylib: libhts.dylib installdirs
450 $(INSTALL_PROGRAM) libhts.dylib $(DESTDIR)$(libdir)/libhts.$(PACKAGE_VERSION).dylib
451 ln -sf libhts.$(PACKAGE_VERSION).dylib $(DESTDIR)$(libdir)/libhts.dylib
452 ln -sf libhts.$(PACKAGE_VERSION).dylib $(DESTDIR)$(libdir)/libhts.$(LIBHTS_SOVERSION).dylib
454 # Substitute these pseudo-autoconf variables only at install time
455 # so that "make install prefix=/prefix/path" etc continue to work.
456 install-pkgconfig: htslib.pc.tmp installdirs
457 sed -e 's#@-includedir@#$(includedir)#g;s#@-libdir@#$(libdir)#g;s#@-PACKAGE_VERSION@#$(PACKAGE_VERSION)#g' htslib.pc.tmp > $(DESTDIR)$(pkgconfigdir)/htslib.pc
458 chmod 644 $(DESTDIR)$(pkgconfigdir)/htslib.pc
460 # A pkg-config file (suitable for copying to $PKG_CONFIG_PATH) that provides
461 # flags for building against the uninstalled library in this build directory.
462 htslib-uninstalled.pc: htslib.pc.tmp
463 sed -e 's#@-includedir@#'`pwd`'#g;s#@-libdir@#'`pwd`'#g' htslib.pc.tmp > $@
466 testclean:
467 -rm -f test/*.tmp test/*.tmp.* test/tabix/*.tmp.* test/tabix/FAIL*
469 mostlyclean: testclean
470 -rm -f *.o *.pico cram/*.o cram/*.pico test/*.o test/*.dSYM version.h
472 clean: mostlyclean clean-$(SHLIB_FLAVOUR)
473 -rm -f libhts.a $(BUILT_PROGRAMS) $(BUILT_PLUGINS) $(BUILT_TEST_PROGRAMS) $(BUILT_THRASH_PROGRAMS)
475 distclean maintainer-clean: clean
476 -rm -f config.cache config.h config.log config.mk config.status
477 -rm -f TAGS *.pc.tmp *-uninstalled.pc htslib_static.mk
478 -rm -rf autom4te.cache
480 clean-so:
481 -rm -f libhts.so libhts.so.*
483 clean-cygdll:
484 -rm -f cyghts-*.dll libhts.dll.a
486 clean-dylib:
487 -rm -f libhts.dylib libhts.*.dylib
490 tags TAGS:
491 ctags -f TAGS *.[ch] cram/*.[ch] htslib/*.h
493 # We recommend libhts-using programs be built against a separate htslib
494 # installation. However if you feel that you must bundle htslib source
495 # code with your program, this hook enables Automake-style "make dist"
496 # for this subdirectory. If you do bundle an htslib snapshot, please
497 # add identifying information to $(PACKAGE_VERSION) as appropriate.
498 # (The wildcards attempt to omit non-exported files (.git*, README.md,
499 # etc) and other detritus that might be in the top-level directory.)
500 distdir:
501 tar -c *.[ch15] [ILMNRcht]*[ELSbcekmnt] | (cd $(distdir) && tar -x)
502 +cd $(distdir) && $(MAKE) distclean
504 force:
507 .PHONY: all check clean distclean distdir force
508 .PHONY: install install-pkgconfig installdirs lib-shared lib-static
509 .PHONY: maintainer-clean mostlyclean plugins print-config print-version
510 .PHONY: tags test testclean
511 .PHONY: clean-so install-so
512 .PHONY: clean-cygdll install-cygdll
513 .PHONY: clean-dylib install-dylib