Makefile.in 4.72 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) \
18
	      random-prime$(EXEEXT) \
Niels Möller's avatar
Niels Möller committed
19
	      hogweed-benchmark$(EXEEXT) ecc-benchmark$(EXEEXT)
20

21 22
ENC_TARGETS = base16enc$(EXEEXT) base16dec$(EXEEXT) \
	      base64enc$(EXEEXT) base64dec$(EXEEXT)
23
TARGETS = nettle-benchmark$(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 \
Niels Möller's avatar
Niels Möller committed
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

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
DISTFILES= $(SOURCES) Makefile.in $(TS_ALL) setup-env teardown-env \
39
	io.h rsa-session.h timing.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
random-prime$(EXEEXT): random-prime.$(OBJEXT) io.$(OBJEXT) $(GETOPT_OBJS)
57 58 59
	$(LINK) random-prime.$(OBJEXT) io.$(OBJEXT) $(GETOPT_OBJS) \
	-lhogweed -lnettle $(LIBS) -o random-prime$(EXEEXT)

60
rsa-keygen$(EXEEXT): rsa-keygen.$(OBJEXT) io.$(OBJEXT) $(GETOPT_OBJS)
Niels Möller's avatar
Niels Möller committed
61
	$(LINK) rsa-keygen.$(OBJEXT) io.$(OBJEXT) $(GETOPT_OBJS) \
62
	-lhogweed -lnettle $(LIBS) -o rsa-keygen$(EXEEXT)
63

64
rsa-sign$(EXEEXT): rsa-sign.$(OBJEXT) io.$(OBJEXT) read_rsa_key.$(OBJEXT)
65 66
	$(LINK) rsa-sign.$(OBJEXT) io.$(OBJEXT) read_rsa_key.$(OBJEXT) \
	-lhogweed -lnettle $(LIBS) -o rsa-sign$(EXEEXT)
67

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

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

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

81 82 83 84 85 86 87 88
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)

89 90 91 92
base64enc$(EXEEXT): base64enc.$(OBJEXT) io.$(OBJEXT)
	$(LINK) base64enc.$(OBJEXT) io.$(OBJEXT) \
	-lnettle $(LIBS) -o base64enc$(EXEEXT)

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

97
BENCH_OBJS = nettle-benchmark.$(OBJEXT) nettle-openssl.$(OBJEXT) \
98
	$(GETOPT_OBJS) ../nettle-internal.$(OBJEXT) timing.$(OBJEXT)
99 100
nettle-benchmark$(EXEEXT): $(BENCH_OBJS)
	$(LINK) $(BENCH_OBJS) -lnettle $(BENCH_LIBS) $(OPENSSL_LIBFLAGS) -o nettle-benchmark$(EXEEXT)
101

102 103 104
ECC_BENCH_OBJS = ecc-benchmark.$(OBJEXT) timing.$(OBJEXT)
ecc-benchmark$(EXEEXT): $(ECC_BENCH_OBJS)
	$(LINK) $(ECC_BENCH_OBJS) -lhogweed -lnettle $(BENCH_LIBS) $(LIBS) \
105 106
	-o ecc-benchmark$(EXEEXT)

107 108 109
HOGWEED_BENCH_OBJS = hogweed-benchmark.$(OBJEXT) timing.$(OBJEXT)
hogweed-benchmark$(EXEEXT): $(HOGWEED_BENCH_OBJS)
	$(LINK) $(HOGWEED_BENCH_OBJS) \
Niels Möller's avatar
Niels Möller committed
110 111 112
	-lhogweed -lnettle $(BENCH_LIBS) $(LIBS) $(OPENSSL_LIBFLAGS) \
	-o hogweed-benchmark$(EXEEXT)

113 114
$(TARGETS) : io.$(OBJEXT) ../libnettle.stamp
$(HOGWEED_TARGETS): ../libhogweed.stamp
115

116
# The PATH update is for windows dlls, DYLD_LIBRARY_PATH is for OSX.
117
check: $(TS_ALL)
118 119
	LD_LIBRARY_PATH=../.lib PATH="../.lib:$$PATH" DYLD_LIBRARY_PATH=../.lib \
	  srcdir="$(srcdir)" EMULATOR="$(EMULATOR)" EXEEXT="$(EXEEXT)" \
120
          "$(top_srcdir)"/run-tests $(TS_ALL)
121 122 123 124

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

125
install uninstall:
126 127
	true

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

clean:
134
	-rm -f $(TARGETS) *.$(OBJEXT)
135 136

distclean: clean
137
	-rm -f Makefile *.d
138

139
tags:
140
	etags -o $(srcdir)/TAGS --include $(top_srcdir) $(srcdir)/*.c $(srcdir)/*.h
141

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