6 top_srcdir
= @top_srcdir@
10 PRE_CPPFLAGS
= -I..
-I
$(top_srcdir
)
13 OPENSSL_LIBFLAGS
= @OPENSSL_LIBFLAGS@
14 BENCH_LIBS
= @BENCH_LIBS@
-lm
16 HOGWEED_TARGETS
= rsa-keygen
$(EXEEXT
) rsa-sign
$(EXEEXT
) \
17 rsa-verify
$(EXEEXT
) rsa-encrypt
$(EXEEXT
) rsa-decrypt
$(EXEEXT
) \
18 next-prime
$(EXEEXT
) random-prime
$(EXEEXT
) \
19 hogweed-benchmark
$(EXEEXT
) ecc-benchmark
$(EXEEXT
)
21 ENC_TARGETS
= base16enc
$(EXEEXT
) base16dec
$(EXEEXT
) \
22 base64enc
$(EXEEXT
) base64dec
$(EXEEXT
)
23 TARGETS
= nettle-benchmark
$(EXEEXT
) eratosthenes
$(EXEEXT
) \
24 $(ENC_TARGETS
) @IF_HOGWEED@
$(HOGWEED_TARGETS
)
26 SOURCES
= nettle-benchmark.c hogweed-benchmark.c ecc-benchmark.c \
27 eratosthenes.c next-prime.c random-prime.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 timing.c
34 GETOPT_OBJS
= ..
/getopt.
$(OBJEXT
) ..
/getopt1.
$(OBJEXT
)
36 TS_ALL
= rsa-sign-test rsa-verify-test rsa-encrypt-test
38 DISTFILES
= $(SOURCES
) Makefile.in
$(TS_ALL
) setup-env teardown-env \
39 io.h rsa-session.h timing.h
44 $(COMPILE
) -c
$< && $(DEP_PROCESS
)
46 # NOTE: If we required GNU make, we could use a single rule with $(@F)
49 ( cd ..
&& $(MAKE
) getopt.
$(OBJEXT
))
51 ( cd ..
&& $(MAKE
) getopt1.
$(OBJEXT
))
52 ..
/nettle-internal.
$(OBJEXT
):
53 ( cd ..
&& $(MAKE
) nettle-internal.
$(OBJEXT
))
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
)
60 random-prime
$(EXEEXT
): random-prime.
$(OBJEXT
) io.
$(OBJEXT
) $(GETOPT_OBJS
)
61 $(LINK
) random-prime.
$(OBJEXT
) io.
$(OBJEXT
) $(GETOPT_OBJS
) \
62 -lhogweed
-lnettle
$(LIBS
) -o random-prime
$(EXEEXT
)
64 rsa-keygen
$(EXEEXT
): rsa-keygen.
$(OBJEXT
) io.
$(OBJEXT
) $(GETOPT_OBJS
)
65 $(LINK
) rsa-keygen.
$(OBJEXT
) io.
$(OBJEXT
) $(GETOPT_OBJS
) \
66 -lhogweed
-lnettle
$(LIBS
) -o rsa-keygen
$(EXEEXT
)
68 rsa-sign
$(EXEEXT
): rsa-sign.
$(OBJEXT
) io.
$(OBJEXT
) read_rsa_key.
$(OBJEXT
)
69 $(LINK
) rsa-sign.
$(OBJEXT
) io.
$(OBJEXT
) read_rsa_key.
$(OBJEXT
) \
70 -lhogweed
-lnettle
$(LIBS
) -o rsa-sign
$(EXEEXT
)
72 rsa-verify
$(EXEEXT
): rsa-verify.
$(OBJEXT
) io.
$(OBJEXT
) read_rsa_key.
$(OBJEXT
)
73 $(LINK
) rsa-verify.
$(OBJEXT
) io.
$(OBJEXT
) read_rsa_key.
$(OBJEXT
) \
74 -lhogweed
-lnettle
$(LIBS
) -o rsa-verify
$(EXEEXT
)
76 rsa-encrypt
$(EXEEXT
): rsa-encrypt.
$(OBJEXT
) io.
$(OBJEXT
) read_rsa_key.
$(OBJEXT
) $(GETOPT_OBJS
)
77 $(LINK
) rsa-encrypt.
$(OBJEXT
) io.
$(OBJEXT
) read_rsa_key.
$(OBJEXT
) \
79 -lhogweed
-lnettle
$(LIBS
) -o rsa-encrypt
$(EXEEXT
)
81 rsa-decrypt
$(EXEEXT
): rsa-decrypt.
$(OBJEXT
) io.
$(OBJEXT
) read_rsa_key.
$(OBJEXT
)
82 $(LINK
) rsa-decrypt.
$(OBJEXT
) io.
$(OBJEXT
) read_rsa_key.
$(OBJEXT
) \
83 -lhogweed
-lnettle
$(LIBS
) -o rsa-decrypt
$(EXEEXT
)
85 base16enc
$(EXEEXT
): base16enc.
$(OBJEXT
) io.
$(OBJEXT
)
86 $(LINK
) base16enc.
$(OBJEXT
) io.
$(OBJEXT
) \
87 -lnettle
$(LIBS
) -o base16enc
$(EXEEXT
)
89 base16dec
$(EXEEXT
): base16dec.
$(OBJEXT
) io.
$(OBJEXT
)
90 $(LINK
) base16dec.
$(OBJEXT
) io.
$(OBJEXT
) \
91 -lnettle
$(LIBS
) -o base16dec
$(EXEEXT
)
93 base64enc
$(EXEEXT
): base64enc.
$(OBJEXT
) io.
$(OBJEXT
)
94 $(LINK
) base64enc.
$(OBJEXT
) io.
$(OBJEXT
) \
95 -lnettle
$(LIBS
) -o base64enc
$(EXEEXT
)
97 base64dec
$(EXEEXT
): base64dec.
$(OBJEXT
) io.
$(OBJEXT
)
98 $(LINK
) base64dec.
$(OBJEXT
) io.
$(OBJEXT
) \
99 -lnettle
$(LIBS
) -o base64dec
$(EXEEXT
)
101 eratosthenes
$(EXEEXT
): eratosthenes.
$(OBJEXT
) $(GETOPT_OBJS
)
102 $(LINK
) eratosthenes.
$(OBJEXT
) $(GETOPT_OBJS
) -o eratosthenes
$(EXEEXT
)
104 BENCH_OBJS
= nettle-benchmark.
$(OBJEXT
) nettle-openssl.
$(OBJEXT
) \
105 $(GETOPT_OBJS
) ..
/nettle-internal.
$(OBJEXT
) timing.
$(OBJEXT
)
106 nettle-benchmark
$(EXEEXT
): $(BENCH_OBJS
)
107 $(LINK
) $(BENCH_OBJS
) -lnettle
$(BENCH_LIBS
) $(OPENSSL_LIBFLAGS
) -o nettle-benchmark
$(EXEEXT
)
109 ECC_BENCH_OBJS
= ecc-benchmark.
$(OBJEXT
) timing.
$(OBJEXT
)
110 ecc-benchmark
$(EXEEXT
): $(ECC_BENCH_OBJS
)
111 $(LINK
) $(ECC_BENCH_OBJS
) -lhogweed
-lnettle
$(BENCH_LIBS
) $(LIBS
) \
112 -o ecc-benchmark
$(EXEEXT
)
114 HOGWEED_BENCH_OBJS
= hogweed-benchmark.
$(OBJEXT
) timing.
$(OBJEXT
)
115 hogweed-benchmark
$(EXEEXT
): $(HOGWEED_BENCH_OBJS
)
116 $(LINK
) $(HOGWEED_BENCH_OBJS
) \
117 -lhogweed
-lnettle
$(BENCH_LIBS
) $(LIBS
) $(OPENSSL_LIBFLAGS
) \
118 -o hogweed-benchmark
$(EXEEXT
)
120 $(TARGETS
) : io.
$(OBJEXT
) ..
/libnettle.a
121 $(HOGWEED_TARGETS
): ..
/libhogweed.a
124 LD_LIBRARY_PATH
=..
/.lib PATH
="../.lib:$$PATH" srcdir="$(srcdir)" \
125 EMULATOR
="$(EMULATOR)" EXEEXT
="$(EXEEXT)" \
126 "$(top_srcdir)"/run-tests
$(TS_ALL
)
128 Makefile
: $(srcdir)/Makefile.in ..
/config.status
129 cd ..
&& $(SHELL
) .
/config.status examples
/$@
134 # NOTE: I'd like to use $^, but that's a GNU extension. $? should be
135 # more portable, equivalent for phony targets.
136 distdir
: $(DISTFILES
)
140 -rm -f
$(TARGETS
) *.
$(OBJEXT
)
146 etags
-o
$(srcdir)/TAGS
--include $(top_srcdir
) $(srcdir)/*.c
$(srcdir)/*.h
148 @DEP_INCLUDE@
$(SOURCES
:.c
=.
$(OBJEXT
).d
)