mirror of
https://github.com/SELinuxProject/selinux
synced 2025-01-29 16:52:45 +00:00
ccfbd9aa17
When building and running tests on a system without SELinux with a command similar to "make DESTDIR=/tmp/destdir install test", libsemanage tests fail to build with the following error: In file included from utilities.h:20:0, from utilities.c:24: ../src/handle.h:29:26: fatal error: sepol/handle.h: No such file or directory #include <sepol/handle.h> ^ Fix this by adding the newly-installed directory under $DESTDIR (using variable $PREFIX) in the search paths of the compiler. Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
32 lines
789 B
Makefile
32 lines
789 B
Makefile
PREFIX ?= $(DESTDIR)/usr
|
|
LIBDIR ?= $(PREFIX)/lib
|
|
|
|
# Add your test source files here:
|
|
SOURCES = $(wildcard *.c)
|
|
|
|
# Add the required external object files here:
|
|
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../src -I../include -I$(PREFIX)/include
|
|
LDFLAGS += -lcunit -lbz2 -laudit
|
|
OBJECTS = $(SOURCES:.c=.o)
|
|
|
|
all: $(EXECUTABLE)
|
|
|
|
$(EXECUTABLE): $(OBJECTS) ../src/libsemanage.a
|
|
$(CC) $(OBJECTS) $(LIBS) $(LDFLAGS) -o $@
|
|
|
|
%.o: %.c
|
|
$(CC) $(CFLAGS) $(INCLUDE) -c $*.c -o $*.o
|
|
|
|
clean distclean:
|
|
rm -rf $(OBJECTS) $(EXECUTABLE)
|
|
|
|
test: all
|
|
./$(EXECUTABLE)
|
|
|