Debian Codegraph @

Makefile

raw
1
2 GO = go
3 OUTDIR = ./out
4
5 default: kxd kxc kxgencert
6
7 kxd:
8 $(GO) build ${GOFLAGS} -o $(OUTDIR)/kxd ./kxd
9
10 kxgencert:
11 $(GO) build ${GOFLAGS} -o $(OUTDIR)/kxgencert ./kxgencert
12
13 # For the client, because it can be run in a very limited environment without
14 # glibc (like initramfs), we build it using the native go networking so it can
15 # work even when glibc's resolvers are missing.
16 kxc:
17 $(GO) build ${GOFLAGS} --tags netgo -a -o $(OUTDIR)/kxc ./kxc
18
19 fmt:
20 gofmt -s -w .
21 black -l 80 tests/run_tests
22
23 vet:
24 $(GO) vet ./...
25
26 test: kxd kxc kxgencert
27 tests/run_tests -b
28
29 tests: test
30
31
32 # Prefixes for installing the files.
33 PREFIX=/usr
34 ETCDIR=/etc
35 SYSTEMDDIR=$(shell pkg-config systemd --variable=systemdsystemunitdir)
36
37 # Install utility, we assume it's GNU/BSD compatible.
38 INSTALL=install
39
40 install-all: install-kxd install-kxc install-kxgencert \
41 install-init.d install-initramfs
42
43 install-kxd: kxd
44 $(INSTALL) -d $(PREFIX)/bin
45 $(INSTALL) -m 0755 out/kxd $(PREFIX)/bin/
46 $(INSTALL) -m 0755 scripts/create-kxd-config $(PREFIX)/bin/
47 $(INSTALL) -m 0755 scripts/kxd-add-client-key $(PREFIX)/bin/
48
49 install-kxgencert: kxgencert
50 $(INSTALL) -d $(PREFIX)/bin
51 $(INSTALL) -m 0755 out/kxgencert $(PREFIX)/bin/
52
53 install-init.d: install-kxd
54 $(INSTALL) -m 0755 scripts/init.d/kxd $(ETCDIR)/init.d/kxd
55 $(INSTALL) -m 0644 scripts/default/kxd $(ETCDIR)/default/kxd
56
57 install-systemd: install-kxd
58 $(INSTALL) -m 0644 scripts/default/kxd $(ETCDIR)/default/kxd
59 $(INSTALL) -m 0644 scripts/systemd/kxd.service $(SYSTEMDDIR)
60
61 install-upstart: install-kxd
62 $(INSTALL) -m 0644 scripts/default/kxd $(ETCDIR)/default/kxd
63 $(INSTALL) -m 0644 scripts/upstart/kxd.conf $(ETCDIR)/init/
64
65 install-kxc: kxc
66 $(INSTALL) -m 0755 out/kxc $(PREFIX)/bin/
67 $(INSTALL) -m 0755 cryptsetup/kxc-cryptsetup $(PREFIX)/bin/
68 $(INSTALL) -m 0755 scripts/kxc-add-key $(PREFIX)/bin/
69
70 install-initramfs: install-kxc
71 $(INSTALL) -d $(PREFIX)/share/initramfs-tools/hooks/
72 $(INSTALL) -m 0755 cryptsetup/initramfs-hooks/kxc \
73 $(PREFIX)/share/initramfs-tools/hooks/
74 $(INSTALL) -d $(PREFIX)/share/initramfs-tools/scripts/init-premount
75 $(INSTALL) -m 0755 cryptsetup/initramfs-scripts/kxc-premount-net \
76 $(PREFIX)/share/initramfs-tools/scripts/init-premount/
77
78
79 .PHONY: kxd kxc kxgencert
80 .PHONY: install-all install-kxd install-init.d install-kxc install-initramfs
81 .PHONY: test tests
82