Makefile.in 3.42 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 \
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 \
24
		    serpent-test.c twofish-test.c \
25
		    knuth-lfib-test.c \
26
		    cbc-test.c ctr-test.c gcm-test.c hmac-test.c \
27
		    meta-hash-test.c meta-cipher-test.c meta-armor-test.c \
28 29 30 31
		    buffer-test.c yarrow-test.c

TS_HOGWEED_SOURCES = sexp-test.c sexp-format-test.c \
		     rsa2sexp-test.c sexp2rsa-test.c \
32
		     bignum-test.c random-prime-test.c \
33 34 35 36 37 38 39 40 41
		     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)
42 43
TS_CXX = @CXX_TESTS@
TARGETS = $(TS_C) $(TS_CXX)
44
TS_SH = sexp-conv-test pkcs1-conv-test symbols-test
45
TS_ALL = $(TARGETS) $(TS_SH)
46 47
EXTRA_SOURCES = sha1-huge-test.c
EXTRA_TARGETS = $(EXTRA_SOURCES:.c=$(EXEEXT))
48 49 50

SOURCES = $(TS_SOURCES) testutils.c

51
DISTFILES = $(SOURCES) $(EXTRA_SOURCES) cxx-test.cxx Makefile.in .test-rules.make \
52
	$(TS_SH) setup-env teardown-env \
53
	gold-bug.txt testutils.h
54

55
all: $(TARGETS) $(EXTRA_TARGETS)
56 57

.c.$(OBJEXT):
58 59
	$(COMPILE) -c $< && $(DEP_PROCESS)

60 61 62 63
.SUFFIXES: .cxx
.cxx.$(OBJEXT):
	$(COMPILE_CXX) -c $< && $(DEP_PROCESS)

64 65 66 67
# 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.
68

69
LIB_HOGWEED = @IF_HOGWEED@ -lhogweed
70 71 72 73 74
TEST_OBJS = testutils.$(OBJEXT) ../nettle-internal.$(OBJEXT) \
	    $(LIB_HOGWEED) -lnettle $(LIBS)

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

76 77
.PHONY: test-rules
test-rules:
78
	(for f in $(TS_NETTLE) $(TS_HOGWEED) $(EXTRA_TARGETS) ; do \
79 80 81
	  echo $$f'$$(EXEEXT): '$$f'.$$(OBJEXT)' ; \
	  echo '	$$(LINK) '$$f'.$$(OBJEXT) $$(TEST_OBJS) -o '$$f'$$(EXEEXT)' ; \
	  echo ; \
82 83 84 85 86 87
	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
88

89
include $(srcdir)/.test-rules.make
90

91
$(TARGETS) $(EXTRA_TARGETS): testutils.$(OBJEXT) ../nettle-internal.$(OBJEXT) \
92
	../libnettle.a @IF_HOGWEED@ ../libhogweed.a
93

94
# The PATH update is for locating dlls on w*ndows.
95
check: $(TS_ALL)
96
	LD_LIBRARY_PATH=../.lib PATH="../.lib:$$PATH" srcdir="$(srcdir)" \
97
	  EMULATOR="$(EMULATOR)" NM="$(NM)" EXEEXT="$(EXEEXT)" \
98
          $(top_srcdir)/run-tests $(TS_ALL)
99 100 101 102 103


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

104
install uninstall:
105 106 107
	true

distdir: $(DISTFILES)
108
	cp $? $(distdir)
109 110

clean:
111
	-rm -f $(TARGETS) $(EXTRA_TARGETS) *.o test.in test1.out test2.out
112 113

distclean: clean
114
	-rm -f Makefile *.d
115

116
tags:
117
	etags -o $(srcdir)/TAGS --include $(top_srcdir) $(srcdir)/*.c $(srcdir)/*.h
118

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