From 61fb0e9cea12afb68cd71242756e956d05569de0 Mon Sep 17 00:00:00 2001 From: Steve Beattie Date: Tue, 11 Mar 2014 14:42:23 -0700 Subject: [PATCH] Makefiles: add ${nl} for errors, apply when failing to find libapparmor Signed-off-by: Steve Beattie Acked-by: John Johansen --- changehat/mod_apparmor/Makefile | 26 ++++++++++++++------------ changehat/pam_apparmor/Makefile | 26 ++++++++++++++------------ common/Make.rules | 5 +++++ tests/regression/apparmor/Makefile | 30 ++++++++++++++++++------------ 4 files changed, 51 insertions(+), 36 deletions(-) diff --git a/changehat/mod_apparmor/Makefile b/changehat/mod_apparmor/Makefile index edc6b8a27..90db16519 100644 --- a/changehat/mod_apparmor/Makefile +++ b/changehat/mod_apparmor/Makefile @@ -48,9 +48,12 @@ ifdef USE_SYSTEM echo -lapparmor ; \ fi ) ifeq ($(strip $(LIBAPPARMOR)),) - 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) + ERROR_MESSAGE = $(error ${nl}\ +************************************************************************${nl}\ +Unable to find libapparmor installed on this system; either${nl}\ +install libapparmor devel packages, set the LIBAPPARMOR variable${nl}\ +manually, or build against in-tree libapparmor.${nl}\ +************************************************************************${nl}) endif # LIBAPPARMOR not set LDLIBS += $(LIBAPPARMOR) else @@ -58,10 +61,13 @@ else LIBAPPARMOR_INCLUDE = $(LIBAPPARMOR_SRC)/include LIBAPPARMOR_PATH := $(LIBAPPARMOR_SRC)/src/.libs/ ifeq ($(realpath $(LIBAPPARMOR_PATH)/libapparmor.a),) - 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.) + ERROR_MESSAGE = $(error ${nl}\ +************************************************************************${nl}\ +$(LIBAPPARMOR_PATH)/libapparmor.a is missing; either build against${nl}\ +the in-tree libapparmor by building it first and then trying again${nl}\ +(see the top-level README for help) or build against the system${nl}\ +libapparmor by adding USE_SYSTEM=1 to your make command.${nl}\ +************************************************************************${nl}) endif # Need to pass -Wl twice here to get past both apxs2 and libtool, as # libtool will add the path to the RPATH of the library if passed -L/some/path @@ -71,11 +77,7 @@ endif .PHONY: libapparmor_check .SILENT: libapparmor_check -libapparmor_check: - @if [ -n "$(ERROR_MESSAGE)" ] ; then \ - echo "$(ERROR_MESSAGE)" 1>&2 ; \ - return 1 ; \ - fi +libapparmor_check: ; $(ERROR_MESSAGE) all: libapparmor_check $(TARGET) ${MANPAGES} ${HTMLMANPAGES} diff --git a/changehat/pam_apparmor/Makefile b/changehat/pam_apparmor/Makefile index 30448a88a..94499c215 100644 --- a/changehat/pam_apparmor/Makefile +++ b/changehat/pam_apparmor/Makefile @@ -33,9 +33,12 @@ ifdef USE_SYSTEM echo -lapparmor ; \ fi ) ifeq ($(strip $(LIBAPPARMOR)),) - 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) + ERROR_MESSAGE = $(error ${nl}\ +************************************************************************${nl}\ +Unable to find libapparmor installed on this system; either${nl}\ +install libapparmor devel packages, set the LIBAPPARMOR variable${nl}\ +manually, or build against in-tree libapparmor.${nl}\ +************************************************************************${nl}) endif LIBAPPARMOR_INCLUDE = AA_LDLIBS = $(LIBAPPARMOR) @@ -45,10 +48,13 @@ else LIBAPPARMOR_INCLUDE_PATH = $(LIBAPPARMOR_SRC)/include LIBAPPARMOR_PATH := $(LIBAPPARMOR_SRC)/src/.libs/ ifeq ($(realpath $(LIBAPPARMOR_PATH)/libapparmor.a),) - 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.) + ERROR_MESSAGE = $(error ${nl}\ +************************************************************************${nl}\ +$(LIBAPPARMOR_PATH)/libapparmor.a is missing; either build against${nl}\ +the in-tree libapparmor by building it first and then trying again${nl}\ +(see the top-level README for help) or build against the system${nl}\ +libapparmor by adding USE_SYSTEM=1 to your make command.${nl}\ +************************************************************************${nl}) endif LIBAPPARMOR_INCLUDE = -I$(LIBAPPARMOR_INCLUDE_PATH) AA_LINK_FLAGS = -L$(LIBAPPARMOR_PATH) @@ -61,11 +67,7 @@ OBJECTS=${NAME}.o get_options.o .PHONY: libapparmor_check .SILENT: libapparmor_check -libapparmor_check: - @if [ -n "$(ERROR_MESSAGE)" ] ; then \ - echo "$(ERROR_MESSAGE)" 1>&2 ; \ - return 1 ; \ - fi +libapparmor_check: ; $(ERROR_MESSAGE) all: libapparmor_check $(NAME).so diff --git a/common/Make.rules b/common/Make.rules index 3f6031eb3..c57cc5beb 100644 --- a/common/Make.rules +++ b/common/Make.rules @@ -36,6 +36,11 @@ ifndef AWK $(error awk utility required for build but not available) endif +define nl + + +endef + # OVERRIDABLE variables # Set these variables before including Make.rules to change its behavior # SPECFILE - for packages that have a non-standard specfile name diff --git a/tests/regression/apparmor/Makefile b/tests/regression/apparmor/Makefile index 2bf181c23..3ab22d1e4 100644 --- a/tests/regression/apparmor/Makefile +++ b/tests/regression/apparmor/Makefile @@ -6,6 +6,10 @@ # published by the Free Software Foundation, version 2 of the # License. +all: +COMMONDIR=../../../common/ +include $(COMMONDIR)/Make.rules + ifdef USE_SYSTEM # use the system libapparmor headers and library LIBAPPARMOR = $(shell if pkg-config --exists libapparmor ; then \ @@ -14,9 +18,12 @@ ifdef USE_SYSTEM echo -lapparmor ; \ fi ) ifeq ($(strip $(LIBAPPARMOR)),) - 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) + ERROR_MESSAGE = $(error ${nl}\ +************************************************************************${nl}\ +Unable to find libapparmor installed on this system; either${nl}\ +install libapparmor devel packages, set the LIBAPPARMOR variable${nl}\ +manually, or build against in-tree libapparmor.${nl}\ +************************************************************************${nl}) endif # LIBAPPARMOR not set LDLIBS += $(LIBAPPARMOR) @@ -26,10 +33,13 @@ else # !USE_SYSTEM LIBAPPARMOR_INCLUDE = $(LIBAPPARMOR_SRC)/include LIBAPPARMOR_PATH := $(LIBAPPARMOR_SRC)/src/.libs/ ifeq ($(realpath $(LIBAPPARMOR_PATH)/libapparmor.a),) - 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.) + ERROR_MESSAGE = $(error ${nl}\ +************************************************************************${nl}\ +$(LIBAPPARMOR_PATH)/libapparmor.a is missing; either build against${nl}\ +the in-tree libapparmor by building it first and then trying again${nl}\ +(see the top-level README for help) or build against the system${nl}\ +libapparmor by adding USE_SYSTEM=1 to your make command.${nl}\ +************************************************************************${nl}) endif CFLAGS += -L$(LIBAPPARMOR_PATH) -I$(LIBAPPARMOR_INCLUDE) @@ -174,11 +184,7 @@ RISKY_TESTS= .PHONY: libapparmor_check .SILENT: libapparmor_check -libapparmor_check: - @if [ -n "$(ERROR_MESSAGE)" ] ; then \ - echo "$(ERROR_MESSAGE)" 1>&2 ; \ - return 1 ; \ - fi +libapparmor_check: ; $(ERROR_MESSAGE) all: libapparmor_check $(EXEC) changehat.h uservars.inc