summaryrefslogtreecommitdiff
path: root/Makefile.proto
blob: e932ed4286e4a1f0464834cfabfb3eb1e93d8ea1 (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
##############################################################################
# USER CONFIGURATION
# You MUST set all of the following variables for the compilation to succeed.
##############################################################################

##
# paths to crypto library headers and archives. if they are not in the
# standard system locations (this really depends on the OS you are using),
# then UNCOMMENT the CRYPTO_INCLUDE_PATH and CRYPTO_LIBRARY_PATH and add the
# appropriate paths immediately after -I, resp. -L.
#
# OpenSSL
# -------
# The include path is the directory containing the openssl include
# directory (e.g. if OpenSSL is installed in /usr/local/ssl, its include
# files are in /usr/local/ssl/include/openssl and you must set the
# CRYPTO_INCLUDE_PATH to -I/usr/local/ssl/include).
#
# The library path for OpenSSL is the one containing libcrypto.so or
# libcrypto.a (e.g. set CRYPTO_LIBRARY_PATH to -L/usr/local/ssl/lib)
#
# cryptlib
# --------
# The include directory is the one containing the cryptlib.h file.
# The library path is the one containing libcl.so or libcl.a.
##
#CRYPTO_INCLUDE_PATH = -I/replace/this/with/real/path
#CRYPTO_LIBRARY_PATH = -L/replace/this/with/real/path

##
# If using OpenSSL, uncomment the following 3 lines.
##
#CRYPTO_CFLAGS =
#CRYPTO_OBJS   = secure_random_openssl.o
#CRYPTO_LIBS   = -lcrypto

##
# If using cryptlib, uncomment the following 3 lines.
##
#CRYPTO_CFLAGS = -D_REENTRANT
#CRYPTO_OBJS   = secure_random_cryptlib.o
#CRYPTO_LIBS   = -lcl -lpthread

##
# Change PREFIX to install to different directories. The binary is installed
# in $PREFIX/bin, and the man in $PREFIX/man/man1
##
PREFIX = /usr/local

##
# On some operating systems (most notably Linux 2.6 kernels) using mlockall
# causes the program to fail with segmentation fault because it tries to
# allocate memory beyond its current resource limits for locked memory. If
# you experience crashes immediately at startup, uncomment the following line.
##
#
#NO_MLOCKALL = -DDISABLE_MLOCKALL

##
# Sometimes you have only dynamic libraries available. In that case COMMENT
# the following line.
##
LINK_STATIC = -static

##############################################################################
# NO USER MODIFIABLE PARTS AFTER THIS POINT
##############################################################################
CFLAGS	= -Wall $(CRYPTO_INCLUDE_PATH) $(CRYPTO_CFLAGS) $(NO_MLOCKALL)
LDFLAGS	= $(CRYPTO_LIBRARY_PATH) $(LINK_STATIC) $(CRYPTO_LIBS) -lm

.PHONY : all install-strip install clean 

OBJS = diceware8k.o main.o pwgen.o secure_memory_unix.o \
	$(CRYPTO_OBJS) skeylist.o

all: secpwgen

secpwgen: $(OBJS)
	$(CC) -o $@ $(OBJS) $(LDFLAGS)

install-strip: secpwgen
	strip secpwgen
	$(MAKE) install

install: secpwgen
	cp -i secpwgen $(PREFIX)/bin
	cp -i secpwgen.1 $(PREFIX)/man/man1

clean:
	rm -f *.o secpwgen

diceware8k.o: diceware8k.c
main.o: main.c secure_memory.h secure_random.h pwgen.h exceptions.h \
  cexcept.h
pwgen.o: pwgen.c secure_random.h pwgen.h exceptions.h cexcept.h
secure_memory_unix.o: secure_memory_unix.c secure_random.h \
  secure_memory.h exceptions.h cexcept.h
secure_random_cryptlib.o: secure_random_cryptlib.c exceptions.h cexcept.h
secure_random_openssl.o: secure_random_openssl.c exceptions.h cexcept.h
skeylist.o: skeylist.c