Makefile.in 2.9 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 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
TS_NETTLE_SOURCES = aes-test.c arcfour-test.c arctwo-test.c \
		    blowfish-test.c cast128-test.c \
	            base16-test.c base64-test.c \
		    des-test.c des3-test.c des-compat-test.c \
		    md2-test.c md4-test.c md5-test.c md5-compat-test.c \
		    sha1-test.c sha256-test.c \
		    serpent-test.c twofish-test.c \
		    buffer-test.c yarrow-test.c

TS_HOGWEED_SOURCES = sexp-test.c sexp-format-test.c \
		     rsa2sexp-test.c sexp2rsa-test.c \
		     knuth-lfib-test.c \
		     cbc-test.c ctr-test.c hmac-test.c bignum-test.c \
		     pkcs1-test.c \
		     rsa-test.c rsa-encrypt-test.c rsa-keygen-test.c \
		     dsa-test.c dsa-keygen-test.c

TS_SOURCES = $(TS_NETTLE_SOURCES) @IF_HOGWEED@ $(TS_HOGWEED_SOURCES)

TS_NETTLE = $(TS_NETTLE_SOURCES:.c=$(EXEEXT))
TS_HOGWEED = $(TS_HOGWEED_SOURCES:.c=$(EXEEXT))
TS_C = $(TS_NETTLE) @IF_HOGWEED@ $(TS_HOGWEED)
35 36
TS_CXX = @CXX_TESTS@
TARGETS = $(TS_C) $(TS_CXX)
37
TS_SH = sexp-conv-test pkcs1-conv-test symbols-test
38
TS_ALL = $(TARGETS) $(TS_SH)
39 40
EXTRA_SOURCES = sha1-huge-test.c
EXTRA_TARGETS = $(EXTRA_SOURCES:.c=$(EXEEXT))
41 42 43

SOURCES = $(TS_SOURCES) testutils.c

44
DISTFILES = $(SOURCES) $(EXTRA_SOURCES) cxx-test.cxx Makefile.in .test-rules.make \
45
	$(TS_SH) run-tests teardown-env \
46
	gold-bug.txt testutils.h
47

48
all: $(TARGETS) $(EXTRA_TARGETS)
49 50

.c.$(OBJEXT):
51 52
	$(COMPILE) -c $< && $(DEP_PROCESS)

53 54 55 56
.SUFFIXES: .cxx
.cxx.$(OBJEXT):
	$(COMPILE_CXX) -c $< && $(DEP_PROCESS)

57 58 59 60
# 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.
61

62 63
LIB_HOGWEED = @IF_HOGWEED@ -lhogweed
TEST_OBJS = testutils.$(OBJEXT) $(LIB_HOGWEED) -lnettle $(LIBS)
64

65 66
.PHONY: test-rules
test-rules:
67
	(for f in $(TS_NETTLE) $(TS_HOGWEED) $(EXTRA_TARGETS) ; do \
68 69 70
	  echo $$f'$$(EXEEXT): '$$f'.$$(OBJEXT)' ; \
	  echo '	$$(LINK) '$$f'.$$(OBJEXT) $$(TEST_OBJS) -o '$$f'$$(EXEEXT)' ; \
	  echo ; \
71 72 73 74 75 76
	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
77

78
include $(srcdir)/.test-rules.make
79

80
$(TARGETS) $(EXTRA_TARGETS) : testutils.$(OBJEXT) ../libnettle.a
81 82 83 84 85 86 87 88 89

check: $(TS_ALL) $(srcdir)/run-tests
	LD_LIBRARY_PATH=../.lib srcdir="$(srcdir)" \
	  $(srcdir)/run-tests $(TS_ALL)


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

90
install uninstall:
91 92 93
	true

distdir: $(DISTFILES)
94
	cp $? $(distdir)
95 96

clean:
97
	-rm -f $(TARGETS) $(EXTRA_TARGETS) *.o test.in test1.out test2.out
98 99

distclean: clean
100
	-rm -f Makefile *.d
101

102 103 104
tags:
	etags --include $(top_srcdir) $(srcdir)/*.c $(srcdir)/*.h

105
@DEP_INCLUDE@ $(SOURCES:.c=.$(OBJEXT).d)