2006-04-11 21:52:54 +00:00
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
# Copyright (c) 2004, 2005 NOVELL (All rights reserved)
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of version 2 of the GNU General Public
|
|
|
|
# License published by the Free Software Foundation.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, contact Novell, Inc.
|
|
|
|
# ----------------------------------------------------------------------
|
2006-10-31 16:56:11 +00:00
|
|
|
NAME:=apache2-mod_apparmor
|
2006-04-11 21:52:54 +00:00
|
|
|
all:
|
2006-04-12 21:12:39 +00:00
|
|
|
COMMONDIR=../../common/
|
2006-04-11 21:52:54 +00:00
|
|
|
|
2015-01-23 15:52:09 -08:00
|
|
|
include $(COMMONDIR)/Make.rules
|
2006-04-11 21:52:54 +00:00
|
|
|
|
|
|
|
TARGET:=mod_apparmor.so
|
2007-04-03 19:17:20 +00:00
|
|
|
MANPAGES=mod_apparmor.8
|
|
|
|
|
2006-04-11 21:52:54 +00:00
|
|
|
APXS:=$(shell if [ -x "/usr/sbin/apxs2" ] ; then \
|
|
|
|
echo "/usr/sbin/apxs2" ; \
|
|
|
|
elif [ -x "/usr/sbin/apxs" ] ; then \
|
|
|
|
echo "/usr/sbin/apxs" ; \
|
2007-08-14 19:09:03 +00:00
|
|
|
elif [ -x "/usr/bin/apxs2" ] ; then \
|
|
|
|
echo "/usr/bin/apxs2" ; \
|
|
|
|
elif [ -x "/usr/bin/apxs" ] ; then \
|
|
|
|
echo "/usr/bin/apxs" ; \
|
2006-04-11 21:52:54 +00:00
|
|
|
else \
|
|
|
|
echo "apxs" ; \
|
|
|
|
fi )
|
|
|
|
APXS_INSTALL_DIR=$(shell ${APXS} -q LIBEXECDIR)
|
|
|
|
DESTDIR=
|
2014-01-09 11:57:13 -08:00
|
|
|
ifdef USE_SYSTEM
|
|
|
|
LIBAPPARMOR = $(shell if pkg-config --exists libapparmor ; then \
|
|
|
|
pkg-config --silence-errors --libs libapparmor ; \
|
|
|
|
elif ldconfig -p | grep -q libapparmor\.so$$ ; then \
|
|
|
|
echo -lapparmor ; \
|
|
|
|
fi )
|
|
|
|
ifeq ($(strip $(LIBAPPARMOR)),)
|
2014-03-11 14:42:23 -07:00
|
|
|
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})
|
2014-01-09 11:57:13 -08:00
|
|
|
endif # LIBAPPARMOR not set
|
|
|
|
LDLIBS += $(LIBAPPARMOR)
|
|
|
|
else
|
|
|
|
LIBAPPARMOR_SRC := ../../libraries/libapparmor/
|
|
|
|
LIBAPPARMOR_INCLUDE = $(LIBAPPARMOR_SRC)/include
|
|
|
|
LIBAPPARMOR_PATH := $(LIBAPPARMOR_SRC)/src/.libs/
|
|
|
|
ifeq ($(realpath $(LIBAPPARMOR_PATH)/libapparmor.a),)
|
2014-03-11 14:42:23 -07:00
|
|
|
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})
|
2014-01-09 11:57:13 -08:00
|
|
|
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
|
|
|
|
LIBAPPARMOR_FLAGS = -I$(LIBAPPARMOR_INCLUDE) -Wl,-Wl,-L$(LIBAPPARMOR_PATH)
|
|
|
|
LDLIBS = -lapparmor
|
|
|
|
endif
|
2006-04-11 21:52:54 +00:00
|
|
|
|
2014-01-09 12:11:19 -08:00
|
|
|
.PHONY: libapparmor_check
|
|
|
|
.SILENT: libapparmor_check
|
2014-03-11 14:42:23 -07:00
|
|
|
libapparmor_check: ; $(ERROR_MESSAGE)
|
2014-01-09 12:11:19 -08:00
|
|
|
|
|
|
|
all: libapparmor_check $(TARGET) ${MANPAGES} ${HTMLMANPAGES}
|
2006-10-31 17:00:55 +00:00
|
|
|
|
2006-04-11 21:52:54 +00:00
|
|
|
%.so: %.c
|
2011-03-17 23:32:34 -07:00
|
|
|
${APXS} ${LIBAPPARMOR_FLAGS} -c $< ${LDLIBS}
|
2006-04-11 21:52:54 +00:00
|
|
|
mv .libs/$@ .
|
|
|
|
|
|
|
|
.PHONY: install
|
2007-04-03 19:17:20 +00:00
|
|
|
install: ${TARGET} ${MANPAGES}
|
2006-04-11 21:52:54 +00:00
|
|
|
mkdir -p ${DESTDIR}/${APXS_INSTALL_DIR}
|
|
|
|
install -m 755 $< ${DESTDIR}/${APXS_INSTALL_DIR}
|
2007-04-03 19:17:20 +00:00
|
|
|
make install_manpages DESTDIR=${DESTDIR}
|
2006-04-11 21:52:54 +00:00
|
|
|
|
|
|
|
.PHONY: clean
|
2015-01-30 22:15:53 +01:00
|
|
|
clean: pod_clean
|
2006-11-04 21:34:47 +00:00
|
|
|
rm -rf .libs
|
2015-01-23 15:52:09 -08:00
|
|
|
rm -f *.la *.lo *.so *.o *.slo
|
2014-09-15 11:30:47 -07:00
|
|
|
|
|
|
|
.PHONY: check
|
|
|
|
check: check_pod_files
|