1all: capsicum-test smoketest mini-me mini-me.noexec mini-me.setuid $(EXTRA_PROGS) 2OBJECTS=capsicum-test-main.o capsicum-test.o capability-fd.o fexecve.o procdesc.o capmode.o fcntl.o ioctl.o openat.o sysctl.o select.o mqueue.o socket.o sctp.o capability-fd-pair.o linux.o overhead.o rename.o 3 4GTEST_DIR=gtest-1.10.0 5GTEST_INCS=-I$(GTEST_DIR)/include -I$(GTEST_DIR) 6GTEST_FLAGS=-DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_HAS_TR1_TUPLE=1 7CXXFLAGS+=$(ARCHFLAG) -Wall -g $(GTEST_INCS) $(GTEST_FLAGS) --std=c++11 8CFLAGS+=$(ARCHFLAG) -Wall -g 9 10capsicum-test: $(OBJECTS) libgtest.a $(LOCAL_LIBS) 11 $(CXX) $(CXXFLAGS) -g -o $@ $(OBJECTS) libgtest.a -lpthread -lrt $(LIBSCTP) $(LIBCAPRIGHTS) $(EXTRA_LIBS) 12 13# Small statically-linked program for fexecve tests 14# (needs to be statically linked so that execve()ing it 15# doesn't involve ld.so traversing the filesystem). 16mini-me: mini-me.c 17 $(CC) $(CFLAGS) -static -o $@ $< 18mini-me.noexec: mini-me 19 cp mini-me $@ && chmod -x $@ 20mini-me.setuid: mini-me 21 rm -f $@ && cp mini-me $@&& sudo chown root $@ && sudo chmod u+s $@ 22 23# Simple C test of Capsicum syscalls 24SMOKETEST_OBJECTS=smoketest.o 25smoketest: $(SMOKETEST_OBJECTS) $(LOCAL_LIBS) 26 $(CC) $(CFLAGS) -o $@ $(SMOKETEST_OBJECTS) $(LIBCAPRIGHTS) 27 28test: capsicum-test mini-me mini-me.noexec mini-me.setuid $(EXTRA_PROGS) 29 ./capsicum-test 30gtest-all.o: 31 $(CXX) $(CXXFLAGS) $(ARCHFLAG) -I$(GTEST_DIR)/include -I$(GTEST_DIR) $(GTEST_FLAGS) -c ${GTEST_DIR}/src/gtest-all.cc 32libgtest.a: gtest-all.o 33 $(AR) -rv libgtest.a gtest-all.o 34 35clean: 36 rm -rf gtest-all.o libgtest.a capsicum-test mini-me mini-me.noexec smoketest $(SMOKETEST_OBJECTS) $(OBJECTS) $(LOCAL_CLEAN) $(EXTRA_PROGS) 37