1
1
#
2
- # $PostgreSQL: pgsql/contrib/pgcrypto/Makefile,v 1.14 2005/03/21 05:24:51 neilc Exp $
2
+ # $PostgreSQL: pgsql/contrib/pgcrypto/Makefile,v 1.15 2005/07/05 23:13:57 tgl Exp $
3
3
#
4
4
5
- # either 'builtin', 'openssl'
6
- cryptolib = builtin
5
+ # if you don't have OpenSSL, you can use libc random() or /dev/urandom
6
+ INT_CFLAGS = -DRAND_SILLY
7
+ # INT_CFLAGS = -DRAND_DEV=\"/dev/urandom\"
7
8
8
- # either 'builtin', 'system'
9
- cryptsrc = builtin
9
+ INT_SRCS = md5.c sha1.c internal.c blf.c rijndael.c
10
10
11
- # Random source, preferred order:
12
- # 'dev' - read from random device
13
- #
14
- # 'openssl' - use openssl PRNG.
15
- # Note that currently pgcrypto does not do any
16
- # entropy feeding to it
17
- # This works ofcouse only with cryptolib = openssl
18
- #
19
- # 'silly' - use libc random() - very weak
20
- random = silly
21
- random_dev = \"/dev/urandom\"
11
+ OSSL_CFLAGS = -DRAND_OPENSSL
12
+ OSSL_SRCS = openssl.c
13
+ OSSL_TESTS = des 3des cast5
22
14
23
- # #########################
24
-
25
- ifeq ($(cryptolib ) , builtin)
26
- CRYPTO_CFLAGS =
27
- CRYPTO_LDFLAGS =
28
- SRCS = md5.c sha1.c internal.c blf.c rijndael.c
29
- EXTRA_TESTS =
30
- endif
15
+ CF_SRCS = $(if $(subst no,,$(with_openssl ) ) , $(OSSL_SRCS ) , $(INT_SRCS ) )
16
+ CF_TESTS = $(if $(subst no,,$(with_openssl ) ) , $(OSSL_TESTS ) )
17
+ CF_CFLAGS = $(if $(subst no,,$(with_openssl ) ) , $(OSSL_CFLAGS ) , $(INT_CFLAGS ) )
31
18
32
- ifeq ($(cryptolib ) , openssl)
33
- CRYPTO_CFLAGS = -I/usr/include/openssl
34
- CRYPTO_LDFLAGS = -lcrypto
35
- SRCS = openssl.c
36
- EXTRA_TESTS = des 3des cast5
37
- endif
19
+ PG_CPPFLAGS := $(CF_CFLAGS ) -I$(srcdir ) $(PG_CPPFLAGS )
38
20
39
- ifeq ($(cryptsrc ) , builtin)
40
- SRCS += crypt-blowfish.c crypt-des.c crypt-md5.c
41
- else
42
- CRYPTO_CFLAGS += -DPX_SYSTEM_CRYPT
43
- endif
44
-
45
- ifeq ($(random ) , dev)
46
- CRYPTO_CFLAGS += -DRAND_DEV=$(random_dev )
47
- endif
48
- ifeq ($(random ) , openssl)
49
- CRYPTO_CFLAGS += -DRAND_OPENSSL
50
- endif
51
- ifeq ($(random ) , silly)
52
- CRYPTO_CFLAGS += -DRAND_SILLY
53
- endif
54
-
55
- SRCS += pgcrypto.c px.c px-hmac.c px-crypt.c misc.c \
56
- crypt-gensalt.c random.c
21
+ SRCS = pgcrypto.c px.c px-hmac.c px-crypt.c misc.c random.c \
22
+ crypt-gensalt.c crypt-blowfish.c crypt-des.c \
23
+ crypt-md5.c $(CF_SRCS )
57
24
58
25
MODULE_big = pgcrypto
59
26
OBJS = $(SRCS:.c=.o )
60
27
DOCS = README.pgcrypto
61
28
DATA_built = pgcrypto.sql
62
29
EXTRA_CLEAN = gen-rtab
63
30
64
- PG_CPPFLAGS = $(CRYPTO_CFLAGS ) -I$(srcdir )
65
- SHLIB_LINK = $(CRYPTO_LDFLAGS )
66
-
67
31
REGRESS = init md5 sha1 hmac-md5 hmac-sha1 blowfish rijndael \
68
- $( EXTRA_TESTS ) \
69
- crypt-des crypt-md5 crypt-blowfish crypt-xdes
32
+ $( CF_TESTS ) \
33
+ crypt-des crypt-md5 crypt-blowfish crypt-xdes
70
34
71
35
72
36
ifdef USE_PGXS
@@ -79,6 +43,14 @@ include $(top_builddir)/src/Makefile.global
79
43
include $(top_srcdir ) /contrib/contrib-global.mk
80
44
endif
81
45
46
+ # Add libraries that pgcrypto depends (or might depend) on into the
47
+ # shared library link. (The order in which you list them here doesn't
48
+ # matter.)
49
+ SHLIB_LINK += $(filter -lcrypt -ldes -lcrypto -lssl, $(LIBS ) )
50
+ ifeq ($(PORTNAME ) , win32)
51
+ SHLIB_LINK += $(filter -leay32 -lssleay32, $(LIBS ) )
52
+ endif
53
+
82
54
# to make ws2_32.lib the last library (must occur after definition of PORTNAME)
83
55
ifeq ($(PORTNAME ) ,win32)
84
56
SHLIB_LINK += -lwsock32 -lws2_32
87
59
88
60
rijndael.o : rijndael.tbl
89
61
90
- rijndael.tbl :
62
+ rijndael.tbl : rijndael.c
91
63
$(CC ) $(CPPFLAGS ) $(CFLAGS ) -DPRINT_TABS rijndael.c -o gen-rtab
92
64
./gen-rtab > rijndael.tbl
0 commit comments