-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
73 lines (56 loc) · 2.19 KB
/
Makefile
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
RAGEL = ragel
RAGEL_FLAGS := -F0
COMPILE.rl = $(RAGEL) $(RAGEL_FLAGS)
%.c: %.rl
$(COMPILE.rl) -C $(OUTPUT_OPTION) $<
%.so: %.o
$(LINK.o) -shared $^ $(LOADLIBES) $(LDLIBS) -o $@
VERSION=v14
GIT_DESC=$(shell test -d .git && git describe 2>/dev/null)
ifneq "$(GIT_DESC)" ""
VERSION=$(GIT_DESC)
endif
base_CFLAGS = -std=c11 -g \
-Wall -Wextra -pedantic \
-Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes \
-D_GNU_SOURCE \
-DENVOY_VERSION=\"$(VERSION)\"
libsystemd_CFLAGS = $(shell pkg-config --cflags libsystemd)
libsystemd_LDLIBS = $(shell pkg-config --libs libsystemd)
dbus_CFLAGS = $(shell pkg-config --cflags dbus-1)
dbus_LDLIBS = $(shell pkg-config --libs dbus-1)
CFLAGS := \
$(base_CFLAGS) \
$(libsystemd_CFLAGS) \
$(dbus_CFLAGS) \
$(CFLAGS)
LDLIBS := \
$(libsystemd_LDLIBS) \
$(dbus_LDLIBS) \
$(LDLIBS)
VPATH = src
LIBDIR := $(shell pkg-config --variable=libdir libsystemd)
ENVOYLIBS = gpg-protocol.o agents.o socket.o util.o
all: envoyd envoy envoy-exec pam_envoy.so
gpg-protocol.o: $(VPATH)/gpg-protocol.c
$(ENVOYLIBS) pam_envoy.o: private CFLAGS += -fPIC
envoyd: envoyd.o dbus.o $(ENVOYLIBS)
envoy: envoy.o $(ENVOYLIBS)
envoy-exec: envoy-exec.o $(ENVOYLIBS)
pam_envoy.so: pam_envoy.o $(ENVOYLIBS)
install: envoyd envoy pam_envoy.so
install -Dm755 envoyd $(DESTDIR)/usr/bin/envoyd
install -Dm755 envoy $(DESTDIR)/usr/bin/envoy
install -Dm755 envoy-exec $(DESTDIR)/usr/bin/envoy-exec
install -Dm755 pam_envoy.so $(DESTDIR)/$(LIBDIR)/security/pam_envoy.so
install -Dm644 man/envoyd.1 $(DESTDIR)/usr/share/man/man1/envoyd.1
install -Dm644 man/envoy.1 $(DESTDIR)/usr/share/man/man1/envoy.1
install -Dm644 man/envoy-exec.1 $(DESTDIR)/usr/share/man/man1/envoy-exec.1
install -Dm644 units/envoy@.service $(DESTDIR)/usr/lib/systemd/system/envoy@.service
install -Dm644 units/envoy@.socket $(DESTDIR)/usr/lib/systemd/system/envoy@.socket
install -Dm644 units/envoy@.service $(DESTDIR)/usr/lib/systemd/user/envoy@.service
install -Dm644 units/envoy@.socket $(DESTDIR)/usr/lib/systemd/user/envoy@.socket
install -Dm644 zsh-completion $(DESTDIR)/usr/share/zsh/site-functions/_envoy
clean:
$(RM) envoyd envoy envoy-exec pam_envoy.so *.o src/gpg-protocol.c
.PHONY: all clean install