forked from aluzzardi/pam_usb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
96 lines (78 loc) · 2.4 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Set to 'yes' to include debugging information, e.g. DEBUG=yes make -e
DEBUG := yes
PREFIX ?= /usr
ARCH := $(shell getconf LONG_BIT)
ifeq ($(ARCH),64)
LIBDIR := lib64
else
LIBDIR := lib
endif
# compiler/linker options
CC := gcc
CFLAGS := $(CFLAGS) -Wall -fPIC `pkg-config --cflags libxml-2.0` \
`pkg-config --cflags dbus-1`
LIBS := `pkg-config --libs libxml-2.0` \
`pkg-config --libs dbus-1`
# common source files
SRCS := src/conf.c \
src/mem.c \
src/log.c \
src/xpath.c \
src/hal.c \
src/pad.c \
src/volume.c \
src/local.c \
src/device.c
OBJS := $(SRCS:.c=.o)
# pam_usb
PAM_USB_SRCS := src/pam.c
PAM_USB_OBJS := $(PAM_USB_SRCS:.c=.o)
PAM_USB := pam_usb.so
PAM_USB_LDFLAGS := -shared
PAM_USB_DEST := $(DESTDIR)/$(LIBDIR)/security
# pamusb-check
PAMUSB_CHECK_SRCS := src/pamusb-check.c
PAMUSB_CHECK_OBJS := $(PAMUSB_CHECK_SRCS:.c=.o)
PAMUSB_CHECK := pamusb-check
# Tools
PAMUSB_CONF := pamusb-conf
PAMUSB_AGENT := pamusb-agent
TOOLS_DEST := $(DESTDIR)$(PREFIX)/bin
TOOLS_SRC := tools
# Conf
CONFS := doc/pamusb.conf
CONFS_DEST := $(DESTDIR)/etc/security
# Doc
DOCS := doc/CONFIGURATION.md
DOCS_DEST := $(DESTDIR)$(PREFIX)/share/doc/pam_usb
# Man
MANS := doc/pamusb-conf.1.gz doc/pamusb-agent.1.gz doc/pamusb-check.1.gz
MANS_DEST := $(DESTDIR)$(PREFIX)/share/man/man1
# Binaries
RM := rm
INSTALL := install
MKDIR := mkdir
ifeq (yes, ${DEBUG})
CFLAGS := ${CFLAGS} -ggdb
endif
all : $(PAM_USB) $(PAMUSB_CHECK)
$(PAM_USB) : $(OBJS) $(PAM_USB_OBJS)
$(CC) -o $(PAM_USB) $(PAM_USB_LDFLAGS) $(LDFLAGS) $(OBJS) $(PAM_USB_OBJS) $(LIBS)
$(PAMUSB_CHECK) : $(OBJS) $(PAMUSB_CHECK_OBJS)
$(CC) -o $(PAMUSB_CHECK) $(LDFLAGS) $(OBJS) $(PAMUSB_CHECK_OBJS) $(LIBS)
%.o : %.c
${CC} -c ${CFLAGS} $< -o $@
clean :
$(RM) -f $(PAM_USB) $(PAMUSB_CHECK) $(OBJS) $(PAMUSB_CHECK_OBJS) $(PAM_USB_OBJS)
install : all
$(MKDIR) -p $(CONFS_DEST) $(DOCS_DEST) $(MANS_DEST) $(TOOLS_DEST) $(PAM_USB_DEST)
$(INSTALL) -m755 $(PAM_USB) $(PAM_USB_DEST)
$(INSTALL) -m755 $(PAMUSB_CHECK) $(TOOLS_SRC)/$(PAMUSB_CONF) $(TOOLS_SRC)/$(PAMUSB_AGENT) $(TOOLS_DEST)
$(INSTALL) -b -m644 $(CONFS) $(CONFS_DEST)
$(INSTALL) -m644 $(DOCS) $(DOCS_DEST)
$(INSTALL) -m644 $(MANS) $(MANS_DEST)
deinstall :
$(RM) -f $(PAM_USB_DEST)/$(PAM_USB)
$(RM) -f $(TOOLS_DEST)/$(PAMUSB_CHECK) $(TOOLS_DEST)/$(PAMUSB_CONF) $(TOOLS_DEST)/$(PAMUSB_AGENT)
$(RM) -rf $(DOCS_DEST)
$(RM) -f $(MANS_DEST)/pusb_*