Makefile.am 5.57 KB
Newer Older
1
SUBDIRS = . tools testsuite examples
Niels Möller's avatar
Niels Möller committed
2

Niels Möller's avatar
Niels Möller committed
3
noinst_PROGRAMS = aesdata desdata shadata
4

5 6
libnettleincludedir = $(includedir)/nettle

Niels Möller's avatar
Niels Möller committed
7
lib_LIBRARIES = libnettle.a
8
libnettleinclude_HEADERS = aes.h arcfour.h arctwo.h bignum.h blowfish.h \
9
			   base16.h base64.h buffer.h cast128.h \
10
			   cbc.h \
11
			   des.h des-compat.h dsa.h \
12
			   hmac.h \
13
			   knuth-lfib.h \
14
			   macros.h \
15
			   md2.h md4.h \
16
			   md5.h md5-compat.h \
17
			   memxor.h \
18
			   nettle-meta.h \
19
			   pgp.h pkcs1.h realloc.h rsa.h rsa-compat.h \
Niels Möller's avatar
Niels Möller committed
20
			   sexp.h \
21 22
			   serpent.h sha.h twofish.h \
			   yarrow.h
Niels Möller's avatar
Niels Möller committed
23

24
nodist_libnettleinclude_HEADERS = nettle-types.h
25 26
noinst_HEADERS = aes-internal.h cast128_sboxes.h desinfo.h desCode.h \
		 serpent_sboxes.h nettle-internal.h
27

28
libnettle_a_SOURCES = aes.c \
29
		      aes-decrypt-table.c aes-decrypt.c \
30
		      aes-encrypt-table.c aes-encrypt.c \
31
		      aes-set-encrypt-key.c aes-set-decrypt-key.c aes-meta.c \
32 33
		      arcfour.c arcfour-crypt.c arcfour-meta.c \
		      arctwo.c arctwo-meta.c \
34
		      base16-encode.c base16-decode.c base16-meta.c \
35 36 37 38 39 40 41 42
                      base64-encode.c base64-decode.c base64-meta.c \
		      cast128.c cast128-meta.c \
		      blowfish.c \
		      cbc.c \
		      des.c \
		      des3.c des-compat.c \
		      hmac.c hmac-md5.c hmac-sha1.c hmac-sha256.c \
		      knuth-lfib.c \
43
		      md2.c md2-meta.c md4.c md4-meta.c \
44 45 46 47 48 49
		      md5.c md5-compat.c md5-meta.c \
		      sha1.c sha1-compress.c sha1-meta.c sha256.c sha256-meta.c \
		      serpent.c serpent-meta.c \
		      twofish.c twofish-meta.c \
		      yarrow256.c yarrow_key_event.c \
		      sexp.c sexp-format.c \
50
		      sexp-transport.c sexp-transport-format.c \
51 52 53
		      bignum.c bignum-random.c sexp2bignum.c \
		      pkcs1.c pkcs1-rsa-md5.c pkcs1-rsa-sha1.c \
		      rsa.c rsa-sign.c rsa-verify.c \
54 55
		      rsa-md5-sign.c rsa-md5-verify.c \
		      rsa-sha1-sign.c rsa-sha1-verify.c \
56
		      rsa-encrypt.c rsa-decrypt.c \
57
		      rsa-keygen.c rsa-compat.c \
58
		      rsa2sexp.c sexp2rsa.c \
59
		      dsa.c dsa-sign.c dsa-verify.c dsa-keygen.c \
60
		      sexp2dsa.c \
61 62 63
		      pgp-encode.c rsa2openpgp.c \
		      buffer.c buffer-init.c realloc.c \
		      nettle-internal.c
Niels Möller's avatar
Niels Möller committed
64

65 66
libnettle_a_CFLAGS = $(CCPIC)

67 68
LIBOBJS = @LIBOBJS@
libnettle_a_LIBADD = $(LIBOBJS)
Niels Möller's avatar
Niels Möller committed
69

70 71
shadata_LDADD = -lm

72 73
info_TEXINFOS = nettle.texinfo

74
all-local: nettle.html
75

76
EXTRA_DIST = $(des_headers) descore.README nettle.html \
77
	sha-example.c .bootstrap $(des_headers) \
78
	sparc/aes.asm sparc/machine.m4 \
79
	x86/aes.asm x86/aes-encrypt.asm x86/aes-decrypt.asm \
80
	x86/aes_tables.asm x86/arcfour-crypt.asm x86/sha1-compress.asm
81

82 83
DISTCLEANFILES = aes.asm aes.s \
	aes-decrypt.asm aes-decrypt.s aes-encrypt.asm aes-encrypt.s \
84 85
	arcfour-crypt.asm arcfour-crypt.s sha1-compress.asm sha1-compress.s \
	machine.m4 nettle-types.h
86

87 88 89
CLEANFILES = $(SHLIBFORLINK)
clean-local:
	rm -rf .lib
90

91
# Using assembler files. Should get precedence before the .c.o rule.
92
SUFFIXES = .asm .html
93 94 95 96

# can be overridden during development, eg. "make RM_TMP=: aes.o"
RM_TMP = rm -f

97
# FIXME: How to write this without using GNU make features?
98 99 100
# For now, use automake to disable these rules when they are not needed.

if ENABLE_ASSEMBLER
101 102 103 104 105 106

# NOTE: We have to use an explicit rule .asm -> .o, to override the .c
# -> .o rule. Using rules involving .s doesn't seem to work.
# %.s: %.asm asm.m4 machine.m4 config.m4
# 	$(M4) $(srcdir)/asm.m4 machine.m4 config.m4 \
# 		`test -f $< || echo '$(srcdir)/'`$< >$@
107

Niels Möller's avatar
Niels Möller committed
108 109 110 111 112
# FIXME: For some reason, this rule breaks builds on Tru64 5.1B (on
# alpha), with the system make. It fails with "Don't know how to make
# aes.asm", which is very strange, since the make program on this
# system is not supposed to know about %-style pattern rules, and
# "aes.asm" doesn't not occur explicitly in any target or dependency.
113

114 115
# NOTE: We create an empty .deps-file, to make the make/automake
# dependency tracking happier.
116 117 118 119
%.$(OBJEXT): %.asm asm.m4 machine.m4 config.m4
	$(M4) $(srcdir)/asm.m4 machine.m4 config.m4 \
		`test -f $< || echo '$(srcdir)/'`$< >$*.s
	$(COMPILE) -c $*.s -o $@
120 121
	echo >.deps/$*.Po

Niels Möller's avatar
Niels Möller committed
122
# Assembler files must contain only PIC-clean code.
123 124 125 126 127
%_p.$(OBJEXT): %.asm asm.m4 machine.m4 config.m4
	$(M4) $(srcdir)/asm.m4 machine.m4 config.m4 \
		`test -f $< || echo '$(srcdir)/'`$< >$*.s
	$(COMPILE) -c $*.s -o $@
	echo >.deps/$*.Po
128
endif
129

130
if ENABLE_SHARED
Niels Möller's avatar
Niels Möller committed
131
# FIXME: This rule doesn't get dependencies right.
132 133 134
%_p.$(OBJEXT): %.c
	$(COMPILE) $(SHLIBCFLAGS) -c $< -o $@

135 136
SHLIBOBJECTS = $(patsubst %.c,%_p.$(OBJEXT),$(libnettle_a_SOURCES)) \
               $(patsubst %.$(OBJEXT),%_p.$(OBJEXT),$(LIBOBJS))
137

138
# The point of the sym links is to use -Lnettle-dir at linktime,
139
# and LD_LIBRARY_PATH=nettle-dir/.lib at run time.
140 141
$(SHLIBFORLINK): $(SHLIBOBJECTS)
	$(SHLIBLINK) $^ -o $@
142
	-mkdir .lib 2>/dev/null
143 144
	( [ -z "$(SHLIBSONAME)" ] || cd .lib \
          && ln -sf ../$(SHLIBFORLINK) $(SHLIBSONAME))
145

146 147 148 149 150 151
endif

# Shared library rules
all-local: $(SHLIBTARGET)
install-data-local: $(SHLIBINSTALL)

152 153
install-shared: $(SHLIBFORLINK)
	$(INSTALL_DATA) $(SHLIBFORLINK) $(DESTDIR)$(libdir)/$(SHLIBFILE)
154 155
	( [ -z "$(SHLIBSONAME)" ] \
                || cd $(DESTDIR)$(libdir) \
156 157 158
		&& ln -sf $(SHLIBFILE) $(SHLIBSONAME) \
		&& ln -sf $(SHLIBFILE) $(SHLIBFORLINK) )

159
.texinfo.html:
160 161 162 163
	(cd $(srcdir) \
	 && $(MAKEINFO) --html --no-split --output $@T $(<F) \
	 ; test -s $@T && mv -f $@T $@)

164
# desCore rules
165 166 167
# It seems using $(srcdir)/ doesn't work with GNU make 3.79.1
# des_headers = $(srcdir)/parity.h $(srcdir)/rotors.h $(srcdir)/keymap.h 
des_headers = parity.h rotors.h keymap.h 
168 169

# Generate DES headers.
170
$(des_headers): desdata.c
171 172
	$(MAKE) desdata$(EXEEXT)
	./desdata$(EXEEXT) $(@F) > $@T
173 174 175
	test -s $@T && mv -f $@T $@

des.o: des.c des.h $(des_headers)