Revert "Merge branch 'upstream' into tizen"
[platform/upstream/nettle.git] / testsuite / Makefile.in
1 @SET_MAKE@
2
3 srcdir = @srcdir@
4 VPATH = @srcdir@
5
6 top_srcdir = @top_srcdir@
7
8 include ../config.make
9
10 PRE_CPPFLAGS = -I.. -I$(top_srcdir)
11 PRE_LDFLAGS = -L..
12
13 TS_NETTLE_SOURCES = aes-test.c arcfour-test.c arctwo-test.c \
14                     blowfish-test.c cast128-test.c \
15                     base16-test.c base64-test.c \
16                     camellia-test.c \
17                     des-test.c des3-test.c des-compat-test.c \
18                     md2-test.c md4-test.c md5-test.c md5-compat-test.c \
19                     memxor-test.c gosthash94-test.c \
20                     ripemd160-test.c \
21                     salsa20-test.c \
22                     sha1-test.c sha224-test.c sha256-test.c \
23                     sha384-test.c sha512-test.c \
24                     sha3-permute-test.c sha3-224-test.c sha3-256-test.c \
25                     sha3-384-test.c sha3-512-test.c \
26                     serpent-test.c twofish-test.c \
27                     knuth-lfib-test.c \
28                     cbc-test.c ctr-test.c gcm-test.c hmac-test.c umac-test.c \
29                     meta-hash-test.c meta-cipher-test.c meta-armor-test.c \
30                     buffer-test.c yarrow-test.c pbkdf2-test.c
31
32 TS_HOGWEED_SOURCES = sexp-test.c sexp-format-test.c \
33                      rsa2sexp-test.c sexp2rsa-test.c \
34                      bignum-test.c random-prime-test.c \
35                      pkcs1-test.c \
36                      rsa-test.c rsa-encrypt-test.c rsa-keygen-test.c \
37                      dsa-test.c dsa-keygen-test.c \
38                      ecc-mod-test.c ecc-modinv-test.c ecc-redc-test.c \
39                      ecc-mul-g-test.c ecc-mul-a-test.c \
40                      ecdsa-sign-test.c ecdsa-verify-test.c ecdsa-keygen-test.c
41
42 TS_SOURCES = $(TS_NETTLE_SOURCES) $(TS_HOGWEED_SOURCES)
43 CXX_SOURCES = cxx-test.cxx
44
45 TS_NETTLE = $(TS_NETTLE_SOURCES:.c=$(EXEEXT))
46 TS_HOGWEED = $(TS_HOGWEED_SOURCES:.c=$(EXEEXT))
47 TS_C = $(TS_NETTLE) @IF_HOGWEED@ $(TS_HOGWEED)
48 TS_CXX = @IF_CXX@ $(CXX_SOURCES:.cxx=$(EXEEXT))
49 TARGETS = $(TS_C) $(TS_CXX)
50 TS_SH = sexp-conv-test pkcs1-conv-test symbols-test
51 TS_ALL = $(TARGETS) $(TS_SH)
52 EXTRA_SOURCES = sha1-huge-test.c
53 EXTRA_TARGETS = $(EXTRA_SOURCES:.c=$(EXEEXT))
54
55 # Includes all C source files, regardless of configuration
56 SOURCES = $(TS_SOURCES) $(EXTRA_SOURCES) testutils.c
57
58 DISTFILES = $(SOURCES) $(CXX_SOURCES) Makefile.in .test-rules.make \
59             $(TS_SH) setup-env teardown-env \
60             gold-bug.txt testutils.h sha3.awk
61
62 all: $(TARGETS) $(EXTRA_TARGETS)
63
64 .c.$(OBJEXT):
65         $(COMPILE) -c $< && $(DEP_PROCESS)
66
67 .SUFFIXES: .cxx
68 .cxx.$(OBJEXT):
69         $(COMPILE_CXX) -c $< && $(DEP_PROCESS)
70
71 # BSD (and Solaris) make doesn't allow extra dependencies together one
72 # single-suffix rules, which makes it impossible or almost impossible
73 # to use suffix rules to build the test executables. So we use an
74 # explicit rule for each and every executable.
75
76 LIB_HOGWEED = @IF_HOGWEED@ -lhogweed
77 TEST_OBJS = testutils.$(OBJEXT) ../nettle-internal.$(OBJEXT) \
78             $(LIB_HOGWEED) -lnettle $(LIBS)
79
80 ../nettle-internal.$(OBJEXT):
81         ( cd .. && $(MAKE) nettle-internal.$(OBJEXT) )
82
83 .PHONY: test-rules
84 test-rules:
85         (for f in $(TS_NETTLE) $(TS_HOGWEED) $(EXTRA_TARGETS) ; do \
86           echo $$f'$$(EXEEXT): '$$f'.$$(OBJEXT)' ; \
87           echo '        $$(LINK) '$$f'.$$(OBJEXT) $$(TEST_OBJS) -o '$$f'$$(EXEEXT)' ; \
88           echo ; \
89         done ; \
90         for f in $(TS_CXX) ; do \
91           echo $$f'$$(EXEEXT): '$$f'.$$(OBJEXT)' ; \
92           echo '        $$(LINK_CXX) '$$f'.$$(OBJEXT) $$(TEST_OBJS) -o '$$f'$$(EXEEXT)' ; \
93           echo ; \
94         done) > $(srcdir)/.test-rules.make
95
96 include $(srcdir)/.test-rules.make
97
98 $(TARGETS) $(EXTRA_TARGETS): testutils.$(OBJEXT) ../nettle-internal.$(OBJEXT) \
99         ../libnettle.a @IF_HOGWEED@ ../libhogweed.a
100
101 # For use as, e.g.,
102 #
103 #   make check EMULATOR='$(VALGRIND)'
104 #   make check EMULATOR='$(VALGRIND) --log-fd=3' 3>valgrind.log
105
106 VALGRIND = valgrind --error-exitcode=1 --leak-check=full --show-reachable=yes
107
108 # The PATH update is for locating dlls on w*ndows.
109 check: $(TS_ALL)
110         LD_LIBRARY_PATH=../.lib PATH="../.lib:$$PATH" srcdir="$(srcdir)" \
111           EMULATOR="$(EMULATOR)" NM="$(NM)" EXEEXT="$(EXEEXT)" \
112           $(top_srcdir)/run-tests $(TS_ALL)
113
114
115 Makefile: $(srcdir)/Makefile.in ../config.status
116         cd .. && $(SHELL) ./config.status testsuite/$@
117
118 install uninstall:
119         true
120
121 distdir: $(DISTFILES)
122         cp $? $(distdir)
123
124 clean:
125         -rm -f $(TARGETS) $(EXTRA_TARGETS) *.o test.in test1.out test2.out
126
127 distclean: clean
128         -rm -f Makefile *.d
129
130 tags:
131         etags -o $(srcdir)/TAGS --include $(top_srcdir) $(srcdir)/*.c $(srcdir)/*.h
132
133 # Includes dependency files for everything, including objects which
134 # the current configuration will not build.
135 DEP_FILES = $(SOURCES:.c=.$(OBJEXT).d) $(CXX_SOURCES:.cxx=.$(OBJEXT).d)
136 @DEP_INCLUDE@ $(DEP_FILES)