2006-04-11 21:19:46 +00:00
|
|
|
# ------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Copyright (C) 2002-2005 Novell/SUSE
|
2015-01-23 16:01:14 -08:00
|
|
|
# Copyright (C) 2010-2015 Canonical, Ltd.
|
2006-04-11 21:19:46 +00:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
# ------------------------------------------------------------------
|
2015-01-23 15:52:09 -08:00
|
|
|
# Make.rules - common make targets and variables for building AppArmor
|
2006-04-11 21:19:46 +00:00
|
|
|
#
|
|
|
|
# NOTES:
|
2015-01-23 15:52:09 -08:00
|
|
|
# Before including this file in your Makefile, you should
|
|
|
|
# - define COMMONDIR (the location of the common/ directory)
|
|
|
|
# - define the default rule (usually 'all:'). (Note: you can redefine
|
|
|
|
# it later in your Makefile)
|
2006-04-11 21:19:46 +00:00
|
|
|
|
2015-01-23 20:40:40 +01:00
|
|
|
.PHONY: common_Make.rules_is_a_bad_target
|
|
|
|
common_Make.rules_is_a_bad_target:
|
|
|
|
@echo "*** default target in common/Make.rules hit - either you did something strange, or something is broken... ***"
|
|
|
|
exit 1
|
|
|
|
|
2006-11-03 22:07:47 +00:00
|
|
|
DISTRIBUTION=AppArmor
|
2015-01-23 15:52:09 -08:00
|
|
|
VERSION=$(shell cat $(COMMONDIR)/Version)
|
2006-04-11 21:19:46 +00:00
|
|
|
|
2012-06-11 17:56:21 +01:00
|
|
|
# Convenience functions
|
|
|
|
pathsearch = $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(PATH)))))
|
|
|
|
map = $(foreach a,$(2),$(call $(1),$(a)))
|
|
|
|
|
2012-06-29 16:54:12 -07:00
|
|
|
AWK:=$(shell which awk)
|
|
|
|
ifndef AWK
|
|
|
|
$(error awk utility required for build but not available)
|
|
|
|
endif
|
|
|
|
|
2014-03-11 14:42:23 -07:00
|
|
|
define nl
|
|
|
|
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
2010-10-18 12:12:37 -07:00
|
|
|
REPO_VERSION_CMD=([ -x /usr/bin/bzr ] && /usr/bin/bzr version-info . 2> /dev/null || awk '{ print "revno: "$2 }' common/.stamp_rev) | awk '/^revno:/ { print $2 }'
|
2006-04-11 21:19:46 +00:00
|
|
|
|
2012-06-11 17:56:21 +01:00
|
|
|
ifndef PYTHON_VERSIONS
|
|
|
|
PYTHON_VERSIONS = $(call map, pathsearch, python2 python3)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef PYTHON
|
|
|
|
PYTHON = $(firstword ${PYTHON_VERSIONS})
|
|
|
|
endif
|
|
|
|
|
|
|
|
#Helper function to be used with $(call pyalldo, run_test_with_all.py)
|
|
|
|
pyalldo=set -e; $(foreach py, $(PYTHON_VERSIONS), $(py) $(1);)
|
|
|
|
|
2006-04-11 21:19:46 +00:00
|
|
|
.PHONY: version
|
|
|
|
.SILENT: version
|
|
|
|
version:
|
2015-01-23 16:01:14 -08:00
|
|
|
echo $(VERSION)
|
2006-04-11 21:19:46 +00:00
|
|
|
|
2010-10-07 15:25:21 -07:00
|
|
|
.PHONY: repo_version
|
|
|
|
.SILENT: repo_version
|
|
|
|
repo_version:
|
2010-10-18 12:12:37 -07:00
|
|
|
$(value REPO_VERSION_CMD)
|
|
|
|
|
2015-01-30 22:15:53 +01:00
|
|
|
.PHONY: pod_clean
|
2015-01-23 15:52:09 -08:00
|
|
|
ifndef VERBOSE
|
2015-01-30 22:15:53 +01:00
|
|
|
.SILENT: pod_clean
|
2015-01-23 15:52:09 -08:00
|
|
|
endif
|
2015-01-30 22:15:53 +01:00
|
|
|
pod_clean:
|
2007-04-26 21:20:02 +00:00
|
|
|
-rm -f ${MANPAGES} *.[0-9].gz ${HTMLMANPAGES} pod2htm*.tmp
|
2007-04-03 20:12:16 +00:00
|
|
|
|
2012-03-22 13:19:27 -07:00
|
|
|
# =====================
|
|
|
|
# generate list of capabilities based on
|
2012-03-22 16:41:08 -05:00
|
|
|
# /usr/include/linux/capabilities.h for use in multiple locations in
|
2012-03-22 13:19:27 -07:00
|
|
|
# the source tree
|
|
|
|
# =====================
|
|
|
|
|
|
|
|
# emits defined capabilities in a simple list, e.g. "CAP_NAME CAP_NAME2"
|
2015-08-25 22:44:58 +02:00
|
|
|
CAPABILITIES=$(shell echo "\#include <linux/capability.h>" | cpp -dM | LC_ALL=C sed -n -e '/CAP_EMPTY_SET/d' -e 's/^\#define[ \t]\+CAP_\([A-Z0-9_]\+\)[ \t]\+\([0-9xa-f]\+\)\(.*\)$$/CAP_\1/p' | LC_ALL=C sort)
|
2012-03-22 13:19:27 -07:00
|
|
|
|
|
|
|
.PHONY: list_capabilities
|
|
|
|
list_capabilities: /usr/include/linux/capability.h
|
|
|
|
@echo "$(CAPABILITIES)"
|
|
|
|
|
|
|
|
# =====================
|
|
|
|
# generate list of network protocols based on
|
|
|
|
# sys/socket.h for use in multiple locations in
|
|
|
|
# the source tree
|
|
|
|
# =====================
|
|
|
|
|
|
|
|
# These are the families that it doesn't make sense for apparmor
|
|
|
|
# to mediate. We use PF_ here since that is what is required in
|
|
|
|
# bits/socket.h, but we will rewrite these as AF_.
|
|
|
|
|
2014-03-12 05:20:11 -07:00
|
|
|
FILTER_FAMILIES=PF_UNSPEC PF_UNIX
|
2012-03-22 13:19:27 -07:00
|
|
|
|
|
|
|
__FILTER=$(shell echo $(strip $(FILTER_FAMILIES)) | sed -e 's/ /\\\|/g')
|
|
|
|
|
|
|
|
# emits the AF names in a "AF_NAME NUMBER," pattern
|
2013-09-27 16:13:22 -07:00
|
|
|
AF_NAMES=$(shell echo "\#include <sys/socket.h>" | cpp -dM | LC_ALL=C sed -n -e '/$(__FILTER)/d' -e 's/PF_LOCAL/PF_UNIX/' -e 's/^\#define[ \t]\+PF_\([A-Z0-9_]\+\)[ \t]\+\([0-9]\+\).*$$/AF_\1 \2,/p' | sort -n -k2)
|
2012-03-22 13:19:27 -07:00
|
|
|
|
|
|
|
.PHONY: list_af_names
|
|
|
|
list_af_names:
|
|
|
|
@echo "$(AF_NAMES)"
|
|
|
|
|
2007-04-03 18:51:56 +00:00
|
|
|
# =====================
|
|
|
|
# manpages
|
|
|
|
# =====================
|
|
|
|
|
|
|
|
POD2MAN = /usr/bin/pod2man
|
|
|
|
POD2HTML = /usr/bin/pod2html
|
|
|
|
MANDIR = /usr/share/man
|
|
|
|
DOCDIR = /usr/share/doc/${NAME}-${VERSION}
|
|
|
|
|
|
|
|
# get list of directory numbers based on definition of MANPAGES variable
|
|
|
|
MANDIRS=$(sort $(foreach dir, 1 2 3 4 5 6 7 8, $(patsubst %.${dir}, ${dir}, $(filter %.${dir}, ${MANPAGES}))))
|
|
|
|
HTMLMANPAGES=$(foreach manpage, ${MANPAGES}, ${manpage}.html)
|
|
|
|
|
|
|
|
.PHONY: install_manpages
|
|
|
|
install_manpages: $(MANPAGES)
|
|
|
|
$(foreach dir, ${MANDIRS}, \
|
|
|
|
install -d ${DESTDIR}/${MANDIR}/man${dir} ; \
|
|
|
|
install -m 644 $(filter %.${dir}, ${MANPAGES}) ${DESTDIR}/${MANDIR}/man${dir}; \
|
2010-11-03 17:03:52 -07:00
|
|
|
)
|
2007-04-03 18:51:56 +00:00
|
|
|
|
2010-11-04 11:32:06 -07:00
|
|
|
MAN_RELEASE="AppArmor ${VERSION}"
|
2010-11-03 23:49:41 -07:00
|
|
|
|
2012-04-11 11:16:47 -05:00
|
|
|
%.1 %.2 %.3 %.4 %.5 %.6 %.7 %.8: %.pod
|
|
|
|
$(POD2MAN) $< --release=$(MAN_RELEASE) --center=AppArmor --stderr --section=$(subst .,,$(suffix $@)) > $@
|
2007-04-03 18:51:56 +00:00
|
|
|
|
|
|
|
%.1.html: %.pod
|
|
|
|
$(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
|
|
|
|
|
|
|
|
%.2.html: %.pod
|
|
|
|
$(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
|
|
|
|
|
|
|
|
%.3.html: %.pod
|
|
|
|
$(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
|
|
|
|
|
|
|
|
%.4.html: %.pod
|
|
|
|
$(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
|
|
|
|
|
|
|
|
%.5.html: %.pod
|
|
|
|
$(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
|
|
|
|
|
|
|
|
%.6.html: %.pod
|
|
|
|
$(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
|
|
|
|
|
|
|
|
%.7.html: %.pod
|
|
|
|
$(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
|
|
|
|
|
|
|
|
%.8.html: %.pod
|
|
|
|
$(POD2HTML) --header --css apparmor.css --infile=$< --outfile=$@
|
|
|
|
|
2006-04-11 21:19:46 +00:00
|
|
|
A2PS_ARGS=-Ec -g --line-numbers=1
|
|
|
|
ENSCRIPT_ARGS=-C -2jGr -f Courier6 -E
|
|
|
|
%.c.ps: %.c
|
|
|
|
#a2ps ${A2PS_ARGS} $< -o $@
|
|
|
|
enscript ${ENSCRIPT_ARGS} -o $@ $<
|
|
|
|
|
|
|
|
%.pm.ps: %.pm
|
|
|
|
enscript ${ENSCRIPT_ARGS} -o $@ $<
|
2014-09-15 11:30:47 -07:00
|
|
|
|
|
|
|
.PHONY: check_pod_files
|
|
|
|
check_pod_files:
|
|
|
|
LANG=C podchecker -warning -warning *.pod
|