summaryrefslogtreecommitdiff
path: root/examples/Makefile.in
blob: 4746a2007ad93aa944b3f5dfeefd4ce67a77ed70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
@SET_MAKE@

srcdir = @srcdir@
VPATH = @srcdir@

top_srcdir = @top_srcdir@

include ../config.make

PRE_CPPFLAGS = -I.. -I$(top_srcdir)
PRE_LDFLAGS = -L..

OPENSSL_LIBFLAGS = @OPENSSL_LIBFLAGS@
BENCH_LIBS = @BENCH_LIBS@

RSA_TARGETS = rsa-keygen$(EXEEXT) rsa-sign$(EXEEXT) \
	      rsa-verify$(EXEEXT) rsa-encrypt$(EXEEXT) rsa-decrypt$(EXEEXT)
TARGETS = nettle-benchmark$(EXEEXT) eratosthenes$(EXEEXT) @IF_HOGWEED@ $(RSA_TARGETS) next-prime$(EXEEXT) random-prime$(EXEEXT)
SOURCES = nettle-benchmark.c eratosthenes.c next-prime.c random-prime.c \
	nettle-openssl.c \
	io.c read_rsa_key.c \
	rsa-encrypt.c rsa-decrypt.c rsa-keygen.c rsa-sign.c rsa-verify.c

GETOPT_OBJS = ../getopt.$(OBJEXT) ../getopt1.$(OBJEXT)

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

DISTFILES= $(SOURCES) Makefile.in $(TS_ALL) setup-env teardown-env \
	io.h rsa-session.h

all: $(TARGETS)

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

$(getopt_OBJS) ../nettle-internal.$(OBJEXT):
	( cd .. && $(MAKE) $@ )

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

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)

rsa-keygen$(EXEEXT): rsa-keygen.$(OBJEXT) $(GETOPT_OBJS)
	$(LINK) rsa-keygen.$(OBJEXT) io.$(OBJEXT) $(GETOPT_OBJS) \
	-lhogweed -lnettle $(LIBS) -o rsa-keygen$(EXEEXT)

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)

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)

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)

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)

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

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)

$(TARGETS) : io.$(OBJEXT) ../libnettle.a


check: $(TS_ALL)
	LD_LIBRARY_PATH=../.lib PATH="../.lib:$$PATH" srcdir="$(srcdir)" \
	  EMULATOR="$(EMULATOR)" EXEEXT="$(EXEEXT)" \
          "$(top_srcdir)"/run-tests $(TS_ALL)

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

install uninstall:
	true

# NOTE: I'd like to use $^, but that's a GNU extension. $? should be
# more portable, equivalent for phony targets.
distdir: $(DISTFILES)
	cp $? $(distdir)

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

distclean: clean
	-rm -f Makefile *.d

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

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