Makefile.in 5.37 KB
Newer Older
1
2
3
4
5
6
7
8
9
@SET_MAKE@

srcdir = @srcdir@
VPATH = @srcdir@

top_srcdir = @top_srcdir@

include ../config.make

10
11
PRE_CPPFLAGS = -I.. -I$(top_srcdir)
PRE_LDFLAGS = -L..
12

13
14
15
TS_NETTLE_SOURCES = aes-test.c arcfour-test.c arctwo-test.c \
		    blowfish-test.c cast128-test.c \
	            base16-test.c base64-test.c \
16
		    camellia-test.c chacha-test.c \
17
18
		    des-test.c des3-test.c des-compat-test.c \
		    md2-test.c md4-test.c md5-test.c md5-compat-test.c \
Niels Möller's avatar
Niels Möller committed
19
		    memeql-test.c memxor-test.c gosthash94-test.c \
20
		    ripemd160-test.c hkdf-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
25
		    sha3-permute-test.c sha3-224-test.c sha3-256-test.c \
		    sha3-384-test.c sha3-512-test.c \
26
		    serpent-test.c twofish-test.c version-test.c \
27
		    knuth-lfib-test.c \
Dmitry Baryshkov's avatar
Dmitry Baryshkov committed
28
		    cbc-test.c cfb-test.c ctr-test.c gcm-test.c eax-test.c ccm-test.c \
Niels Möller's avatar
Niels Möller committed
29
		    poly1305-test.c chacha-poly1305-test.c \
Niels Möller's avatar
Niels Möller committed
30
		    hmac-test.c umac-test.c \
31
32
		    meta-hash-test.c meta-cipher-test.c\
		    meta-aead-test.c meta-armor-test.c \
Daiki Ueno's avatar
Daiki Ueno committed
33
		    buffer-test.c yarrow-test.c pbkdf2-test.c pss-mgf1-test.c
34
35
36

TS_HOGWEED_SOURCES = sexp-test.c sexp-format-test.c \
		     rsa2sexp-test.c sexp2rsa-test.c \
37
		     bignum-test.c random-prime-test.c \
Daiki Ueno's avatar
Daiki Ueno committed
38
		     pkcs1-test.c pss-test.c rsa-sign-tr-test.c \
39
		     rsa-pss-sign-tr-test.c \
40
		     rsa-test.c rsa-encrypt-test.c rsa-keygen-test.c \
Niels Möller's avatar
Niels Möller committed
41
		     dsa-test.c dsa-keygen-test.c \
Niels Möller's avatar
Niels Möller committed
42
		     curve25519-dh-test.c \
Niels Möller's avatar
Niels Möller committed
43
		     ecc-mod-test.c ecc-modinv-test.c ecc-redc-test.c \
Niels Möller's avatar
Niels Möller committed
44
		     ecc-sqrt-test.c \
45
46
		     ecc-dup-test.c ecc-add-test.c \
		     ecc-mul-g-test.c ecc-mul-a-test.c \
47
		     ecdsa-sign-test.c ecdsa-verify-test.c \
48
		     ecdsa-keygen-test.c ecdh-test.c \
Niels Möller's avatar
Niels Möller committed
49
		     eddsa-compress-test.c eddsa-sign-test.c \
Niels Möller's avatar
Niels Möller committed
50
		     eddsa-verify-test.c ed25519-test.c
51

52
53
TS_SOURCES = $(TS_NETTLE_SOURCES) $(TS_HOGWEED_SOURCES)
CXX_SOURCES = cxx-test.cxx
54
55
56
57

TS_NETTLE = $(TS_NETTLE_SOURCES:.c=$(EXEEXT))
TS_HOGWEED = $(TS_HOGWEED_SOURCES:.c=$(EXEEXT))
TS_C = $(TS_NETTLE) @IF_HOGWEED@ $(TS_HOGWEED)
58
TS_CXX = @IF_CXX@ $(CXX_SOURCES:.cxx=$(EXEEXT))
59
TARGETS = $(TS_C) $(TS_CXX)
Niels Möller's avatar
Niels Möller committed
60
TS_SH = sexp-conv-test pkcs1-conv-test nettle-pbkdf2-test symbols-test
61
TS_ALL = $(TARGETS) $(TS_SH) @IF_DLOPEN_TEST@ dlopen-test$(EXEEXT)
62
63
EXTRA_SOURCES = sha1-huge-test.c
EXTRA_TARGETS = $(EXTRA_SOURCES:.c=$(EXEEXT))
64

65

66
# Includes all C source files, regardless of configuration
67
SOURCES = $(TS_SOURCES) $(EXTRA_SOURCES) testutils.c dlopen-test.c
68

69
DISTFILES = $(SOURCES) $(CXX_SOURCES) Makefile.in .test-rules.make \
70
	    test-rules.stamp \
71
	    $(TS_SH) setup-env teardown-env \
Niels Möller's avatar
Niels Möller committed
72
	    gold-bug.txt testutils.h sha3.awk
73

74
all: $(EXTRA_TARGETS)
75
76

.c.$(OBJEXT):
77
78
	$(COMPILE) -c $< && $(DEP_PROCESS)

79
80
81
82
.SUFFIXES: .cxx
.cxx.$(OBJEXT):
	$(COMPILE_CXX) -c $< && $(DEP_PROCESS)

83
84
85
86
# BSD (and Solaris) make doesn't allow extra dependencies together one
# single-suffix rules, which makes it impossible or almost impossible
# to use suffix rules to build the test executables. So we use an
# explicit rule for each and every executable.
87

88
LIB_HOGWEED = @IF_HOGWEED@ -lhogweed
89
90
91
92
TEST_OBJS = testutils.$(OBJEXT) ../nettle-internal.$(OBJEXT) \
	    $(LIB_HOGWEED) -lnettle $(LIBS)

../nettle-internal.$(OBJEXT):
93
	( cd .. && $(MAKE) nettle-internal.$(OBJEXT) )
94

95
96
97
98
# Special target, to omit linking with libnettle
dlopen-test$(EXEEXT): dlopen-test.$(OBJEXT) testutils.$(OBJEXT)
	$(LINK) dlopen-test.$(OBJEXT) -ldl -o dlopen-test$(EXEEXT)

99
.PHONY: test-rules
100
test-rules:
101
	(for f in $(TS_NETTLE) $(TS_HOGWEED) $(EXTRA_TARGETS) ; do \
102
103
104
	  echo $$f'$$(EXEEXT): '$$f'.$$(OBJEXT)' ; \
	  echo '	$$(LINK) '$$f'.$$(OBJEXT) $$(TEST_OBJS) -o '$$f'$$(EXEEXT)' ; \
	  echo ; \
105
106
107
108
109
110
	done ; \
	for f in $(TS_CXX) ; do \
	  echo $$f'$$(EXEEXT): '$$f'.$$(OBJEXT)' ; \
	  echo '	$$(LINK_CXX) '$$f'.$$(OBJEXT) $$(TEST_OBJS) -o '$$f'$$(EXEEXT)' ; \
	  echo ; \
	done) > $(srcdir)/.test-rules.make
111
112
113
114
115
116
117
118

$(srcdir)/.test-rules.make: $(srcdir)/test-rules.stamp

# Updates the stamp file *first*, so that this rule isn't triggered
# again and again by the recursive $(MAKE).
$(srcdir)/test-rules.stamp: Makefile.in
	echo stamp > $(srcdir)/test-rules.stamp
	$(MAKE) test-rules
Niels Möller's avatar
Niels Möller committed
119

120
include $(srcdir)/.test-rules.make
121

122
$(TARGETS) $(EXTRA_TARGETS): testutils.$(OBJEXT) ../nettle-internal.$(OBJEXT) \
123
	../libnettle.stamp @IF_HOGWEED@ ../libhogweed.stamp
124

125
126
127
128
129
# For use as, e.g.,
#
#   make check EMULATOR='$(VALGRIND)'
#   make check EMULATOR='$(VALGRIND) --log-fd=3' 3>valgrind.log

130
131
# --partial-loads-ok=yes is needed for memxor's handling of unaligned
# data.
132
VALGRIND = valgrind --error-exitcode=1 --leak-check=full --show-reachable=yes @IF_ASM@ --partial-loads-ok=yes
133

134
# The PATH update is for locating dlls on w*ndows.
135
check: $(TS_ALL)
136
	LD_LIBRARY_PATH=../.lib PATH="../.lib:$$PATH" srcdir="$(srcdir)" \
137
	  EMULATOR="$(EMULATOR)" NM="$(NM)" EXEEXT="$(EXEEXT)" \
138
          $(top_srcdir)/run-tests $(TS_ALL)
139
140
141
142
143


Makefile: $(srcdir)/Makefile.in ../config.status
	cd .. && $(SHELL) ./config.status testsuite/$@

144
install uninstall:
145
146
147
	true

distdir: $(DISTFILES)
148
	cp $? $(distdir)
149
150

clean:
151
152
	-rm -f $(TARGETS) $(EXTRA_TARGETS) dlopen-test$(EXEEXT) \
		*.o test.in test1.out test2.out
153
154

distclean: clean
155
	-rm -f Makefile *.d
156

157
tags:
158
	etags -o $(srcdir)/TAGS --include $(top_srcdir) $(srcdir)/*.c $(srcdir)/*.h
159

160
161
# Includes dependency files for everything, including objects which
# the current configuration will not build.
162
163
DEP_FILES = $(SOURCES:.c=.$(OBJEXT).d) $(CXX_SOURCES:.cxx=.$(OBJEXT).d)
@DEP_INCLUDE@ $(DEP_FILES)