In order to run libsemanage tests, libsepol and libselinux source directories need to exist next to libsemanage source directory. This prevents tests to be run when using the released package. As libsemanage tests only use public API of libselinux and libsepol, link with the shared objects which are likely to be installed on the system (or at least present in $DESTDIR). While at it, drop TESTSRC variable as it was used to find libsemanage internal headers but not the tested library (libsemanage.a). Moreover add ../src/libsemanage.a to the target dependencies of the test executable in order to rebuild it after libsemanage.a has been updated. Signed-off-by: Nicolas Iooss <nicolas.iooss@xxxxxxx> --- libsemanage/tests/Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libsemanage/tests/Makefile b/libsemanage/tests/Makefile index 4b81fed70660..bd6a5fd74906 100644 --- a/libsemanage/tests/Makefile +++ b/libsemanage/tests/Makefile @@ -1,23 +1,23 @@ +PREFIX ?= $(DESTDIR)/usr +LIBDIR ?= $(PREFIX)/lib + # Add your test source files here: SOURCES = $(wildcard *.c) -# Point this variable to the libsemanage source directory you want to test: -TESTSRC=../src - # Add the required external object files here: -LIBS = ../src/libsemanage.a ../../libselinux/src/libselinux.a ../../libsepol/src/libsepol.a +LIBS = ../src/libsemanage.a -L$(LIBDIR) -lselinux -lsepol ########################################################################### EXECUTABLE = libsemanage-tests CFLAGS += -g -O0 -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -Wno-unused-parameter -INCLUDE = -I$(TESTSRC) -I$(TESTSRC)/../include +INCLUDE = -I../src -I../include LDFLAGS += -lcunit -lustr -lbz2 -laudit OBJECTS = $(SOURCES:.c=.o) all: $(EXECUTABLE) -$(EXECUTABLE): $(OBJECTS) +$(EXECUTABLE): $(OBJECTS) ../src/libsemanage.a $(CC) $(OBJECTS) $(LIBS) $(LDFLAGS) -o $@ %.o: %.c -- 2.11.0 _______________________________________________ Selinux mailing list Selinux@xxxxxxxxxxxxx To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx. To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.