mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 10:07:12 +00:00
Convert make errors finding libapparmor to only occur when building
By raising an error for being unable to find libapparmor any time a make command is run, we break things like make clean and other targets that don't strictly depend on libapparmor existing (note that Tyler's implementation for the parser did not do this). This patch fixes this for the regression tests, mod_apparmor and pam_apparmor by making a separate libapparmor_check target that looks to see if an error message should be generated. Signed-off-by: Steve Beattie <steve@nxnw.org> Acked-by: Seth Arnold <seth.arnold@canonical.com>
This commit is contained in:
parent
598f7a0b5b
commit
c6f1034177
@ -48,7 +48,7 @@ ifdef USE_SYSTEM
|
||||
echo -lapparmor ; \
|
||||
fi )
|
||||
ifeq ($(strip $(LIBAPPARMOR)),)
|
||||
$(error Unable to find libapparmor installed on this system; either \
|
||||
ERROR_MESSAGE = Unable to find libapparmor installed on this system; either \
|
||||
install libapparmor devel packages, set the LIBAPPARMOR variable \
|
||||
manually, or build against in-tree libapparmor)
|
||||
endif # LIBAPPARMOR not set
|
||||
@ -58,7 +58,7 @@ else
|
||||
LIBAPPARMOR_INCLUDE = $(LIBAPPARMOR_SRC)/include
|
||||
LIBAPPARMOR_PATH := $(LIBAPPARMOR_SRC)/src/.libs/
|
||||
ifeq ($(realpath $(LIBAPPARMOR_PATH)/libapparmor.a),)
|
||||
$(error $(LIBAPPARMOR_PATH)/libapparmor.a is missing; either build against \
|
||||
ERROR_MESSAGE = $(LIBAPPARMOR_PATH)/libapparmor.a is missing; either build against \
|
||||
the in-tree libapparmor by building it first and then trying again \
|
||||
(see the top-level README for help) or build against the system \
|
||||
libapparmor by adding USE_SYSTEM=1 to your make command.)
|
||||
@ -69,7 +69,15 @@ else
|
||||
LDLIBS = -lapparmor
|
||||
endif
|
||||
|
||||
all: $(TARGET) ${MANPAGES} ${HTMLMANPAGES}
|
||||
.PHONY: libapparmor_check
|
||||
.SILENT: libapparmor_check
|
||||
libapparmor_check:
|
||||
@if [ -n "$(ERROR_MESSAGE)" ] ; then \
|
||||
echo "$(ERROR_MESSAGE)" 1>&2 ; \
|
||||
return 1 ; \
|
||||
fi
|
||||
|
||||
all: libapparmor_check $(TARGET) ${MANPAGES} ${HTMLMANPAGES}
|
||||
|
||||
%.so: %.c
|
||||
${APXS} ${LIBAPPARMOR_FLAGS} -c $< ${LDLIBS}
|
||||
|
@ -33,7 +33,7 @@ ifdef USE_SYSTEM
|
||||
echo -lapparmor ; \
|
||||
fi )
|
||||
ifeq ($(strip $(LIBAPPARMOR)),)
|
||||
$(error Unable to find libapparmor installed on this system; either \
|
||||
ERROR_MESSAGE = Unable to find libapparmor installed on this system; either \
|
||||
install libapparmor devel packages, set the LIBAPPARMOR variable \
|
||||
manually, or build against in-tree libapparmor)
|
||||
endif
|
||||
@ -45,7 +45,7 @@ else
|
||||
LIBAPPARMOR_INCLUDE_PATH = $(LIBAPPARMOR_SRC)/include
|
||||
LIBAPPARMOR_PATH := $(LIBAPPARMOR_SRC)/src/.libs/
|
||||
ifeq ($(realpath $(LIBAPPARMOR_PATH)/libapparmor.a),)
|
||||
$(error $(LIBAPPARMOR_PATH)/libapparmor.a is missing; either build against \
|
||||
ERROR_MESSAGE = $(LIBAPPARMOR_PATH)/libapparmor.a is missing; either build against \
|
||||
the in-tree libapparmor by building it first and then trying again \
|
||||
(see the top-level README for help) or build against the system \
|
||||
libapparmor by adding USE_SYSTEM=1 to your make command.)
|
||||
@ -59,7 +59,15 @@ LINK_FLAGS=-Xlinker -x $(AA_LINK_FLAGS)
|
||||
LIBS=-lpam $(AA_LDLIBS)
|
||||
OBJECTS=${NAME}.o get_options.o
|
||||
|
||||
all: $(NAME).so
|
||||
.PHONY: libapparmor_check
|
||||
.SILENT: libapparmor_check
|
||||
libapparmor_check:
|
||||
@if [ -n "$(ERROR_MESSAGE)" ] ; then \
|
||||
echo "$(ERROR_MESSAGE)" 1>&2 ; \
|
||||
return 1 ; \
|
||||
fi
|
||||
|
||||
all: libapparmor_check $(NAME).so
|
||||
|
||||
$(NAME).so: ${OBJECTS}
|
||||
$(CC) $(EXTRA_CFLAGS) $(LINK_FLAGS) -o $@ ${OBJECTS} $(LIBS)
|
||||
|
@ -14,7 +14,7 @@ ifdef USE_SYSTEM
|
||||
echo -lapparmor ; \
|
||||
fi )
|
||||
ifeq ($(strip $(LIBAPPARMOR)),)
|
||||
$(error Unable to find libapparmor installed on this system; either \
|
||||
ERROR_MESSAGE = Unable to find libapparmor installed on this system; either \
|
||||
install libapparmor devel packages, set the LIBAPPARMOR variable \
|
||||
manually, or build against in-tree libapparmor)
|
||||
endif # LIBAPPARMOR not set
|
||||
@ -26,7 +26,7 @@ else # !USE_SYSTEM
|
||||
LIBAPPARMOR_INCLUDE = $(LIBAPPARMOR_SRC)/include
|
||||
LIBAPPARMOR_PATH := $(LIBAPPARMOR_SRC)/src/.libs/
|
||||
ifeq ($(realpath $(LIBAPPARMOR_PATH)/libapparmor.a),)
|
||||
$(error $(LIBAPPARMOR_PATH)/libapparmor.a is missing; either build against \
|
||||
ERROR_MESSAGE = $(LIBAPPARMOR_PATH)/libapparmor.a is missing; either build against \
|
||||
the in-tree libapparmor by building it first and then trying again \
|
||||
(see the top-level README for help) or build against the system \
|
||||
libapparmor by adding USE_SYSTEM=1 to your make command.)
|
||||
@ -172,7 +172,15 @@ TESTS=access \
|
||||
# Tests that can crash the kernel should be placed here
|
||||
RISKY_TESTS=
|
||||
|
||||
all: $(EXEC) changehat.h
|
||||
.PHONY: libapparmor_check
|
||||
.SILENT: libapparmor_check
|
||||
libapparmor_check:
|
||||
@if [ -n "$(ERROR_MESSAGE)" ] ; then \
|
||||
echo "$(ERROR_MESSAGE)" 1>&2 ; \
|
||||
return 1 ; \
|
||||
fi
|
||||
|
||||
all: libapparmor_check $(EXEC) changehat.h
|
||||
|
||||
changehat_pthread: changehat_pthread.c changehat.h
|
||||
${CC} ${CFLAGS} ${LDFLAGS} $< -o $@ ${LDLIBS} -pthread
|
||||
|
Loading…
x
Reference in New Issue
Block a user