xref: /aosp_15_r20/external/libcap/contrib/sucap/Makefile (revision 2810ac1b38eead2603277920c78344c84ddf3aff)
1topdir=$(shell pwd)/../..
2include ../../Make.Rules
3
4# This line is here to link against the in-tree copy of libcap.so
5LINKEXTRA=-Wl,-rpath,$(topdir)/libcap
6DEPS=../../libcap/libcap.so
7
8all: su
9
10su: su.c $(DEPS)
11	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -DPAM_APP_NAME=\"sucap\" $< -o $@ $(LINKEXTRA) -lpam -lpam_misc $(LIBCAPLIB)
12	# to permit all ambient capabilities, this needs all permitted.
13	#   sudo setcap =p ./su
14	# to permit all inheritable, as CAP_PURE1E needs, we don't need as much
15	sudo setcap cap_chown,cap_setgid,cap_setuid,cap_dac_read_search,cap_setpcap=p ./su
16
17clean:
18	rm -f su su.o *~
19