2014-02-27 16:23:35 -08:00
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
# Copyright (c) 1999, 2004-2009 NOVELL (All rights reserved)
|
|
|
|
# Copyright (c) 2010-2014 Canonical Ltd.
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
NAME = apparmor-utils
|
|
|
|
all:
|
|
|
|
COMMONDIR=../../common/
|
|
|
|
|
2015-01-23 15:52:09 -08:00
|
|
|
include $(COMMONDIR)/Make.rules
|
2014-02-27 16:23:35 -08:00
|
|
|
|
2015-10-20 23:04:23 +02:00
|
|
|
ifdef USE_SYSTEM
|
|
|
|
LD_LIBRARY_PATH=
|
|
|
|
PYTHONPATH=
|
|
|
|
else
|
|
|
|
LD_LIBRARY_PATH=../../libraries/libapparmor/src/.libs/
|
|
|
|
PYTHONPATH=..
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: __libapparmor
|
|
|
|
__libapparmor:
|
|
|
|
ifndef USE_SYSTEM
|
|
|
|
@if [ ! -f $(LD_LIBRARY_PATH)libapparmor.so ]; then \
|
|
|
|
echo "error: $(LD_LIBRARY_PATH)libapparmor.so is missing. Pick one of these possible solutions:" 1>&2; \
|
|
|
|
echo " 1) Build against the in-tree libapparmor by building it first and then trying again. See the top-level README for help." 1>&2; \
|
|
|
|
echo " 2) Build against the system libapparmor by adding USE_SYSTEM=1 to your make command." 1>&2; \
|
|
|
|
return 1; \
|
|
|
|
fi
|
|
|
|
endif
|
|
|
|
|
2014-11-04 13:01:14 -08:00
|
|
|
COVERAGE_OMIT=test-*.py,common_test.py
|
|
|
|
ifneq ($(COVERAGE_OUT), )
|
|
|
|
HTML_COVR_ARGS=-d $(COVERAGE_OUT)
|
|
|
|
endif
|
|
|
|
|
2015-01-16 14:45:16 +01:00
|
|
|
# use make COVERAGE_IGNORE_FAILURES=true coverage to build coverage data even if some tests fail
|
|
|
|
ifeq ($(COVERAGE_IGNORE_FAILURES), true)
|
|
|
|
COVERAGE_IGNORE_FAILURES_CMD=true
|
|
|
|
else
|
|
|
|
COVERAGE_IGNORE_FAILURES_CMD=set -e
|
|
|
|
endif
|
|
|
|
|
2014-11-04 13:01:14 -08:00
|
|
|
.PHONY: clean check coverage coverage-report coverage-html
|
2014-02-27 16:23:35 -08:00
|
|
|
ifndef VERBOSE
|
2014-11-04 13:01:14 -08:00
|
|
|
.SILENT: clean check .coverage coverage coverage-report coverage-html
|
2014-02-27 16:23:35 -08:00
|
|
|
endif
|
2014-10-27 11:23:49 -07:00
|
|
|
|
2015-01-23 15:52:09 -08:00
|
|
|
clean:
|
|
|
|
rm -rf __pycache__/ .coverage htmlcov
|
2014-02-27 16:23:35 -08:00
|
|
|
|
2015-10-20 23:04:23 +02:00
|
|
|
check: __libapparmor
|
|
|
|
export PYTHONPATH=$(PYTHONPATH) ; export LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) ; $(foreach test, $(wildcard test-*.py), $(call pyalldo, $(test)))
|
2014-11-04 13:01:14 -08:00
|
|
|
|
2015-10-20 23:04:23 +02:00
|
|
|
.coverage: $(wildcard ../aa-* ../apparmor/*.py test-*.py) __libapparmor
|
|
|
|
export PYTHONPATH=$(PYTHONPATH) ; export LD_LIBRARY_PATH=$(LD_LIBRARY_PATH); $(COVERAGE_IGNORE_FAILURES_CMD) ; $(foreach test, $(wildcard test-*.py), $(PYTHON) -m coverage run --branch -p $(test); )
|
2014-11-04 13:01:14 -08:00
|
|
|
$(PYTHON) -m coverage combine
|
|
|
|
|
|
|
|
coverage: .coverage
|
|
|
|
|
|
|
|
coverage-report: .coverage
|
|
|
|
$(PYTHON) -m coverage report --omit="$(COVERAGE_OMIT)"
|
|
|
|
|
|
|
|
coverage-html: .coverage
|
|
|
|
$(PYTHON) -m coverage html --omit="$(COVERAGE_OMIT)" $(HTML_COVR_ARGS)
|
|
|
|
|