Makefile.in 4.84 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
BENCH_LIBS = @BENCH_LIBS@ -lm
15

16
17
HOGWEED_TARGETS = rsa-keygen$(EXEEXT) rsa-sign$(EXEEXT) \
	      rsa-verify$(EXEEXT) rsa-encrypt$(EXEEXT) rsa-decrypt$(EXEEXT) \
Niels Möller's avatar
Niels Möller committed
18
19
	      next-prime$(EXEEXT) random-prime$(EXEEXT) \
	      hogweed-benchmark$(EXEEXT) ecc-benchmark$(EXEEXT)
20

21
22
ENC_TARGETS = base16enc$(EXEEXT) base16dec$(EXEEXT) \
	      base64enc$(EXEEXT) base64dec$(EXEEXT)
23
TARGETS = nettle-benchmark$(EXEEXT) eratosthenes$(EXEEXT) \
24
25
	  $(ENC_TARGETS) @IF_HOGWEED@ $(HOGWEED_TARGETS)

Niels Möller's avatar
Niels Möller committed
26
SOURCES = nettle-benchmark.c hogweed-benchmark.c ecc-benchmark.c \
27
	eratosthenes.c next-prime.c random-prime.c \
28
	nettle-openssl.c \
29
	io.c read_rsa_key.c \
30
	rsa-encrypt.c rsa-decrypt.c rsa-keygen.c rsa-sign.c rsa-verify.c \
31
	base16enc.c base16dec.c base64enc.c base64dec.c
32

33

34
GETOPT_OBJS = ../getopt.$(OBJEXT) ../getopt1.$(OBJEXT)
Niels Möller's avatar
Niels Möller committed
35

36
37
TS_ALL = rsa-sign-test rsa-verify-test rsa-encrypt-test

38
39
DISTFILES= $(SOURCES) Makefile.in $(TS_ALL) setup-env teardown-env \
	io.h rsa-session.h
40
41
42
43

all: $(TARGETS)

.c.$(OBJEXT):
44
	$(COMPILE) -c $< && $(DEP_PROCESS)
45

46
47
48
49
50
51
52
53
# NOTE: If we required GNU make, we could use a single rule with $(@F)
# or $(notdir $@)
../getopt.$(OBJEXT):
	( cd .. && $(MAKE) getopt.$(OBJEXT))
../getopt1.$(OBJEXT):
	( cd .. && $(MAKE) getopt1.$(OBJEXT))
../nettle-internal.$(OBJEXT):
	( cd .. && $(MAKE) nettle-internal.$(OBJEXT))
54

55
# For Solaris and BSD make, we have to use an explicit rule for each executable
56
next-prime$(EXEEXT): next-prime.$(OBJEXT) $(GETOPT_OBJS)
57
	$(LINK) next-prime.$(OBJEXT) $(GETOPT_OBJS) \
58
	-lhogweed -lnettle $(LIBS) -o next-prime$(EXEEXT)
59

60
random-prime$(EXEEXT): random-prime.$(OBJEXT) io.$(OBJEXT) $(GETOPT_OBJS)
61
62
63
	$(LINK) random-prime.$(OBJEXT) io.$(OBJEXT) $(GETOPT_OBJS) \
	-lhogweed -lnettle $(LIBS) -o random-prime$(EXEEXT)

64
rsa-keygen$(EXEEXT): rsa-keygen.$(OBJEXT) io.$(OBJEXT) $(GETOPT_OBJS)
Niels Möller's avatar
Niels Möller committed
65
	$(LINK) rsa-keygen.$(OBJEXT) io.$(OBJEXT) $(GETOPT_OBJS) \
66
	-lhogweed -lnettle $(LIBS) -o rsa-keygen$(EXEEXT)
67

68
rsa-sign$(EXEEXT): rsa-sign.$(OBJEXT) io.$(OBJEXT) read_rsa_key.$(OBJEXT)
69
70
	$(LINK) rsa-sign.$(OBJEXT) io.$(OBJEXT) read_rsa_key.$(OBJEXT) \
	-lhogweed -lnettle $(LIBS) -o rsa-sign$(EXEEXT)
71

72
rsa-verify$(EXEEXT): rsa-verify.$(OBJEXT) io.$(OBJEXT) read_rsa_key.$(OBJEXT)
73
74
	$(LINK) rsa-verify.$(OBJEXT) io.$(OBJEXT) read_rsa_key.$(OBJEXT) \
	-lhogweed -lnettle $(LIBS) -o rsa-verify$(EXEEXT)
75

76
rsa-encrypt$(EXEEXT): rsa-encrypt.$(OBJEXT) io.$(OBJEXT) read_rsa_key.$(OBJEXT) $(GETOPT_OBJS)
77
78
79
	$(LINK) rsa-encrypt.$(OBJEXT) io.$(OBJEXT) read_rsa_key.$(OBJEXT) \
	$(GETOPT_OBJS) \
	-lhogweed -lnettle $(LIBS) -o rsa-encrypt$(EXEEXT)
80

81
rsa-decrypt$(EXEEXT): rsa-decrypt.$(OBJEXT) io.$(OBJEXT) read_rsa_key.$(OBJEXT)
82
83
	$(LINK) rsa-decrypt.$(OBJEXT) io.$(OBJEXT) read_rsa_key.$(OBJEXT) \
	-lhogweed -lnettle $(LIBS) -o rsa-decrypt$(EXEEXT)
84

85
86
87
88
89
90
91
92
base16enc$(EXEEXT): base16enc.$(OBJEXT) io.$(OBJEXT)
	$(LINK) base16enc.$(OBJEXT) io.$(OBJEXT) \
	-lnettle $(LIBS) -o base16enc$(EXEEXT)

base16dec$(EXEEXT): base16dec.$(OBJEXT) io.$(OBJEXT)
	$(LINK) base16dec.$(OBJEXT) io.$(OBJEXT) \
	-lnettle $(LIBS) -o base16dec$(EXEEXT)

93
94
95
96
base64enc$(EXEEXT): base64enc.$(OBJEXT) io.$(OBJEXT)
	$(LINK) base64enc.$(OBJEXT) io.$(OBJEXT) \
	-lnettle $(LIBS) -o base64enc$(EXEEXT)

97
98
99
100
base64dec$(EXEEXT): base64dec.$(OBJEXT) io.$(OBJEXT)
	$(LINK) base64dec.$(OBJEXT) io.$(OBJEXT) \
	-lnettle $(LIBS) -o base64dec$(EXEEXT)

101
102
103
eratosthenes$(EXEEXT): eratosthenes.$(OBJEXT) $(GETOPT_OBJS)
	$(LINK) eratosthenes.$(OBJEXT) $(GETOPT_OBJS) -o eratosthenes$(EXEEXT)

104
105
106
107
BENCH_OBJS = nettle-benchmark.$(OBJEXT) nettle-openssl.$(OBJEXT) \
	$(GETOPT_OBJS) ../nettle-internal.$(OBJEXT)
nettle-benchmark$(EXEEXT): $(BENCH_OBJS)
	$(LINK) $(BENCH_OBJS) -lnettle $(BENCH_LIBS) $(OPENSSL_LIBFLAGS) -o nettle-benchmark$(EXEEXT)
108

109
110
111
112
ecc-benchmark$(EXEEXT): ecc-benchmark.$(OBJEXT)
	$(LINK) ecc-benchmark.$(OBJEXT) -lhogweed -lnettle $(BENCH_LIBS) $(LIBS) \
	-o ecc-benchmark$(EXEEXT)

Niels Möller's avatar
Niels Möller committed
113
114
115
116
117
hogweed-benchmark$(EXEEXT): hogweed-benchmark.$(OBJEXT)
	$(LINK) hogweed-benchmark.$(OBJEXT) \
	-lhogweed -lnettle $(BENCH_LIBS) $(LIBS) $(OPENSSL_LIBFLAGS) \
	-o hogweed-benchmark$(EXEEXT)

118
$(TARGETS) : io.$(OBJEXT) ../libnettle.a
119
$(HOGWEED_TARGETS): ../libhogweed.a
120
121

check: $(TS_ALL)
122
	LD_LIBRARY_PATH=../.lib PATH="../.lib:$$PATH" srcdir="$(srcdir)" \
123
	  EMULATOR="$(EMULATOR)" EXEEXT="$(EXEEXT)" \
124
          "$(top_srcdir)"/run-tests $(TS_ALL)
125
126
127
128

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

129
install uninstall:
130
131
	true

Niels Möller's avatar
Niels Möller committed
132
133
# NOTE: I'd like to use $^, but that's a GNU extension. $? should be
# more portable, equivalent for phony targets.
134
distdir: $(DISTFILES)
135
	cp $? $(distdir)
136
137

clean:
138
	-rm -f $(TARGETS) *.$(OBJEXT)
139
140

distclean: clean
141
	-rm -f Makefile *.d
142

143
tags:
144
	etags -o $(srcdir)/TAGS --include $(top_srcdir) $(srcdir)/*.c $(srcdir)/*.h
145

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