summaryrefslogtreecommitdiff
path: root/Makefile.am
blob: 8daa3b37f37e9521584d049c20124a96f6bb2b9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Top-level liberasurecode automake configuration
SUBDIRS = src test doc

EXTRA_DIST = autogen.sh get_flags_from_cpuid.c

INCLUDE = -I$(abs_top_builddir)/include \
		  -I$(abs_top_builddir)/include/erasurecode \
		  -I$(abs_top_builddir)/include/xor_codes

AM_CPPFLAGS = $(CPPFLAGS) $(INCLUDE)
AM_CPPFLAGS += -Werror -Wall

AM_CFLAGS = -fPIC $(AM_CPPFLAGS) @GCOV_FLAGS@ -L/usr/local/lib

thisincludedir = $(includedir)/liberasurecode
thisinclude_HEADERS = \
	include/erasurecode/alg_sig.h \
	include/erasurecode/erasurecode.h \
	include/erasurecode/erasurecode_backend.h \
	include/erasurecode/erasurecode_helpers.h \
	include/erasurecode/erasurecode_helpers_ext.h \
	include/erasurecode/erasurecode_log.h \
	include/erasurecode/erasurecode_preprocessing.h \
	include/erasurecode/erasurecode_postprocessing.h \
	include/erasurecode/erasurecode_stdinc.h \
	include/erasurecode/erasurecode_version.h \
	include/erasurecode/list.h \
	include/xor_codes/xor_hd_code_defs.h \
	include/xor_codes/xor_code.h \
	include/config_liberasurecode.h \
	include/rs_vand/rs_galois.h \
	include/rs_vand/liberasurecode_rs_vand.h

install-exec-hook:
	-(cd $(DESTDIR)$(includedir) && \
	   rm -f erasurecode.h erasurecode_version.h \
	         erasurecode_stdinc.h erasurecode_helpers.h \
	         config_liberasurecode.h && \
	   $(LN_S) liberasurecode/erasurecode.h && \
	   $(LN_S) liberasurecode/erasurecode_version.h && \
	   $(LN_S) liberasurecode/erasurecode_stdinc.h && \
	   $(LN_S) liberasurecode/erasurecode_helpers.h && \
	   $(LN_S) liberasurecode/config_liberasurecode.h)

test: check
	$(eval SONAMES := $(shell find $(abs_top_builddir) -name '*.so'))
	$(eval SODIRS := $(dir $(SONAMES)))
	$(eval LD_LIBRARY_PATH := LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):$(subst / ,/:,$(SODIRS))")
	$(eval DYLD_LIBRARY_PATH := DYLD_LIBRARY_PATH="$(DYLD_LIBRARY_PATH):$(subst / ,/:,$(SODIRS))")
	$(eval DYLD_FALLBACK_LIBRARY_PATH := DYLD_FALLBACK_LIBRARY_PATH=$(DYLD_FALLBACK_LIBRARY_PATH):"$(subst / ,/:,$(SODIRS))")
	@$(LD_LIBRARY_PATH) $(DYLD_LIBRARY_PATH) $(DYLD_FALLBACK_LIBRARY_PATH) \
		./test/liberasurecode_test
	@$(LD_LIBRARY_PATH) $(DYLD_LIBRARY_PATH) $(DYLD_FALLBACK_LIBRARY_PATH) \
		./test/alg_sig_test
	@$(LD_LIBRARY_PATH) $(DYLD_LIBRARY_PATH) $(DYLD_FALLBACK_LIBRARY_PATH) \
		./test/test_xor_hd_code
	@$(LD_LIBRARY_PATH) $(DYLD_LIBRARY_PATH) $(DYLD_FALLBACK_LIBRARY_PATH) \
		./test/libec_slap
 
VALGRIND_EXEC_COMMAND = $(LIBTOOL_COMMAND) valgrind --tool=memcheck \
	--error-exitcode=1 --leak-check=yes --track-fds=yes \
	--malloc-fill=A5 --free-fill=DE --fullpath-after=.

valgrind-test: check
	@$(VALGRIND_EXEC_COMMAND) ./test/alg_sig_test
	@$(VALGRIND_EXEC_COMMAND) ./test/liberasurecode_test
	@$(VALGRIND_EXEC_COMMAND) ./test/test_xor_hd_code
	@$(VALGRIND_EXEC_COMMAND) ./test/libec_slap

CLEANFILES = cscope.in.out cscope.out cscope.po.out

.PHONY: cscope
cscope:
	find src include -name "*.[ch]" > cscope.files
	cscope -q -b

MOSTLYCLEANFILES = *.gcda *.gcno *.gcov