Makefile.in 3.98 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 \
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 \
19
		    memxor-test.c gosthash94-test.c \
20
		    ripemd160-test.c \
21
		    salsa20-test.c \
22 23
		    sha1-test.c sha224-test.c sha256-test.c \
		    sha384-test.c sha512-test.c \
Niels Möller's avatar
Niels Möller committed
24
		    sha3-permute-test.c sha3-256-test.c \
25
		    serpent-test.c twofish-test.c \
26
		    knuth-lfib-test.c \
27
		    cbc-test.c ctr-test.c gcm-test.c hmac-test.c \
28
		    meta-hash-test.c meta-cipher-test.c meta-armor-test.c \
Simon Josefsson's avatar
Simon Josefsson committed
29
		    buffer-test.c yarrow-test.c pbkdf2-test.c
30 31 32

TS_HOGWEED_SOURCES = sexp-test.c sexp-format-test.c \
		     rsa2sexp-test.c sexp2rsa-test.c \
33
		     bignum-test.c random-prime-test.c \
34 35 36 37
		     pkcs1-test.c \
		     rsa-test.c rsa-encrypt-test.c rsa-keygen-test.c \
		     dsa-test.c dsa-keygen-test.c

38 39
TS_SOURCES = $(TS_NETTLE_SOURCES) $(TS_HOGWEED_SOURCES)
CXX_SOURCES = cxx-test.cxx
40 41 42 43

TS_NETTLE = $(TS_NETTLE_SOURCES:.c=$(EXEEXT))
TS_HOGWEED = $(TS_HOGWEED_SOURCES:.c=$(EXEEXT))
TS_C = $(TS_NETTLE) @IF_HOGWEED@ $(TS_HOGWEED)
44
TS_CXX = @IF_CXX@ $(CXX_SOURCES:.cxx=$(EXEEXT))
45
TARGETS = $(TS_C) $(TS_CXX)
46
TS_SH = sexp-conv-test pkcs1-conv-test symbols-test
47
TS_ALL = $(TARGETS) $(TS_SH)
48 49
EXTRA_SOURCES = sha1-huge-test.c
EXTRA_TARGETS = $(EXTRA_SOURCES:.c=$(EXEEXT))
50

51
# Includes all C source files, regardless of configuration
52
SOURCES = $(TS_SOURCES) $(EXTRA_SOURCES) testutils.c
53

54
DISTFILES = $(SOURCES) $(CXX_SOURCES) Makefile.in .test-rules.make \
55
	    $(TS_SH) setup-env teardown-env \
Niels Möller's avatar
Niels Möller committed
56
	    gold-bug.txt testutils.h sha3.awk
57

58
all: $(TARGETS) $(EXTRA_TARGETS)
59 60

.c.$(OBJEXT):
61 62
	$(COMPILE) -c $< && $(DEP_PROCESS)

63 64 65 66
.SUFFIXES: .cxx
.cxx.$(OBJEXT):
	$(COMPILE_CXX) -c $< && $(DEP_PROCESS)

67 68 69 70
# 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.
71

72
LIB_HOGWEED = @IF_HOGWEED@ -lhogweed
73 74 75 76 77
TEST_OBJS = testutils.$(OBJEXT) ../nettle-internal.$(OBJEXT) \
	    $(LIB_HOGWEED) -lnettle $(LIBS)

../nettle-internal.$(OBJEXT):
	( cd .. && $(MAKE) $@ )
78

79 80
.PHONY: test-rules
test-rules:
81
	(for f in $(TS_NETTLE) $(TS_HOGWEED) $(EXTRA_TARGETS) ; do \
82 83 84
	  echo $$f'$$(EXEEXT): '$$f'.$$(OBJEXT)' ; \
	  echo '	$$(LINK) '$$f'.$$(OBJEXT) $$(TEST_OBJS) -o '$$f'$$(EXEEXT)' ; \
	  echo ; \
85 86 87 88 89 90
	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
Niels Möller's avatar
Niels Möller committed
91

92
include $(srcdir)/.test-rules.make
93

94
$(TARGETS) $(EXTRA_TARGETS): testutils.$(OBJEXT) ../nettle-internal.$(OBJEXT) \
95
	../libnettle.a @IF_HOGWEED@ ../libhogweed.a
96

97 98 99 100 101 102 103
# For use as, e.g.,
#
#   make check EMULATOR='$(VALGRIND)'
#   make check EMULATOR='$(VALGRIND) --log-fd=3' 3>valgrind.log

VALGRIND = valgrind --error-exitcode=1 --leak-check=full --show-reachable=yes

104
# The PATH update is for locating dlls on w*ndows.
105
check: $(TS_ALL)
106
	LD_LIBRARY_PATH=../.lib PATH="../.lib:$$PATH" srcdir="$(srcdir)" \
107
	  EMULATOR="$(EMULATOR)" NM="$(NM)" EXEEXT="$(EXEEXT)" \
108
          $(top_srcdir)/run-tests $(TS_ALL)
109 110 111 112 113


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

114
install uninstall:
115 116 117
	true

distdir: $(DISTFILES)
118
	cp $? $(distdir)
119 120

clean:
121
	-rm -f $(TARGETS) $(EXTRA_TARGETS) *.o test.in test1.out test2.out
122 123

distclean: clean
124
	-rm -f Makefile *.d
125

126
tags:
127
	etags -o $(srcdir)/TAGS --include $(top_srcdir) $(srcdir)/*.c $(srcdir)/*.h
128

129 130
# Includes dependency files for everything, including objects which
# the current configuration will not build.
131 132
DEP_FILES = $(SOURCES:.c=.$(OBJEXT).d) $(CXX_SOURCES:.cxx=.$(OBJEXT).d)
@DEP_INCLUDE@ $(DEP_FILES)