1@SET_MAKE@ 2 3srcdir = @srcdir@ 4VPATH = @srcdir@ 5 6top_srcdir = @top_srcdir@ 7 8include ../config.make 9 10PRE_CPPFLAGS = -I.. -I$(top_srcdir) 11PRE_LDFLAGS = -L.. 12 13OPENSSL_LIBFLAGS = @OPENSSL_LIBFLAGS@ 14BENCH_LIBS = @BENCH_LIBS@ -lm 15 16HOGWEED_TARGETS = rsa-keygen$(EXEEXT) rsa-sign$(EXEEXT) \ 17 rsa-verify$(EXEEXT) rsa-encrypt$(EXEEXT) rsa-decrypt$(EXEEXT) \ 18 random-prime$(EXEEXT) \ 19 hogweed-benchmark$(EXEEXT) ecc-benchmark$(EXEEXT) 20 21ENC_TARGETS = base16enc$(EXEEXT) base16dec$(EXEEXT) \ 22 base64enc$(EXEEXT) base64dec$(EXEEXT) 23TARGETS = nettle-benchmark$(EXEEXT) \ 24 $(ENC_TARGETS) @IF_HOGWEED@ $(HOGWEED_TARGETS) 25 26SOURCES = nettle-benchmark.c hogweed-benchmark.c ecc-benchmark.c \ 27 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 timing.c 32 33 34GETOPT_OBJS = ../getopt.$(OBJEXT) ../getopt1.$(OBJEXT) 35 36TS_ALL = rsa-sign-test rsa-verify-test rsa-encrypt-test 37 38DISTFILES= $(SOURCES) Makefile.in $(TS_ALL) setup-env teardown-env \ 39 io.h rsa-session.h timing.h 40 41all: $(TARGETS) 42 43%.$(OBJEXT): %.c 44 $(COMPILE) -c $< && $(DEP_PROCESS) 45 46# NOTE: If we required GNU make, we could use a single rule with $(@F) 47# or $(notdir $@) 48../getopt.$(OBJEXT): 49 ( cd .. && $(MAKE) getopt.$(OBJEXT)) 50../getopt1.$(OBJEXT): 51 ( cd .. && $(MAKE) getopt1.$(OBJEXT)) 52../nettle-internal.$(OBJEXT): 53 ( cd .. && $(MAKE) nettle-internal.$(OBJEXT)) 54 55# For Solaris and BSD make, we have to use an explicit rule for each executable 56random-prime$(EXEEXT): random-prime.$(OBJEXT) io.$(OBJEXT) $(GETOPT_OBJS) 57 $(LINK) random-prime.$(OBJEXT) io.$(OBJEXT) $(GETOPT_OBJS) \ 58 -lhogweed -lnettle $(LIBS) -o random-prime$(EXEEXT) 59 60rsa-keygen$(EXEEXT): rsa-keygen.$(OBJEXT) io.$(OBJEXT) $(GETOPT_OBJS) 61 $(LINK) rsa-keygen.$(OBJEXT) io.$(OBJEXT) $(GETOPT_OBJS) \ 62 -lhogweed -lnettle $(LIBS) -o rsa-keygen$(EXEEXT) 63 64rsa-sign$(EXEEXT): rsa-sign.$(OBJEXT) io.$(OBJEXT) read_rsa_key.$(OBJEXT) 65 $(LINK) rsa-sign.$(OBJEXT) io.$(OBJEXT) read_rsa_key.$(OBJEXT) \ 66 -lhogweed -lnettle $(LIBS) -o rsa-sign$(EXEEXT) 67 68rsa-verify$(EXEEXT): rsa-verify.$(OBJEXT) io.$(OBJEXT) read_rsa_key.$(OBJEXT) 69 $(LINK) rsa-verify.$(OBJEXT) io.$(OBJEXT) read_rsa_key.$(OBJEXT) \ 70 -lhogweed -lnettle $(LIBS) -o rsa-verify$(EXEEXT) 71 72rsa-encrypt$(EXEEXT): rsa-encrypt.$(OBJEXT) io.$(OBJEXT) read_rsa_key.$(OBJEXT) $(GETOPT_OBJS) 73 $(LINK) rsa-encrypt.$(OBJEXT) io.$(OBJEXT) read_rsa_key.$(OBJEXT) \ 74 $(GETOPT_OBJS) \ 75 -lhogweed -lnettle $(LIBS) -o rsa-encrypt$(EXEEXT) 76 77rsa-decrypt$(EXEEXT): rsa-decrypt.$(OBJEXT) io.$(OBJEXT) read_rsa_key.$(OBJEXT) 78 $(LINK) rsa-decrypt.$(OBJEXT) io.$(OBJEXT) read_rsa_key.$(OBJEXT) \ 79 -lhogweed -lnettle $(LIBS) -o rsa-decrypt$(EXEEXT) 80 81base16enc$(EXEEXT): base16enc.$(OBJEXT) io.$(OBJEXT) 82 $(LINK) base16enc.$(OBJEXT) io.$(OBJEXT) \ 83 -lnettle $(LIBS) -o base16enc$(EXEEXT) 84 85base16dec$(EXEEXT): base16dec.$(OBJEXT) io.$(OBJEXT) 86 $(LINK) base16dec.$(OBJEXT) io.$(OBJEXT) \ 87 -lnettle $(LIBS) -o base16dec$(EXEEXT) 88 89base64enc$(EXEEXT): base64enc.$(OBJEXT) io.$(OBJEXT) 90 $(LINK) base64enc.$(OBJEXT) io.$(OBJEXT) \ 91 -lnettle $(LIBS) -o base64enc$(EXEEXT) 92 93base64dec$(EXEEXT): base64dec.$(OBJEXT) io.$(OBJEXT) 94 $(LINK) base64dec.$(OBJEXT) io.$(OBJEXT) \ 95 -lnettle $(LIBS) -o base64dec$(EXEEXT) 96 97BENCH_OBJS = nettle-benchmark.$(OBJEXT) nettle-openssl.$(OBJEXT) \ 98 $(GETOPT_OBJS) ../nettle-internal.$(OBJEXT) timing.$(OBJEXT) 99nettle-benchmark$(EXEEXT): $(BENCH_OBJS) 100 $(LINK) $(BENCH_OBJS) -lnettle $(BENCH_LIBS) $(OPENSSL_LIBFLAGS) -o nettle-benchmark$(EXEEXT) 101 102ECC_BENCH_OBJS = ecc-benchmark.$(OBJEXT) timing.$(OBJEXT) 103ecc-benchmark$(EXEEXT): $(ECC_BENCH_OBJS) 104 $(LINK) $(ECC_BENCH_OBJS) -lhogweed -lnettle $(BENCH_LIBS) $(LIBS) \ 105 -o ecc-benchmark$(EXEEXT) 106 107HOGWEED_BENCH_OBJS = hogweed-benchmark.$(OBJEXT) timing.$(OBJEXT) 108hogweed-benchmark$(EXEEXT): $(HOGWEED_BENCH_OBJS) 109 $(LINK) $(HOGWEED_BENCH_OBJS) \ 110 -lhogweed -lnettle $(BENCH_LIBS) $(LIBS) $(OPENSSL_LIBFLAGS) \ 111 -o hogweed-benchmark$(EXEEXT) 112 113$(TARGETS) : io.$(OBJEXT) ../libnettle.stamp 114$(HOGWEED_TARGETS): ../libhogweed.stamp 115 116check: $(TS_ALL) 117 TEST_SHLIB_DIR="$(TEST_SHLIB_DIR)" \ 118 srcdir="$(srcdir)" EMULATOR="$(EMULATOR)" EXEEXT="$(EXEEXT)" \ 119 "$(top_srcdir)"/run-tests $(TS_ALL) 120 121Makefile: $(srcdir)/Makefile.in ../config.status 122 cd .. && $(SHELL) ./config.status examples/$@ 123 124install uninstall: 125 true 126 127# NOTE: I'd like to use $^, but that's a GNU extension. $? should be 128# more portable, equivalent for phony targets. 129distdir: $(DISTFILES) 130 cp $? $(distdir) 131 132clean: 133 -rm -f $(TARGETS) *.$(OBJEXT) *.$(OBJEXT).d 134 135distclean: clean 136 -rm -f Makefile *.d 137 138tags: 139 etags -o $(srcdir)/TAGS --include $(top_srcdir) $(srcdir)/*.c $(srcdir)/*.h 140 141-include $(SOURCES:.c=.$(OBJEXT).d) 142