summaryrefslogtreecommitdiff
path: root/progs/Makefile
diff options
context:
space:
mode:
authorAndrew G. Morgan <morgan@kernel.org>2020-09-07 12:24:43 -0700
committerAndrew G. Morgan <morgan@kernel.org>2020-09-07 12:53:04 -0700
commit307e7f5744b7c84af4c07091c5310cf4f9514694 (patch)
tree3ec6ff066311b0431d581eef07b0e1cb78b77741 /progs/Makefile
parent91fc109c647c65f6b973131155bfe1a52134cf6e (diff)
downloadlibcap2-307e7f5744b7c84af4c07091c5310cf4f9514694.tar.gz
Support dynamic test compilation and execution.
make DYNAMIC=yes test sudotest works now. Thomas Petazzoni provided a patch that built the tests this way, but I've restructured things to make the above command line work against the uninstalled library builds. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
Diffstat (limited to 'progs/Makefile')
-rw-r--r--progs/Makefile15
1 files changed, 10 insertions, 5 deletions
diff --git a/progs/Makefile b/progs/Makefile
index 076e44f..1b27c41 100644
--- a/progs/Makefile
+++ b/progs/Makefile
@@ -8,13 +8,15 @@ PROGS=getpcaps capsh getcap setcap
BUILD=$(PROGS)
-ifneq ($(DYNAMIC),yes)
+ifeq ($(DYNAMIC),yes)
+LDPATH = LD_LIBRARY_PATH=../libcap
+else
LDFLAGS += --static
endif
DEPS=../libcap/libcap.a ../libcap/libpsx.a
-all: $(BUILD)
+all: $(BUILD) tcapsh-static
$(DEPS):
make -C ../libcap all
@@ -36,9 +38,12 @@ endif
test: $(PROGS)
-sudotest: test
- sudo ./quicktest.sh
+tcapsh-static: capsh.c $(DEPS)
+ $(CC) $(IPATH) $(CAPSH_SHELL) $(CFLAGS) -o $@ $< $(LIBCAPLIB) $(LDFLAGS) --static
+
+sudotest: test tcapsh-static
+ sudo $(LDPATH) ./quicktest.sh
clean:
$(LOCALCLEAN)
- rm -f *.o $(BUILD) tcapsh ping hack.sh compare-cap
+ rm -f *.o $(BUILD) tcapsh* privileged ping hack.sh compare-cap