File: GNUmakefile

package info (click to toggle)
node-postgres 8.16.3%2B~cs35.24.27-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,788 kB
  • sloc: javascript: 15,879; python: 79; makefile: 57
file content (71 lines) | stat: -rw-r--r-- 1,385 bytes parent folder | download | duplicates (3)
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
DESTDIR ::= /var/lib/postgres/data
POSTGRES_USER ::= postgres
POSTGRES_GROUP ::= postgres
DATABASE_HOST ::= localhost
DATABASE_USER ::= postgres

all: \
	test-server-ca.crt \
	test-client-ca.crt \
	test-server.key \
	test-server.crt \
	test-client.key \
	test-client.crt

clean:
	rm -f \
		test-server-ca.key \
		test-client-ca.key \
		test-server-ca.crt \
		test-client-ca.crt \
		test-server.key \
		test-server.crt \
		test-client.key \
		test-client.crt

install: test-server.crt test-server.key test-client-ca.crt
	install \
		--owner=$(POSTGRES_USER) \
		--group=$(POSTGRES_GROUP) \
		--mode=0600 \
		-t $(DESTDIR) \
		$^

test-%-ca.crt: test-%-ca.key
	openssl req -new -x509 \
		-subj '/CN=node-postgres test $* CA' \
		-days 3650 \
		-key $< \
		-out $@

test-server.csr: test-server.key
	openssl req -new \
		-subj '/CN=$(DATABASE_HOST)' \
		-key $< \
		-out $@

test-client.csr: test-client.key
	openssl req -new \
		-subj '/CN=$(DATABASE_USER)' \
		-key $< \
		-out $@

test-%.crt: test-%.csr test-%-ca.crt test-%-ca.key
	openssl x509 -req \
		-CA test-$*-ca.crt \
		-CAkey test-$*-ca.key \
		-set_serial 1 \
		-days 3650 \
		-in $< \
		-out $@

%.key:
	openssl genpkey \
		-algorithm EC \
		-pkeyopt ec_paramgen_curve:prime256v1 \
		-out $@

.PHONY: all clean install
.SECONDARY: test-server-ca.key test-client-ca.key
.INTERMEDIATE: test-server.csr test-client.csr
.POSIX: