Makefile.in 4.39 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
RSA_TARGETS = rsa-keygen$(EXEEXT) rsa-sign$(EXEEXT) \
	      rsa-verify$(EXEEXT) rsa-encrypt$(EXEEXT) rsa-decrypt$(EXEEXT)
18

19
20
ENC_TARGETS = base16enc$(EXEEXT) base16dec$(EXEEXT) \
	      base64enc$(EXEEXT) base64dec$(EXEEXT)
21
TARGETS = nettle-benchmark$(EXEEXT) eratosthenes$(EXEEXT) \
22
	  $(ENC_TARGETS) @IF_HOGWEED@ $(RSA_TARGETS) next-prime$(EXEEXT) random-prime$(EXEEXT)
23
24
SOURCES = nettle-benchmark.c eratosthenes.c next-prime.c random-prime.c \
	nettle-openssl.c \
25
	io.c read_rsa_key.c \
26
	rsa-encrypt.c rsa-decrypt.c rsa-keygen.c rsa-sign.c rsa-verify.c \
27
	base16enc.c base16dec.c base64enc.c base64dec.c
28

29

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

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

34
35
DISTFILES= $(SOURCES) Makefile.in $(TS_ALL) setup-env teardown-env \
	io.h rsa-session.h
36
37
38
39

all: $(TARGETS)

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

42
43
44
45
46
47
48
49
# 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))
50

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

56
random-prime$(EXEEXT): random-prime.$(OBJEXT) io.$(OBJEXT) $(GETOPT_OBJS) ../libhogweed.a
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
98
99
eratosthenes$(EXEEXT): eratosthenes.$(OBJEXT) $(GETOPT_OBJS)
	$(LINK) eratosthenes.$(OBJEXT) $(GETOPT_OBJS) -o eratosthenes$(EXEEXT)

100
101
102
103
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)
104

105
$(TARGETS) : io.$(OBJEXT) ../libnettle.a
106
107
108


check: $(TS_ALL)
109
	LD_LIBRARY_PATH=../.lib PATH="../.lib:$$PATH" srcdir="$(srcdir)" \
110
	  EMULATOR="$(EMULATOR)" EXEEXT="$(EXEEXT)" \
111
          "$(top_srcdir)"/run-tests $(TS_ALL)
112
113
114
115

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

116
install uninstall:
117
118
	true

Niels Möller's avatar
Niels Möller committed
119
120
# NOTE: I'd like to use $^, but that's a GNU extension. $? should be
# more portable, equivalent for phony targets.
121
distdir: $(DISTFILES)
122
	cp $? $(distdir)
123
124

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

distclean: clean
128
	-rm -f Makefile *.d
129

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

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