Makefile.in 3.34 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
OPENSSL_LIBFLAGS = @OPENSSL_LIBFLAGS@
14
15
BENCH_LIBS = @BENCH_LIBS@

16
17
RSA_TARGETS = rsa-keygen$(EXEEXT) rsa-sign$(EXEEXT) \
	      rsa-verify$(EXEEXT) rsa-encrypt$(EXEEXT) rsa-decrypt$(EXEEXT)
18
TARGETS = nettle-benchmark$(EXEEXT) eratosthenes$(EXEEXT) @IF_HOGWEED@ $(RSA_TARGETS) next-prime$(EXEEXT) random-prime$(EXEEXT)
19
20
SOURCES = nettle-benchmark.c eratosthenes.c next-prime.c random-prime.c \
	nettle-openssl.c \
21
	io.c read_rsa_key.c getopt.c getopt1.c \
22
	rsa-encrypt.c rsa-decrypt.c rsa-keygen.c rsa-sign.c rsa-verify.c
23

Niels Möller's avatar
Niels Möller committed
24
25
GETOPT_OBJS = getopt.$(OBJEXT) getopt1.$(OBJEXT)

26
27
28
TS_ALL = rsa-sign-test rsa-verify-test rsa-encrypt-test

DISTFILES= $(SOURCES) Makefile.in $(TS_ALL) run-tests setup-env teardown-env \
29
	io.h rsa-session.h getopt.h
30
31
32
33

all: $(TARGETS)

.c.$(OBJEXT):
34
	$(COMPILE) -c $< && $(DEP_PROCESS)
35

36
# For Solaris and BSD make, we have to use an explicit rule for each executable
37
38
next-prime$(EXEEXT): next-prime.$(OBJEXT) $(GETOPT_OBJS) ../libhogweed.a
	$(LINK) next-prime.$(OBJEXT) $(GETOPT_OBJS) \
39
	-lhogweed -lnettle $(LIBS) -o next-prime$(EXEEXT)
40

41
42
43
44
random-prime$(EXEEXT): random-prime.$(OBJEXT) $(GETOPT_OBJS) ../libhogweed.a
	$(LINK) random-prime.$(OBJEXT) io.$(OBJEXT) $(GETOPT_OBJS) \
	-lhogweed -lnettle $(LIBS) -o random-prime$(EXEEXT)

Niels Möller's avatar
Niels Möller committed
45
46
rsa-keygen$(EXEEXT): rsa-keygen.$(OBJEXT) $(GETOPT_OBJS)
	$(LINK) rsa-keygen.$(OBJEXT) io.$(OBJEXT) $(GETOPT_OBJS) \
47
	-lhogweed -lnettle $(LIBS) -o rsa-keygen$(EXEEXT)
48

49
50
51
rsa-sign$(EXEEXT): rsa-sign.$(OBJEXT) read_rsa_key.$(OBJEXT)
	$(LINK) rsa-sign.$(OBJEXT) io.$(OBJEXT) read_rsa_key.$(OBJEXT) \
	-lhogweed -lnettle $(LIBS) -o rsa-sign$(EXEEXT)
52

53
54
55
rsa-verify$(EXEEXT): rsa-verify.$(OBJEXT) read_rsa_key.$(OBJEXT)
	$(LINK) rsa-verify.$(OBJEXT) io.$(OBJEXT) read_rsa_key.$(OBJEXT) \
	-lhogweed -lnettle $(LIBS) -o rsa-verify$(EXEEXT)
56

57
58
59
60
rsa-encrypt$(EXEEXT): rsa-encrypt.$(OBJEXT) read_rsa_key.$(OBJEXT) $(GETOPT_OBJS)
	$(LINK) rsa-encrypt.$(OBJEXT) io.$(OBJEXT) read_rsa_key.$(OBJEXT) \
	$(GETOPT_OBJS) \
	-lhogweed -lnettle $(LIBS) -o rsa-encrypt$(EXEEXT)
61

62
63
64
rsa-decrypt$(EXEEXT): rsa-decrypt.$(OBJEXT) read_rsa_key.$(OBJEXT)
	$(LINK) rsa-decrypt.$(OBJEXT) io.$(OBJEXT) read_rsa_key.$(OBJEXT) \
	-lhogweed -lnettle $(LIBS) -o rsa-decrypt$(EXEEXT)
65

66
67
68
eratosthenes$(EXEEXT): eratosthenes.$(OBJEXT) $(GETOPT_OBJS)
	$(LINK) eratosthenes.$(OBJEXT) $(GETOPT_OBJS) -o eratosthenes$(EXEEXT)

Niels Möller's avatar
Niels Möller committed
69
70
nettle-benchmark$(EXEEXT): nettle-benchmark.$(OBJEXT) nettle-openssl.$(OBJEXT) $(GETOPT_OBJS)
	$(LINK) nettle-benchmark.$(OBJEXT) nettle-openssl.$(OBJEXT) io.$(OBJEXT) $(GETOPT_OBJS) \
71
	-lnettle $(BENCH_LIBS) $(OPENSSL_LIBFLAGS) -o nettle-benchmark$(EXEEXT)
72

73
$(TARGETS) : io.$(OBJEXT) ../libnettle.a
74
75
76
77


check: $(TS_ALL)
	LD_LIBRARY_PATH=../.lib srcdir="$(srcdir)" \
78
79
	  EMULATOR="$(EMULATOR)" EXEEXT="$(EXEEXT)" \
          "$(srcdir)"/run-tests $(TS_ALL)
80
81
82
83

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

84
install uninstall:
85
86
	true

Niels Möller's avatar
Niels Möller committed
87
88
# NOTE: I'd like to use $^, but that's a GNU extension. $? should be
# more portable, equivalent for phony targets.
89
distdir: $(DISTFILES)
90
	cp $? $(distdir)
91
92

clean:
93
	-rm -f $(TARGETS) *.$(OBJEXT)
94
95

distclean: clean
96
	-rm -f Makefile *.d
97

98
tags:
99
	etags -o $(srcdir)/TAGS --include $(top_srcdir) $(srcdir)/*.c $(srcdir)/*.h
100

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