diff options
Diffstat (limited to 'tests/Makefile')
-rw-r--r-- | tests/Makefile | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/tests/Makefile b/tests/Makefile index 0c86ee8..a555887 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -7,6 +7,12 @@ include ../Make.Rules DEPS=../libcap/libcap.a ../libcap/libpsx.a +ifeq ($(DYNAMIC),yes) +LDPATH = LD_LIBRARY_PATH=../libcap +else +LDFLAGS += --static +endif + all: psx_test libcap_psx_test libcap_launch_test $(DEPS): @@ -19,30 +25,31 @@ sudotest: test run_libcap_launch_test run_libcap_launch_test install: all run_psx_test: psx_test - ./psx_test + $(LDPATH) ./psx_test psx_test: psx_test.c $(DEPS) - $(CC) $(CFLAGS) $(IPATH) $< -o $@ $(LIBPSXLIB) -Wl,-wrap,pthread_create + $(CC) $(CFLAGS) $(IPATH) $< -o $@ $(LIBPSXLIB) run_libcap_psx_test: libcap_psx_test - ./libcap_psx_test + $(LDPATH) ./libcap_psx_test libcap_psx_test: libcap_psx_test.c $(DEPS) - $(CC) $(CFLAGS) $(IPATH) $< -o $@ $(LIBCAPLIB) $(LIBPSXLIB) -Wl,-wrap,pthread_create --static + $(CC) $(CFLAGS) $(IPATH) $< -o $@ $(LIBCAPLIB) $(LIBPSXLIB) $(LDFLAGS) run_libcap_launch_test: libcap_launch_test libcap_psx_launch_test noop - sudo ./libcap_launch_test - sudo ./libcap_psx_launch_test + sudo $(LDPATH) ./libcap_launch_test + sudo $(LDPATH) ./libcap_psx_launch_test libcap_launch_test: libcap_launch_test.c $(DEPS) - $(CC) $(CFLAGS) $(IPATH) $< -o $@ $(LIBCAPLIB) --static + $(CC) $(CFLAGS) $(IPATH) $< -o $@ $(LIBCAPLIB) $(LDFLAGS) # this varies only slightly from the above insofar as it currently # only links in the pthreads fork support. TODO() we need to change # the source to do something interesting with pthreads. libcap_psx_launch_test: libcap_launch_test.c $(DEPS) - $(CC) $(CFLAGS) $(IPATH) -DWITH_PTHREADS $< -o $@ $(LIBCAPLIB) $(LIBPSXLIB) -Wl,-wrap,pthread_create --static + $(CC) $(CFLAGS) $(IPATH) -DWITH_PTHREADS $< -o $@ $(LIBCAPLIB) $(LIBPSXLIB) $(LDFLAGS) +# This one runs in a chroot with no shared library files. noop: noop.c $(CC) $(CFLAGS) $< -o $@ --static |