1# Top-level liberasurecode automake configuration
2SUBDIRS = src test doc
3
4EXTRA_DIST = autogen.sh get_flags_from_cpuid.c
5
6INCLUDE = -I$(abs_top_builddir)/include \
7		  -I$(abs_top_builddir)/include/erasurecode \
8		  -I$(abs_top_builddir)/include/xor_codes
9
10AM_CPPFLAGS = $(CPPFLAGS) $(INCLUDE)
11AM_CPPFLAGS += -Werror -Wall
12
13AM_CFLAGS = -fPIC $(AM_CPPFLAGS) @GCOV_FLAGS@ -L/usr/local/lib
14
15thisincludedir = $(includedir)/liberasurecode
16thisinclude_HEADERS = \
17	include/erasurecode/alg_sig.h \
18	include/erasurecode/erasurecode.h \
19	include/erasurecode/erasurecode_backend.h \
20	include/erasurecode/erasurecode_helpers.h \
21	include/erasurecode/erasurecode_helpers_ext.h \
22	include/erasurecode/erasurecode_log.h \
23	include/erasurecode/erasurecode_preprocessing.h \
24	include/erasurecode/erasurecode_postprocessing.h \
25	include/erasurecode/erasurecode_stdinc.h \
26	include/erasurecode/erasurecode_version.h \
27	include/erasurecode/list.h \
28	include/xor_codes/xor_hd_code_defs.h \
29	include/xor_codes/xor_code.h \
30	include/config_liberasurecode.h \
31	include/rs_vand/rs_galois.h \
32	include/rs_vand/liberasurecode_rs_vand.h
33
34pkgconfig_DATA = erasurecode-$(LIBERASURECODE_API_VERSION).pc
35
36install-exec-hook:
37	-(mkdir -p $(DESTDIR)$(includedir) && \
38	   cd $(DESTDIR)$(includedir) && \
39	   rm -f erasurecode.h erasurecode_version.h \
40	         erasurecode_stdinc.h erasurecode_helpers.h \
41	         config_liberasurecode.h && \
42	   $(LN_S) liberasurecode/erasurecode.h && \
43	   $(LN_S) liberasurecode/erasurecode_version.h && \
44	   $(LN_S) liberasurecode/erasurecode_stdinc.h && \
45	   $(LN_S) liberasurecode/erasurecode_helpers.h && \
46	   $(LN_S) liberasurecode/config_liberasurecode.h)
47
48test: check
49	$(eval SONAMES := $(shell find $(abs_top_builddir) -name '*.so'))
50	$(eval SODIRS := $(dir $(SONAMES)))
51	$(eval LD_LIBRARY_PATH := LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):$(subst / ,/:,$(SODIRS))")
52	$(eval DYLD_LIBRARY_PATH := DYLD_LIBRARY_PATH="$(DYLD_LIBRARY_PATH):$(subst / ,/:,$(SODIRS))")
53	$(eval DYLD_FALLBACK_LIBRARY_PATH := DYLD_FALLBACK_LIBRARY_PATH=$(DYLD_FALLBACK_LIBRARY_PATH):"$(subst / ,/:,$(SODIRS))")
54	@$(LD_LIBRARY_PATH) $(DYLD_LIBRARY_PATH) $(DYLD_FALLBACK_LIBRARY_PATH) \
55		./test/liberasurecode_test
56	@$(LD_LIBRARY_PATH) $(DYLD_LIBRARY_PATH) $(DYLD_FALLBACK_LIBRARY_PATH) \
57		./test/alg_sig_test
58	@$(LD_LIBRARY_PATH) $(DYLD_LIBRARY_PATH) $(DYLD_FALLBACK_LIBRARY_PATH) \
59		./test/test_xor_hd_code
60	@$(LD_LIBRARY_PATH) $(DYLD_LIBRARY_PATH) $(DYLD_FALLBACK_LIBRARY_PATH) \
61		./test/libec_slap
62
63VALGRIND_EXEC_COMMAND = $(LIBTOOL_COMMAND) valgrind --tool=memcheck \
64	--error-exitcode=1 --leak-check=yes --track-fds=yes \
65	--malloc-fill=A5 --free-fill=DE --fullpath-after=.
66
67valgrind-test: check
68	@$(VALGRIND_EXEC_COMMAND) ./test/alg_sig_test
69	@$(VALGRIND_EXEC_COMMAND) ./test/liberasurecode_test
70	@$(VALGRIND_EXEC_COMMAND) ./test/test_xor_hd_code
71	@$(VALGRIND_EXEC_COMMAND) ./test/libec_slap
72
73CLEANFILES = cscope.in.out cscope.out cscope.po.out
74
75.PHONY: cscope
76cscope:
77	find src include -name "*.[ch]" > cscope.files
78	cscope -q -b
79
80MOSTLYCLEANFILES = *.gcda *.gcno *.gcov
81