Makefile.am 4.82 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
Niels Möller's avatar
Niels Möller committed
8
libnettleinclude_HEADERS = aes.h arcfour.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
			   md5.h md5-compat.h \
Niels Möller's avatar
Niels Möller committed
16
			   nettle-meta.h \
17
			   pgp.h realloc.h rsa.h \
Niels Möller's avatar
Niels Möller committed
18
			   sexp.h \
19 20
			   serpent.h sha.h twofish.h \
			   yarrow.h
Niels Möller's avatar
Niels Möller committed
21

22 23
libnettle_a_SOURCES = aes.c aes.h aes-internal.h \
		      aes-decrypt-table.c aes-decrypt.c \
24
		      aes-encrypt-table.c aes-encrypt.c \
25
		      aes-set-encrypt-key.c aes-set-decrypt-key.c aes-meta.c \
26
		      arcfour.c arcfour.h arcfour-meta.c \
27
		      base16-encode.c base16-decode.c base16-meta.c \
28
                      base64-encode.c base64-decode.c base64-meta.c base64.h \
Niels Möller's avatar
Niels Möller committed
29
		      cast128.c cast128.h cast128_sboxes.h cast128-meta.c \
Niels Möller's avatar
Niels Möller committed
30
		      blowfish.h blowfish.c \
31
		      cbc.c cbc.h \
32 33
		      des.c des.h desinfo.h desCode.h \
		      des3.c des-compat.c des-compat.h \
34
		      hmac.c hmac.h hmac-md5.c hmac-sha1.c hmac-sha256.c \
35
		      knuth-lfib.c knuth-lfib.h \
Niels Möller's avatar
Niels Möller committed
36 37 38 39
		      md5.c md5.h md5-compat.c md5-compat.h md5-meta.c \
		      sha.h sha1.c sha1-meta.c sha256.c sha256-meta.c \
		      serpent.c serpent.h serpent_sboxes.h serpent-meta.c \
		      twofish.c twofish.h twofish-meta.c \
40
		      yarrow.h yarrow256.c yarrow_key_event.c \
41 42 43
		      sexp.h sexp.c sexp-format.c \
		      sexp-transport.c sexp-transport-format.c \
		      bignum.h bignum.c bignum-random.c sexp2bignum.c \
44 45 46 47
		      pkcs1.h pkcs1.c pkcs1-rsa-md5.c pkcs1-rsa-sha1.c \
		      rsa.h rsa.c rsa-sign.c rsa-verify.c \
		      rsa-md5-sign.c rsa-md5-verify.c \
		      rsa-sha1-sign.c rsa-sha1-verify.c \
48
		      rsa-encrypt.c rsa-decrypt.c \
49
		      rsa-keygen.c rsa-compat.h rsa-compat.c \
50
		      rsa2sexp.c sexp2rsa.c \
51
		      dsa.c dsa-sign.c dsa-verify.c dsa-keygen.c \
52
		      sexp2dsa.c \
Niels Möller's avatar
Niels Möller committed
53
		      pgp.h pgp-encode.c rsa2openpgp.c \
54
		      buffer.h buffer.c buffer-init.c realloc.c \
55
		      nettle-meta.h \
56
		      nettle-internal.c nettle-internal.h
Niels Möller's avatar
Niels Möller committed
57

58 59
LIBOBJS = @LIBOBJS@
libnettle_a_LIBADD = $(LIBOBJS)
Niels Möller's avatar
Niels Möller committed
60

61 62
shadata_LDADD = -lm

63 64
info_TEXINFOS = nettle.texinfo

65 66 67 68
all-local: nettle.html print-path
.PHONY: print-path
print-path:
	echo PATH: $$PATH
69

70
EXTRA_DIST = memxor.h $(des_headers) descore.README nettle.html \
71
	sha-example.c .bootstrap $(des_headers) \
72 73
	sparc/aes.asm sparc/machine.m4 \
	x86/aes.asm x86/aes_tables.asm
74

75 76 77 78
DISTCLEANFILES = aes.asm aes.s \
	aes-decrypt.asm aes-decrypt.s aes-encrypt.asm aes-encrypt.s \
	machine.m4

79 80 81
CLEANFILES = $(SHLIBFORLINK)
clean-local:
	rm -rf .lib
82

83 84 85 86 87 88
# Using assembler files. Should get precedence before the .c.o rule.
SUFFIXES = .asm

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

89
# FIXME: How to write this without using GNU make features?
90 91 92 93 94 95

# 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)/'`$< >$@
96

97 98
# NOTE: We create an empty .deps-file, to make the make/automake
# dependency tracking happier.
99 100 101 102
%.$(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 $@
103 104 105 106 107 108
	echo >.deps/$*.Po

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

Niels Möller's avatar
Niels Möller committed
109
# Assembler files must contain only PIC-clean code.
110 111 112 113 114 115
%_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

Niels Möller's avatar
Niels Möller committed
116
# FIXME: This rule doesn't get dependencies right.
117 118 119
%_p.$(OBJEXT): %.c
	$(COMPILE) $(SHLIBCFLAGS) -c $< -o $@

120
SHLIBOBJECTS = $(patsubst %.$(OBJEXT),%_p.$(OBJEXT),$(am_libnettle_a_OBJECTS) $(LIBOBJS))
121

122 123
# The point of the linking is to use -Lnettle-dir at linktime,
# and LD_LIBRARY_PATH=nettle-dir/.lib at run time.
124 125
$(SHLIBFORLINK): $(SHLIBOBJECTS)
	$(SHLIBLINK) $^ -o $@
126 127
	-mkdir .lib 2>/dev/null
	(cd .lib && ln -sf ../$(SHLIBFORLINK) $(SHLIBSONAME))
128 129 130 131 132 133 134

install-shared: $(SHLIBFORLINK)
	$(INSTALL_DATA) $(SHLIBFORLINK) $(DESTDIR)$(libdir)/$(SHLIBFILE)
	(cd $(DESTDIR)$(libdir) \
		&& ln -sf $(SHLIBFILE) $(SHLIBSONAME) \
		&& ln -sf $(SHLIBFILE) $(SHLIBFORLINK) )

135 136 137 138 139
%.html : %.texinfo
	(cd $(srcdir) \
	 && $(MAKEINFO) --html --no-split --output $@T $(<F) \
	 ; test -s $@T && mv -f $@T $@)

140
# desCore rules
141 142 143
# 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 
144 145

# Generate DES headers.
146
$(des_headers): desdata.c
147 148
	$(MAKE) desdata$(EXEEXT)
	./desdata$(EXEEXT) $(@F) > $@T
149 150 151
	test -s $@T && mv -f $@T $@

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