1# simple make file for the pam_cap module
2
3topdir=$(shell pwd)/..
4include ../Make.Rules
5
6all: pam_cap.so
7	$(MAKE) testlink
8
9install: all
10	mkdir -p -m 0755 $(FAKEROOT)$(LIBDIR)/security
11	install -m 0755 pam_cap.so $(FAKEROOT)$(LIBDIR)/security
12
13# Note (as the author of much of the Linux-PAM library, I am confident
14# that this next line does *not* require -lpam on it.) If you think it
15# does, *verify that it does*, and if you observe that it fails as
16# written (and you know why it fails), email me and explain why. Thanks!
17
18pam_cap.so: pam_cap.o
19	$(LD) -o pam_cap.so $< $(LIBCAPLIB) $(LDFLAGS)
20
21pam_cap.o: pam_cap.c
22	$(CC) $(CFLAGS) $(IPATH) -c $< -o $@
23
24test_pam_cap: test_pam_cap.c pam_cap.c
25	$(CC) $(CFLAGS) $(IPATH) -o $@ test_pam_cap.c $(LIBCAPLIB) $(LDFLAGS) --static
26
27testlink: test.c pam_cap.o
28	$(CC) $(CFLAGS) -o $@ $+ -lpam -ldl $(LIBCAPLIB) $(LDFLAGS)
29
30test: pam_cap.so
31	make testlink
32
33sudotest: test test_pam_cap
34	sudo ./test_pam_cap root 0x0 0x0 0x0 config=./capability.conf
35	sudo ./test_pam_cap root 0x0 0x0 0x0 config=./sudotest.conf
36	sudo ./test_pam_cap alpha 0x0 0x0 0x0 config=./capability.conf
37	sudo ./test_pam_cap alpha 0x0 0x1 0x80 config=./sudotest.conf
38	sudo ./test_pam_cap beta 0x0 0x1 0x0 config=./sudotest.conf
39	sudo ./test_pam_cap gamma 0x0 0x0 0x81 config=./sudotest.conf
40	sudo ./test_pam_cap delta 0x41 0x80 0x41 config=./sudotest.conf
41
42clean:
43	rm -f *.o *.so testlink test_pam_cap *~
44