Imported Upstream version 3.2
[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 chacha-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 sha512-224-test.c sha512-256-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 version-test.c \
27                     knuth-lfib-test.c \
28                     cbc-test.c ctr-test.c gcm-test.c eax-test.c ccm-test.c \
29                     poly1305-test.c chacha-poly1305-test.c \
30                     hmac-test.c umac-test.c \
31                     meta-hash-test.c meta-cipher-test.c\
32                     meta-aead-test.c meta-armor-test.c \
33                     buffer-test.c yarrow-test.c pbkdf2-test.c
34
35 TS_HOGWEED_SOURCES = sexp-test.c sexp-format-test.c \
36                      rsa2sexp-test.c sexp2rsa-test.c \
37                      bignum-test.c random-prime-test.c \
38                      pkcs1-test.c rsa-sign-tr-test.c \
39                      rsa-test.c rsa-encrypt-test.c rsa-keygen-test.c \
40                      dsa-test.c dsa-keygen-test.c \
41                      curve25519-dh-test.c \
42                      ecc-mod-test.c ecc-modinv-test.c ecc-redc-test.c \
43                      ecc-sqrt-test.c \
44                      ecc-dup-test.c ecc-add-test.c \
45                      ecc-mul-g-test.c ecc-mul-a-test.c \
46                      ecdsa-sign-test.c ecdsa-verify-test.c \
47                      ecdsa-keygen-test.c ecdh-test.c \
48                      eddsa-compress-test.c eddsa-sign-test.c \
49                      eddsa-verify-test.c ed25519-test.c
50
51 TS_SOURCES = $(TS_NETTLE_SOURCES) $(TS_HOGWEED_SOURCES)
52 CXX_SOURCES = cxx-test.cxx
53
54 TS_NETTLE = $(TS_NETTLE_SOURCES:.c=$(EXEEXT))
55 TS_HOGWEED = $(TS_HOGWEED_SOURCES:.c=$(EXEEXT))
56 TS_C = $(TS_NETTLE) @IF_HOGWEED@ $(TS_HOGWEED)
57 TS_CXX = @IF_CXX@ $(CXX_SOURCES:.cxx=$(EXEEXT))
58 TARGETS = $(TS_C) $(TS_CXX)
59 TS_SH = sexp-conv-test pkcs1-conv-test nettle-pbkdf2-test symbols-test
60 TS_ALL = $(TARGETS) $(TS_SH) @IF_DLOPEN_TEST@ dlopen-test$(EXEEXT)
61 EXTRA_SOURCES = sha1-huge-test.c
62 EXTRA_TARGETS = $(EXTRA_SOURCES:.c=$(EXEEXT))
63
64
65 # Includes all C source files, regardless of configuration
66 SOURCES = $(TS_SOURCES) $(EXTRA_SOURCES) testutils.c dlopen-test.c
67
68 DISTFILES = $(SOURCES) $(CXX_SOURCES) Makefile.in .test-rules.make \
69             $(TS_SH) setup-env teardown-env \
70             gold-bug.txt testutils.h sha3.awk
71
72 all: $(EXTRA_TARGETS)
73
74 .c.$(OBJEXT):
75         $(COMPILE) -c $< && $(DEP_PROCESS)
76
77 .SUFFIXES: .cxx
78 .cxx.$(OBJEXT):
79         $(COMPILE_CXX) -c $< && $(DEP_PROCESS)
80
81 # BSD (and Solaris) make doesn't allow extra dependencies together one
82 # single-suffix rules, which makes it impossible or almost impossible
83 # to use suffix rules to build the test executables. So we use an
84 # explicit rule for each and every executable.
85
86 LIB_HOGWEED = @IF_HOGWEED@ -lhogweed
87 TEST_OBJS = testutils.$(OBJEXT) ../nettle-internal.$(OBJEXT) \
88             $(LIB_HOGWEED) -lnettle $(LIBS)
89
90 ../nettle-internal.$(OBJEXT):
91         ( cd .. && $(MAKE) nettle-internal.$(OBJEXT) )
92
93 # Special target, to omit linking with libnettle
94 dlopen-test$(EXEEXT): dlopen-test.$(OBJEXT) testutils.$(OBJEXT)
95         $(LINK) dlopen-test.$(OBJEXT) -ldl -o dlopen-test$(EXEEXT)
96
97 .PHONY: test-rules
98 test-rules:
99         (for f in $(TS_NETTLE) $(TS_HOGWEED) $(EXTRA_TARGETS) ; do \
100           echo $$f'$$(EXEEXT): '$$f'.$$(OBJEXT)' ; \
101           echo '        $$(LINK) '$$f'.$$(OBJEXT) $$(TEST_OBJS) -o '$$f'$$(EXEEXT)' ; \
102           echo ; \
103         done ; \
104         for f in $(TS_CXX) ; do \
105           echo $$f'$$(EXEEXT): '$$f'.$$(OBJEXT)' ; \
106           echo '        $$(LINK_CXX) '$$f'.$$(OBJEXT) $$(TEST_OBJS) -o '$$f'$$(EXEEXT)' ; \
107           echo ; \
108         done) > $(srcdir)/.test-rules.make
109
110 include $(srcdir)/.test-rules.make
111
112 $(TARGETS) $(EXTRA_TARGETS): testutils.$(OBJEXT) ../nettle-internal.$(OBJEXT) \
113         ../libnettle.stamp @IF_HOGWEED@ ../libhogweed.stamp
114
115 # For use as, e.g.,
116 #
117 #   make check EMULATOR='$(VALGRIND)'
118 #   make check EMULATOR='$(VALGRIND) --log-fd=3' 3>valgrind.log
119
120 # --partial-loads-ok=yes is needed for memxor's handling of unaligned
121 # data.
122 VALGRIND = valgrind --error-exitcode=1 --leak-check=full --show-reachable=yes @IF_ASM@ --partial-loads-ok=yes
123
124 # The PATH update is for locating dlls on w*ndows.
125 check: $(TS_ALL)
126         LD_LIBRARY_PATH=../.lib PATH="../.lib:$$PATH" srcdir="$(srcdir)" \
127           EMULATOR="$(EMULATOR)" NM="$(NM)" EXEEXT="$(EXEEXT)" \
128           $(top_srcdir)/run-tests $(TS_ALL)
129
130
131 Makefile: $(srcdir)/Makefile.in ../config.status
132         cd .. && $(SHELL) ./config.status testsuite/$@
133
134 install uninstall:
135         true
136
137 distdir: $(DISTFILES)
138         cp $? $(distdir)
139
140 clean:
141         -rm -f $(TARGETS) $(EXTRA_TARGETS) dlopen-test$(EXEEXT) \
142                 *.o test.in test1.out test2.out
143
144 distclean: clean
145         -rm -f Makefile *.d
146
147 tags:
148         etags -o $(srcdir)/TAGS --include $(top_srcdir) $(srcdir)/*.c $(srcdir)/*.h
149
150 # Includes dependency files for everything, including objects which
151 # the current configuration will not build.
152 DEP_FILES = $(SOURCES:.c=.$(OBJEXT).d) $(CXX_SOURCES:.cxx=.$(OBJEXT).d)
153 @DEP_INCLUDE@ $(DEP_FILES)