-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
54 lines (41 loc) · 904 Bytes
/
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
UNAME = $(shell uname -s)
ifeq ($(UNAME),Linux)
PAM_MOD_PATH := /lib64/security
endif
ifeq ($(UNAME),Darwin)
PAM_MOD_PATH := /usr/lib/pam
endif
ifeq ($(UNAME),FreeBSD)
PAM_MOD_PATH := /usr/lib
endif
ifndef PAM_MOD_PATH
$(error Unknown operating system!)
endif
PROG :=libpam_oauth2_device.so
OUTPUT :=pam_oauth2_device.so
CONF_NAME :=device-flow-auth
DEBUG ?=
ifdef DEBUG
$(info debug is $(DEBUG))
RELEASE :=
TARGET := debug
else
RELEASE := --release
TARGET := release
endif
default: test build
build:
cargo build $(RELEASE)
install:
cp target/$(TARGET)/$(PROG) $(PAM_MOD_PATH)/$(OUTPUT)
cp conf/$(CONF_NAME) /etc/pam.d/
mkdir -p /etc/pam_oauth2_device
cp config.json /etc/pam_oauth2_device/example-config.json
gcc -o target/pam_test test.c -lpam -lpam_misc
test:
cargo test $(RELEASE)
uninstall:
rm $(PAM_MOD_PATH)/$(OUTPUT)
clean:
cargo clean
all: test build install