blob: 2289cf7b7b823224b3790d7a732c319a2adea820 (
plain)
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
|
topdir=$(shell pwd)/..
include $(topdir)/Make.Rules
#
# Programs: all of the examples that we will compile
#
PROGS=getpcaps getcap setcap
BUILD=$(PROGS)
all: $(BUILD) capsh
ifeq ($(DYNAMIC),yes)
LDPATH = LD_LIBRARY_PATH=../libcap
DEPS = ../libcap/libcap.so
else
LDFLAGS += --static
DEPS = ../libcap/libcap.a
endif
../libcap/libcap.a:
make -C ../libcap libcap.a
../libcap/libcap.so:
make -C ../libcap libcap.so
$(BUILD): %: %.o $(DEPS)
$(CC) $(CFLAGS) -o $@ $< $(LIBCAPLIB) $(LDFLAGS)
%.o: %.c $(INCS)
$(CC) $(IPATH) $(CFLAGS) -c $< -o $@
install: all
mkdir -p -m 0755 $(FAKEROOT)$(SBINDIR)
for p in $(PROGS) capsh ; do \
install -m 0755 $$p $(FAKEROOT)$(SBINDIR) ; \
done
ifeq ($(RAISE_SETFCAP),yes)
$(FAKEROOT)$(SBINDIR)/setcap cap_setfcap=i $(FAKEROOT)$(SBINDIR)/setcap
endif
test: $(PROGS) capsh
capshdoc.h.cf: capshdoc.h ./mkcapshdoc.sh
./mkcapshdoc.sh > $@
diff -u capshdoc.h $@ || (rm $@ ; exit 1)
capsh: capsh.c capshdoc.h.cf $(DEPS)
$(CC) $(IPATH) $(CAPSH_SHELL) $(CFLAGS) -o $@ $< $(LIBCAPLIB) $(LDFLAGS)
tcapsh-static: capsh.c capshdoc.h.cf $(DEPS)
$(CC) $(IPATH) $(CAPSH_SHELL) $(CFLAGS) -o $@ $< $(LIBCAPLIB) $(LDFLAGS) --static
sudotest: test tcapsh-static
sudo $(LDPATH) ./quicktest.sh
clean:
$(LOCALCLEAN)
rm -f *.o $(BUILD) privileged ping hack.sh compare-cap
rm -f capsh tcapsh* capshdoc.h.cf
|