2005-04-19 13:53:51 +00:00
|
|
|
#
|
|
|
|
# Makefile for the security policy.
|
|
|
|
#
|
|
|
|
# Targets:
|
2016-12-04 13:18:21 +00:00
|
|
|
#
|
2005-04-19 13:53:51 +00:00
|
|
|
# install - compile and install the policy configuration, and context files.
|
|
|
|
# load - compile, install, and load the policy configuration.
|
|
|
|
# reload - compile, install, and load/reload the policy configuration.
|
|
|
|
# relabel - relabel filesystems based on the file contexts configuration.
|
|
|
|
# checklabels - check filesystems against the file context configuration
|
|
|
|
# restorelabels - check filesystems against the file context configuration
|
|
|
|
# and restore the label of files with incorrect labels
|
|
|
|
# policy - compile the policy configuration locally for testing/development.
|
|
|
|
#
|
|
|
|
# The default target is 'policy'.
|
|
|
|
#
|
2005-04-14 20:18:17 +00:00
|
|
|
#
|
2005-12-01 19:04:57 +00:00
|
|
|
# Please see build.conf for policy build options.
|
2005-04-14 20:18:17 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
2005-06-06 18:13:38 +00:00
|
|
|
# NO OPTIONS BELOW HERE
|
2005-04-14 20:18:17 +00:00
|
|
|
#
|
|
|
|
|
2006-02-15 17:59:58 +00:00
|
|
|
# Include the local build.conf if it exists, otherwise
|
|
|
|
# include the configuration of the root directory.
|
2006-02-17 14:26:39 +00:00
|
|
|
include build.conf
|
|
|
|
|
|
|
|
ifdef LOCAL_ROOT
|
|
|
|
-include $(LOCAL_ROOT)/build.conf
|
2006-02-15 17:59:58 +00:00
|
|
|
endif
|
2005-12-01 19:04:57 +00:00
|
|
|
|
2006-02-01 13:22:14 +00:00
|
|
|
# refpolicy version
|
2016-11-29 17:08:29 +00:00
|
|
|
version := $(shell cat VERSION)
|
2006-02-01 13:22:14 +00:00
|
|
|
|
2006-02-15 17:59:58 +00:00
|
|
|
ifdef LOCAL_ROOT
|
2006-08-31 17:28:35 +00:00
|
|
|
builddir := $(LOCAL_ROOT)/
|
|
|
|
tmpdir := $(LOCAL_ROOT)/tmp
|
|
|
|
tags := $(LOCAL_ROOT)/tags
|
2006-02-15 17:59:58 +00:00
|
|
|
else
|
2006-08-31 17:28:35 +00:00
|
|
|
tmpdir := tmp
|
|
|
|
tags := tags
|
2006-02-15 17:59:58 +00:00
|
|
|
endif
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
# executable paths
|
2006-06-28 14:42:36 +00:00
|
|
|
BINDIR ?= /usr/bin
|
|
|
|
SBINDIR ?= /usr/sbin
|
2006-07-03 18:03:16 +00:00
|
|
|
ifdef TEST_TOOLCHAIN
|
2012-09-17 13:30:59 +00:00
|
|
|
tc_usrbindir := env LD_LIBRARY_PATH="$(TEST_TOOLCHAIN)/lib:$(TEST_TOOLCHAIN)/usr/lib" $(TEST_TOOLCHAIN)$(BINDIR)
|
|
|
|
tc_usrsbindir := env LD_LIBRARY_PATH="$(TEST_TOOLCHAIN)/lib:$(TEST_TOOLCHAIN)/usr/lib" $(TEST_TOOLCHAIN)$(SBINDIR)
|
|
|
|
tc_sbindir := env LD_LIBRARY_PATH="$(TEST_TOOLCHAIN)/lib:$(TEST_TOOLCHAIN)/usr/lib" $(TEST_TOOLCHAIN)/sbin
|
2006-07-03 18:03:16 +00:00
|
|
|
else
|
2006-09-06 16:36:23 +00:00
|
|
|
tc_usrbindir := $(BINDIR)
|
|
|
|
tc_usrsbindir := $(SBINDIR)
|
|
|
|
tc_sbindir := /sbin
|
2006-07-03 18:03:16 +00:00
|
|
|
endif
|
2006-09-06 16:36:23 +00:00
|
|
|
CHECKPOLICY ?= $(tc_usrbindir)/checkpolicy
|
|
|
|
CHECKMODULE ?= $(tc_usrbindir)/checkmodule
|
|
|
|
SEMODULE ?= $(tc_usrsbindir)/semodule
|
|
|
|
SEMOD_PKG ?= $(tc_usrbindir)/semodule_package
|
|
|
|
SEMOD_LNK ?= $(tc_usrbindir)/semodule_link
|
|
|
|
SEMOD_EXP ?= $(tc_usrbindir)/semodule_expand
|
|
|
|
LOADPOLICY ?= $(tc_usrsbindir)/load_policy
|
2020-05-28 12:27:55 +00:00
|
|
|
SEPOLGEN_IFGEN ?= $(tc_usrbindir)/sepolgen-ifgen
|
2006-07-03 18:03:16 +00:00
|
|
|
SETFILES ?= $(tc_sbindir)/setfiles
|
2006-06-28 14:42:36 +00:00
|
|
|
XMLLINT ?= $(BINDIR)/xmllint
|
|
|
|
SECHECK ?= $(BINDIR)/sechecker
|
2005-06-01 19:01:00 +00:00
|
|
|
|
2006-02-13 20:06:05 +00:00
|
|
|
# interpreters and aux tools
|
|
|
|
AWK ?= gawk
|
|
|
|
GREP ?= egrep
|
2006-08-08 21:56:45 +00:00
|
|
|
INSTALL ?= install
|
2016-11-29 17:08:29 +00:00
|
|
|
M4 ?= m4 -E -E
|
2018-05-31 21:41:59 +00:00
|
|
|
PYTHON ?= python3 -t -t -E -W error
|
2006-02-13 20:06:05 +00:00
|
|
|
SED ?= sed
|
2006-03-21 18:14:48 +00:00
|
|
|
SORT ?= LC_ALL=C sort
|
2011-10-19 14:59:16 +00:00
|
|
|
UMASK ?= umask
|
2006-02-13 20:06:05 +00:00
|
|
|
|
2005-08-18 21:27:20 +00:00
|
|
|
# policy source layout
|
2006-08-31 17:28:35 +00:00
|
|
|
poldir := policy
|
|
|
|
moddir := $(poldir)/modules
|
|
|
|
flaskdir := $(poldir)/flask
|
|
|
|
secclass := $(flaskdir)/security_classes
|
|
|
|
isids := $(flaskdir)/initial_sids
|
|
|
|
avs := $(flaskdir)/access_vectors
|
2005-08-18 21:27:20 +00:00
|
|
|
|
2006-02-15 17:59:58 +00:00
|
|
|
# local source layout
|
|
|
|
ifdef LOCAL_ROOT
|
2006-08-31 17:28:35 +00:00
|
|
|
local_poldir := $(LOCAL_ROOT)/policy
|
|
|
|
local_moddir := $(local_poldir)/modules
|
2006-02-15 17:59:58 +00:00
|
|
|
endif
|
|
|
|
|
2005-08-18 21:27:20 +00:00
|
|
|
# policy building support tools
|
2006-08-31 17:28:35 +00:00
|
|
|
support := support
|
2017-03-14 23:32:11 +00:00
|
|
|
genxml := $(PYTHON) $(support)/segenxml.py
|
|
|
|
gendoc := $(PYTHON) $(support)/sedoctool.py
|
|
|
|
genperm := $(PYTHON) $(support)/genclassperms.py
|
|
|
|
policyvers := $(PYTHON) $(support)/policyvers.py
|
2019-10-03 20:38:39 +00:00
|
|
|
fcsort := $(PYTHON) $(support)/fc_sort.py
|
2006-08-31 17:28:35 +00:00
|
|
|
setbools := $(AWK) -f $(support)/set_bools_tuns.awk
|
|
|
|
get_type_attr_decl := $(SED) -r -f $(support)/get_type_attr_decl.sed
|
|
|
|
comment_move_decl := $(SED) -r -f $(support)/comment_move_decl.sed
|
2017-03-14 23:32:11 +00:00
|
|
|
gennetfilter := $(PYTHON) $(support)/gennetfilter.py
|
2008-03-06 20:17:46 +00:00
|
|
|
m4iferror := $(support)/iferror.m4
|
2009-08-10 17:59:29 +00:00
|
|
|
m4divert := $(support)/divert.m4
|
|
|
|
m4undivert := $(support)/undivert.m4
|
2017-02-18 15:20:20 +00:00
|
|
|
m4terminate := $(support)/fatal_error.m4
|
2006-05-15 15:21:43 +00:00
|
|
|
# use our own genhomedircon to make sure we have a known usable one,
|
|
|
|
# so policycoreutils updates are not required (RHEL4)
|
2017-03-14 23:32:11 +00:00
|
|
|
genhomedircon := $(PYTHON) $(support)/genhomedircon.py
|
2018-03-25 11:56:37 +00:00
|
|
|
gentemplates := $(support)/gentemplates.sh
|
2005-06-07 18:35:18 +00:00
|
|
|
|
2005-08-18 21:27:20 +00:00
|
|
|
# documentation paths
|
2006-08-31 17:28:35 +00:00
|
|
|
docs := doc
|
2016-11-29 17:08:29 +00:00
|
|
|
xmldtd := $(docs)/policy.dtd
|
|
|
|
metaxml := metadata.xml
|
|
|
|
doctemplate := $(docs)/templates
|
|
|
|
docfiles := $(docs)/Makefile.example $(addprefix $(docs)/,example.te example.if example.fc)
|
2005-08-18 21:27:20 +00:00
|
|
|
|
2006-02-15 17:59:58 +00:00
|
|
|
ifndef LOCAL_ROOT
|
2016-11-29 17:08:29 +00:00
|
|
|
polxml := $(docs)/policy.xml
|
|
|
|
tunxml := $(docs)/global_tunables.xml
|
|
|
|
boolxml := $(docs)/global_booleans.xml
|
|
|
|
htmldir := $(docs)/html
|
2020-04-06 10:22:05 +00:00
|
|
|
doctmpdir := $(docs)/tmp
|
2006-02-15 17:59:58 +00:00
|
|
|
else
|
2016-11-29 17:08:29 +00:00
|
|
|
polxml := $(LOCAL_ROOT)/doc/policy.xml
|
|
|
|
tunxml := $(LOCAL_ROOT)/doc/global_tunables.xml
|
|
|
|
boolxml := $(LOCAL_ROOT)/doc/global_booleans.xml
|
|
|
|
htmldir := $(LOCAL_ROOT)/doc/html
|
2020-04-06 10:22:05 +00:00
|
|
|
doctmpdir := $(LOCAL_ROOT)/doc/tmp
|
2006-02-15 17:59:58 +00:00
|
|
|
endif
|
|
|
|
|
2005-08-18 21:27:20 +00:00
|
|
|
# config file paths
|
2016-11-29 17:08:29 +00:00
|
|
|
globaltun := $(poldir)/global_tunables
|
|
|
|
globalbool := $(poldir)/global_booleans
|
2006-08-31 17:28:35 +00:00
|
|
|
user_files := $(poldir)/users
|
2008-04-18 14:21:01 +00:00
|
|
|
policycaps := $(poldir)/policy_capabilities
|
2014-04-28 14:00:36 +00:00
|
|
|
ctx_defaults := $(poldir)/context_defaults
|
2005-08-18 21:27:20 +00:00
|
|
|
|
2006-02-15 17:59:58 +00:00
|
|
|
# local config file paths
|
|
|
|
ifndef LOCAL_ROOT
|
2016-11-29 17:08:29 +00:00
|
|
|
mod_conf := $(poldir)/modules.conf
|
|
|
|
booleans := $(poldir)/booleans.conf
|
|
|
|
tunables := $(poldir)/tunables.conf
|
2006-02-15 17:59:58 +00:00
|
|
|
else
|
2016-11-29 17:08:29 +00:00
|
|
|
mod_conf := $(local_poldir)/modules.conf
|
|
|
|
booleans := $(local_poldir)/booleans.conf
|
|
|
|
tunables := $(local_poldir)/tunables.conf
|
2006-02-15 17:59:58 +00:00
|
|
|
endif
|
|
|
|
|
2005-08-18 21:27:20 +00:00
|
|
|
# install paths
|
2006-08-31 17:28:35 +00:00
|
|
|
PKGNAME ?= refpolicy-$(version)
|
2016-11-29 17:08:29 +00:00
|
|
|
prefix := $(DESTDIR)/usr
|
|
|
|
topdir := $(DESTDIR)/etc/selinux
|
|
|
|
installdir := $(topdir)/$(strip $(NAME))
|
|
|
|
srcpath := $(installdir)/src
|
|
|
|
userpath := $(installdir)/users
|
|
|
|
policypath := $(installdir)/policy
|
|
|
|
contextpath := $(installdir)/contexts
|
|
|
|
homedirpath := $(contextpath)/files/homedir_template
|
|
|
|
fcpath := $(contextpath)/files/file_contexts
|
|
|
|
fcsubspath := $(contextpath)/files/file_contexts.subs_dist
|
|
|
|
sharedir := $(prefix)/share/selinux
|
|
|
|
modpkgdir := $(sharedir)/$(strip $(NAME))
|
|
|
|
headerdir := $(modpkgdir)/include
|
|
|
|
docsdir := $(prefix)/share/doc/$(PKGNAME)
|
2005-11-22 22:07:12 +00:00
|
|
|
|
2005-06-01 15:40:37 +00:00
|
|
|
# enable MLS if requested.
|
2007-10-02 16:04:50 +00:00
|
|
|
ifeq "$(TYPE)" "mls"
|
2006-01-25 19:29:55 +00:00
|
|
|
M4PARAM += -D enable_mls
|
|
|
|
CHECKPOLICY += -M
|
|
|
|
CHECKMODULE += -M
|
2006-05-25 15:14:19 +00:00
|
|
|
gennetfilter += -m
|
2005-06-01 15:40:37 +00:00
|
|
|
endif
|
|
|
|
|
2005-09-16 13:36:26 +00:00
|
|
|
# enable MLS if MCS requested.
|
2007-10-02 16:04:50 +00:00
|
|
|
ifeq "$(TYPE)" "mcs"
|
2006-01-25 19:29:55 +00:00
|
|
|
M4PARAM += -D enable_mcs
|
|
|
|
CHECKPOLICY += -M
|
|
|
|
CHECKMODULE += -M
|
2006-05-25 15:14:19 +00:00
|
|
|
gennetfilter += -c
|
2005-06-06 18:13:38 +00:00
|
|
|
endif
|
|
|
|
|
2005-07-13 18:08:12 +00:00
|
|
|
# enable distribution-specific policy
|
|
|
|
ifneq ($(DISTRO),)
|
2006-01-25 19:29:55 +00:00
|
|
|
M4PARAM += -D distro_$(DISTRO)
|
2005-07-13 18:08:12 +00:00
|
|
|
endif
|
|
|
|
|
2008-02-05 18:24:43 +00:00
|
|
|
ifeq "$(DISTRO)" "ubuntu"
|
|
|
|
M4PARAM += -D distro_debian
|
|
|
|
endif
|
|
|
|
|
2015-10-20 19:01:23 +00:00
|
|
|
ifeq "$(SYSTEMD)" "y"
|
|
|
|
M4PARAM += -D init_systemd
|
|
|
|
endif
|
|
|
|
|
2005-06-06 18:13:38 +00:00
|
|
|
ifneq ($(OUTPUT_POLICY),)
|
2006-01-25 19:29:55 +00:00
|
|
|
CHECKPOLICY += -c $(OUTPUT_POLICY)
|
2005-06-06 18:13:38 +00:00
|
|
|
endif
|
|
|
|
|
2010-09-30 18:53:44 +00:00
|
|
|
ifneq "$(CUSTOM_BUILDOPT)" ""
|
|
|
|
M4PARAM += $(foreach opt,$(CUSTOM_BUILDOPT),-D $(opt))
|
|
|
|
endif
|
|
|
|
|
2006-01-25 19:29:55 +00:00
|
|
|
# if not set, use the type as the name.
|
|
|
|
NAME ?= $(TYPE)
|
2005-06-01 15:40:37 +00:00
|
|
|
|
2007-09-27 13:41:09 +00:00
|
|
|
# default unknown permissions setting
|
2014-06-19 14:48:38 +00:00
|
|
|
UNK_PERMS ?= deny
|
2007-09-27 13:41:09 +00:00
|
|
|
|
2005-09-21 14:49:41 +00:00
|
|
|
ifeq ($(DIRECT_INITRC),y)
|
2006-01-25 19:29:55 +00:00
|
|
|
M4PARAM += -D direct_sysadm_daemon
|
2005-09-21 14:49:41 +00:00
|
|
|
endif
|
|
|
|
|
2017-02-18 15:20:20 +00:00
|
|
|
ifeq "$(WERROR)" "y"
|
|
|
|
M4PARAM += -D m4_werror
|
|
|
|
endif
|
|
|
|
|
2008-11-05 16:10:46 +00:00
|
|
|
ifeq "$(UBAC)" "y"
|
|
|
|
M4PARAM += -D enable_ubac
|
|
|
|
endif
|
|
|
|
|
2006-10-04 17:25:34 +00:00
|
|
|
# default MLS/MCS sensitivity and category settings.
|
|
|
|
MLS_SENS ?= 16
|
2010-06-28 13:04:24 +00:00
|
|
|
MLS_CATS ?= 1024
|
|
|
|
MCS_CATS ?= 1024
|
2006-10-04 17:25:34 +00:00
|
|
|
|
2006-01-26 20:35:55 +00:00
|
|
|
ifeq ($(QUIET),y)
|
|
|
|
verbose = @
|
2020-05-28 12:27:55 +00:00
|
|
|
else
|
|
|
|
VERBOSE_FLAG = --verbose
|
2006-01-26 20:35:55 +00:00
|
|
|
endif
|
|
|
|
|
2006-10-04 17:25:34 +00:00
|
|
|
M4PARAM += -D mls_num_sens=$(MLS_SENS) -D mls_num_cats=$(MLS_CATS) -D mcs_num_cats=$(MCS_CATS) -D hide_broken_symptoms
|
2005-10-24 22:49:26 +00:00
|
|
|
|
2006-01-25 18:30:27 +00:00
|
|
|
# we need exuberant ctags; unfortunately it is named
|
|
|
|
# differently on different distros
|
|
|
|
ifeq ($(DISTRO),debian)
|
|
|
|
CTAGS := ctags-exuberant
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(DISTRO),gentoo)
|
2016-12-04 13:18:21 +00:00
|
|
|
CTAGS := exuberant-ctags
|
2006-01-25 18:30:27 +00:00
|
|
|
endif
|
|
|
|
|
2006-01-25 19:02:48 +00:00
|
|
|
CTAGS ?= ctags
|
2006-01-25 18:30:27 +00:00
|
|
|
|
2009-08-10 17:59:29 +00:00
|
|
|
m4support := $(m4divert) $(wildcard $(poldir)/support/*.spt)
|
2006-04-11 18:23:53 +00:00
|
|
|
ifdef LOCAL_ROOT
|
2006-08-31 17:28:35 +00:00
|
|
|
m4support += $(wildcard $(local_poldir)/support/*.spt)
|
2006-04-11 18:23:53 +00:00
|
|
|
endif
|
2009-08-10 17:59:29 +00:00
|
|
|
m4support += $(m4undivert)
|
2005-06-07 15:11:47 +00:00
|
|
|
|
2006-08-31 17:28:35 +00:00
|
|
|
appconf := config/appconfig-$(TYPE)
|
|
|
|
seusers := $(appconf)/seusers
|
|
|
|
appdir := $(contextpath)
|
2006-10-12 13:18:21 +00:00
|
|
|
user_default_contexts := $(wildcard config/appconfig-$(TYPE)/*_default_contexts)
|
|
|
|
user_default_contexts_names := $(addprefix $(contextpath)/users/,$(subst _default_contexts,,$(notdir $(user_default_contexts))))
|
2017-05-07 17:44:56 +00:00
|
|
|
appfiles := $(addprefix $(appdir)/,default_contexts default_type initrc_context failsafe_context userhelper_context removable_context dbus_contexts sepgsql_contexts x_contexts customizable_types securetty_types lxc_contexts openrc_contexts virtual_domain_context virtual_image_context) $(contextpath)/files/media $(fcsubspath) $(user_default_contexts_names)
|
2006-08-31 17:28:35 +00:00
|
|
|
net_contexts := $(builddir)net_contexts
|
2020-04-22 16:13:02 +00:00
|
|
|
net_contexts_nft := $(builddir)net_contexts.nft
|
|
|
|
docfiles += $(net_contexts) $(net_contexts_nft)
|
2005-05-25 20:58:09 +00:00
|
|
|
|
2019-05-22 07:00:23 +00:00
|
|
|
all_layers := $(shell find $(moddir)/* -maxdepth 0 -type d)
|
2006-02-15 17:59:58 +00:00
|
|
|
ifdef LOCAL_ROOT
|
2019-05-22 07:00:23 +00:00
|
|
|
all_layers += $(shell find $(local_moddir)/* -maxdepth 0 -type d)
|
2006-02-15 17:59:58 +00:00
|
|
|
endif
|
2005-06-08 22:14:26 +00:00
|
|
|
|
2006-08-31 17:28:35 +00:00
|
|
|
generated_te := $(basename $(foreach dir,$(all_layers),$(wildcard $(dir)/*.te.in)))
|
|
|
|
generated_if := $(basename $(foreach dir,$(all_layers),$(wildcard $(dir)/*.if.in)))
|
|
|
|
generated_fc := $(basename $(foreach dir,$(all_layers),$(wildcard $(dir)/*.fc.in)))
|
2005-06-08 22:14:26 +00:00
|
|
|
|
2005-06-14 18:39:55 +00:00
|
|
|
# sort here since it removes duplicates, which can happen
|
|
|
|
# when a generated file is already generated
|
2006-08-31 17:28:35 +00:00
|
|
|
detected_mods := $(sort $(foreach dir,$(all_layers),$(wildcard $(dir)/*.te)) $(generated_te))
|
2005-06-28 17:31:18 +00:00
|
|
|
|
2020-04-06 10:22:05 +00:00
|
|
|
modxml := $(addprefix $(doctmpdir)/, $(detected_mods:.te=.xml))
|
|
|
|
layerxml := $(sort $(addprefix $(doctmpdir)/, $(notdir $(addsuffix .xml,$(all_layers)))))
|
2007-09-21 15:06:58 +00:00
|
|
|
layer_names := $(sort $(notdir $(all_layers)))
|
|
|
|
all_metaxml = $(call detect-metaxml, $(layer_names))
|
2007-03-26 18:41:45 +00:00
|
|
|
|
2005-08-18 21:27:20 +00:00
|
|
|
# modules.conf setting for base module
|
2006-08-31 17:28:35 +00:00
|
|
|
configbase := base
|
2005-08-18 21:27:20 +00:00
|
|
|
|
2006-01-12 16:07:59 +00:00
|
|
|
# modules.conf setting for loadable module
|
2006-08-31 17:28:35 +00:00
|
|
|
configmod := module
|
2005-08-18 21:27:20 +00:00
|
|
|
|
2006-01-12 16:07:59 +00:00
|
|
|
# modules.conf setting for unused module
|
2006-08-31 17:28:35 +00:00
|
|
|
configoff := off
|
2006-01-12 16:07:59 +00:00
|
|
|
|
2006-02-15 17:59:58 +00:00
|
|
|
# test for module overrides from command line
|
2006-08-31 17:28:35 +00:00
|
|
|
mod_test = $(filter $(APPS_OFF), $(APPS_BASE) $(APPS_MODS))
|
|
|
|
mod_test += $(filter $(APPS_MODS), $(APPS_BASE))
|
|
|
|
ifneq "$(strip $(mod_test))" ""
|
|
|
|
$(error Applications must be base, module, or off, and not in more than one list! $(strip $(mod_test)) found in multiple lists!)
|
2006-02-15 17:59:58 +00:00
|
|
|
endif
|
|
|
|
|
2006-04-11 18:23:53 +00:00
|
|
|
# add on suffix to modules specified on command line
|
2006-08-31 17:28:35 +00:00
|
|
|
cmdline_base := $(addsuffix .te,$(APPS_BASE))
|
|
|
|
cmdline_mods := $(addsuffix .te,$(APPS_MODS))
|
|
|
|
cmdline_off := $(addsuffix .te,$(APPS_OFF))
|
2006-04-11 18:23:53 +00:00
|
|
|
|
2005-08-18 21:27:20 +00:00
|
|
|
# extract settings from modules.conf
|
2016-09-01 10:14:03 +00:00
|
|
|
mod_conf_base := $(addsuffix .te,$(sort $(shell $(AWK) '/^[[:blank:]]*[[:alpha:]]/{ if ($$3 == "$(configbase)") print $$1 }' $(mod_conf) 2> /dev/null)))
|
|
|
|
mod_conf_mods := $(addsuffix .te,$(sort $(shell $(AWK) '/^[[:blank:]]*[[:alpha:]]/{ if ($$3 == "$(configmod)") print $$1 }' $(mod_conf) 2> /dev/null)))
|
|
|
|
mod_conf_off := $(addsuffix .te,$(sort $(shell $(AWK) '/^[[:blank:]]*[[:alpha:]]/{ if ($$3 == "$(configoff)") print $$1 }' $(mod_conf) 2> /dev/null)))
|
2006-04-11 18:23:53 +00:00
|
|
|
|
2006-08-31 17:28:35 +00:00
|
|
|
base_mods := $(cmdline_base)
|
|
|
|
mod_mods := $(cmdline_mods)
|
|
|
|
off_mods := $(cmdline_off)
|
2006-03-06 15:20:12 +00:00
|
|
|
|
2006-08-31 17:28:35 +00:00
|
|
|
base_mods += $(filter-out $(cmdline_off) $(cmdline_base) $(cmdline_mods), $(mod_conf_base))
|
|
|
|
mod_mods += $(filter-out $(cmdline_off) $(cmdline_base) $(cmdline_mods), $(mod_conf_mods))
|
|
|
|
off_mods += $(filter-out $(cmdline_off) $(cmdline_base) $(cmdline_mods), $(mod_conf_off))
|
2006-03-06 15:20:12 +00:00
|
|
|
|
|
|
|
# add modules not in modules.conf to the off list
|
2006-08-31 17:28:35 +00:00
|
|
|
off_mods += $(filter-out $(base_mods) $(mod_mods) $(off_mods),$(notdir $(detected_mods)))
|
2005-09-12 15:17:39 +00:00
|
|
|
|
2006-02-15 19:46:20 +00:00
|
|
|
# filesystems to be used in labeling targets
|
2016-09-01 10:14:03 +00:00
|
|
|
filesystems = $(shell mount | grep -v "context=" | egrep -v '\((|.*,)bind(,.*|)\)' | $(AWK) '/(ext[234]|btrfs| xfs| jfs).*rw/{print $$3}';)
|
2009-08-11 13:01:58 +00:00
|
|
|
fs_names := "btrfs ext2 ext3 ext4 xfs jfs"
|
2006-02-01 13:22:14 +00:00
|
|
|
|
2006-01-26 18:04:57 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Functions
|
|
|
|
#
|
|
|
|
|
2007-09-21 15:06:58 +00:00
|
|
|
# detect-metaxml layer_names
|
|
|
|
ifdef LOCAL_ROOT
|
|
|
|
define detect-metaxml
|
|
|
|
$(shell for i in $1; do \
|
|
|
|
if [ -d $(moddir)/$$i -a -d $(local_moddir)/$$i ]; then \
|
|
|
|
if [ -f $(local_moddir)/$$i/$(metaxml) ]; then \
|
|
|
|
echo $(local_moddir)/$$i/$(metaxml) ;\
|
|
|
|
else \
|
|
|
|
echo $(moddir)/$$i/$(metaxml) ;\
|
|
|
|
fi \
|
|
|
|
elif [ -d $(local_moddir)/$$i ]; then
|
|
|
|
echo $(local_moddir)/$$i/$(metaxml) ;\
|
|
|
|
else \
|
|
|
|
echo $(moddir)/$$i/$(metaxml) ;\
|
|
|
|
fi \
|
|
|
|
done )
|
|
|
|
endef
|
|
|
|
else
|
|
|
|
define detect-metaxml
|
|
|
|
$(shell for i in $1; do echo $(moddir)/$$i/$(metaxml); done)
|
|
|
|
endef
|
|
|
|
endif
|
|
|
|
|
2005-04-14 20:18:17 +00:00
|
|
|
########################################
|
|
|
|
#
|
2005-08-18 21:27:20 +00:00
|
|
|
# Load appropriate rules
|
2005-04-14 20:18:17 +00:00
|
|
|
#
|
|
|
|
|
2005-08-18 21:27:20 +00:00
|
|
|
ifeq ($(MONOLITHIC),y)
|
2006-02-16 17:11:58 +00:00
|
|
|
include Rules.monolithic
|
2005-08-18 21:27:20 +00:00
|
|
|
else
|
2006-02-16 17:11:58 +00:00
|
|
|
include Rules.modular
|
2005-04-14 20:18:17 +00:00
|
|
|
endif
|
|
|
|
|
2005-04-19 13:53:51 +00:00
|
|
|
########################################
|
|
|
|
#
|
2005-08-18 21:27:20 +00:00
|
|
|
# Generated files
|
2005-04-14 20:18:17 +00:00
|
|
|
#
|
2006-02-15 17:59:58 +00:00
|
|
|
# NOTE: There is no "local" version of these files.
|
|
|
|
#
|
2006-08-31 17:28:35 +00:00
|
|
|
generate: $(generated_te) $(generated_if) $(generated_fc)
|
2006-02-16 22:25:09 +00:00
|
|
|
|
2006-09-05 14:29:37 +00:00
|
|
|
$(moddir)/kernel/corenetwork.if: $(moddir)/kernel/corenetwork.te.in $(moddir)/kernel/corenetwork.if.m4 $(moddir)/kernel/corenetwork.if.in
|
2005-06-13 18:40:08 +00:00
|
|
|
@echo "#" > $@
|
|
|
|
@echo "# This is a generated file! Instead of modifying this file, the" >> $@
|
|
|
|
@echo "# $(notdir $@).in or $(notdir $@).m4 file should be modified." >> $@
|
|
|
|
@echo "#" >> $@
|
2006-09-05 14:29:37 +00:00
|
|
|
$(verbose) cat $@.in >> $@
|
2017-05-24 14:14:59 +00:00
|
|
|
$(verbose) $(GREP) "^[[:blank:]]*(network_(interface|node|port|packet)(_controlled)?)|ib_(pkey|endport)\(.*\)" $< \
|
2011-10-04 20:00:08 +00:00
|
|
|
| $(M4) -D self_contained_policy $(M4PARAM) $(m4divert) $@.m4 $(m4undivert) - \
|
2006-08-08 21:56:45 +00:00
|
|
|
| $(SED) -e 's/dollarsone/\$$1/g' -e 's/dollarszero/\$$0/g' >> $@
|
2005-06-08 21:46:39 +00:00
|
|
|
|
2011-10-04 20:00:08 +00:00
|
|
|
$(moddir)/kernel/corenetwork.te: $(m4divert) $(moddir)/kernel/corenetwork.te.m4 $(m4undivert) $(moddir)/kernel/corenetwork.te.in
|
2005-06-13 18:40:08 +00:00
|
|
|
@echo "#" > $@
|
|
|
|
@echo "# This is a generated file! Instead of modifying this file, the" >> $@
|
|
|
|
@echo "# $(notdir $@).in or $(notdir $@).m4 file should be modified." >> $@
|
|
|
|
@echo "#" >> $@
|
2006-08-08 21:56:45 +00:00
|
|
|
$(verbose) $(M4) -D self_contained_policy $(M4PARAM) $^ \
|
|
|
|
| $(SED) -e 's/dollarsone/\$$1/g' -e 's/dollarszero/\$$0/g' >> $@
|
2005-06-08 21:46:39 +00:00
|
|
|
|
2006-05-25 15:14:19 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Network packet labeling
|
|
|
|
#
|
2006-08-31 17:28:35 +00:00
|
|
|
$(net_contexts): $(moddir)/kernel/corenetwork.te.in
|
2006-05-25 15:14:19 +00:00
|
|
|
@echo "Creating netfilter network labeling rules"
|
|
|
|
$(verbose) $(gennetfilter) $^ > $@
|
|
|
|
|
2020-04-22 16:13:02 +00:00
|
|
|
$(net_contexts_nft): $(moddir)/kernel/corenetwork.te.in
|
|
|
|
@echo "Creating netfilter NFT network labeling rules"
|
|
|
|
$(verbose) $(gennetfilter) --nft $^ > $@
|
|
|
|
|
2005-06-08 13:44:23 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Create config files
|
|
|
|
#
|
2016-11-29 17:08:29 +00:00
|
|
|
conf: $(mod_conf) $(booleans) generate
|
2005-06-14 15:54:55 +00:00
|
|
|
|
2016-12-04 13:18:21 +00:00
|
|
|
$(booleans) $(mod_conf): conf.intermediate
|
2016-11-29 17:08:29 +00:00
|
|
|
|
2016-12-04 13:18:21 +00:00
|
|
|
.INTERMEDIATE: conf.intermediate
|
|
|
|
conf.intermediate: $(polxml)
|
|
|
|
@echo "Updating $(booleans) and $(mod_conf)"
|
|
|
|
$(verbose) $(gendoc) -b $(booleans) -m $(mod_conf) -x $(polxml)
|
2005-06-08 13:44:23 +00:00
|
|
|
|
2005-05-18 20:58:13 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Documentation generation
|
|
|
|
#
|
2020-04-06 10:22:05 +00:00
|
|
|
iftemplates: $(doctmpdir)/iftemplates
|
|
|
|
$(doctmpdir)/iftemplates:
|
|
|
|
@echo "Generating interface templates into $(doctmpdir)/iftemplates"
|
|
|
|
@test -d $(doctmpdir)/iftemplates || mkdir -p $(doctmpdir)/iftemplates
|
|
|
|
$(verbose) $(gentemplates) -g -s $(moddir) -t $(doctmpdir)/iftemplates
|
2018-03-25 11:56:37 +00:00
|
|
|
ifdef LOCAL_ROOT
|
2020-04-06 10:22:05 +00:00
|
|
|
$(verbose) $(gentemplates) -g -s $(local_moddir) -t $(doctmpdir)/iftemplates
|
2018-03-25 11:56:37 +00:00
|
|
|
endif
|
2020-04-06 10:22:05 +00:00
|
|
|
@touch $(doctmpdir)/iftemplates
|
2018-03-25 11:56:37 +00:00
|
|
|
|
2020-04-06 10:22:05 +00:00
|
|
|
$(layerxml): %.xml: $(doctmpdir)/iftemplates $(all_metaxml) $(filter $(addprefix $(moddir)/, $(notdir $*))%, $(detected_mods)) $(subst .te,.if, $(filter $(addprefix $(moddir)/, $(notdir $*))%, $(detected_mods)))
|
|
|
|
@test -d $(doctmpdir) || mkdir -p $(doctmpdir)
|
2019-10-01 18:24:29 +00:00
|
|
|
$(verbose) cat $(filter %/$(notdir $*)/$(metaxml), $(all_metaxml)) > $@
|
2020-04-06 10:22:05 +00:00
|
|
|
$(verbose) for i in $(basename $(filter $(addprefix $(moddir)/, $(notdir $*))%, $(detected_mods))); do $(genxml) -w -T $(doctmpdir)/iftemplates -m $$i >> $@; done
|
2007-09-21 15:06:58 +00:00
|
|
|
ifdef LOCAL_ROOT
|
2020-04-06 10:22:05 +00:00
|
|
|
$(verbose) for i in $(basename $(filter $(addprefix $(local_moddir)/, $(notdir $*))%, $(detected_mods))); do $(genxml) -w -T $(doctmpdir)/iftemplates -m $$i >> $@; done
|
2016-12-04 13:18:21 +00:00
|
|
|
endif
|
2007-03-26 18:41:45 +00:00
|
|
|
|
|
|
|
$(tunxml): $(globaltun)
|
|
|
|
$(verbose) $(genxml) -w -t $< > $@
|
|
|
|
|
|
|
|
$(boolxml): $(globalbool)
|
|
|
|
$(verbose) $(genxml) -w -b $< > $@
|
|
|
|
|
|
|
|
$(polxml): $(layerxml) $(tunxml) $(boolxml)
|
2006-02-17 14:26:39 +00:00
|
|
|
@echo "Creating $(@F)"
|
2006-08-31 17:28:35 +00:00
|
|
|
@test -d $(dir $(polxml)) || mkdir -p $(dir $(polxml))
|
2020-04-06 10:22:05 +00:00
|
|
|
@test -d $(doctmpdir) || mkdir -p $(doctmpdir)
|
2006-01-26 20:35:55 +00:00
|
|
|
$(verbose) echo '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>' > $@
|
2006-08-31 17:28:35 +00:00
|
|
|
$(verbose) echo '<!DOCTYPE policy SYSTEM "$(notdir $(xmldtd))">' >> $@
|
2007-03-26 18:41:45 +00:00
|
|
|
$(verbose) echo '<policy>' >> $@
|
2020-04-06 10:22:05 +00:00
|
|
|
$(verbose) for i in $(basename $(notdir $(layerxml))); do echo "<layer name=\"$$i\">" >> $@; cat $(doctmpdir)/$$i.xml >> $@; echo "</layer>" >> $@; done
|
2007-09-21 15:06:58 +00:00
|
|
|
$(verbose) cat $(tunxml) $(boolxml) >> $@
|
2007-03-26 18:41:45 +00:00
|
|
|
$(verbose) echo '</policy>' >> $@
|
2006-08-31 17:28:35 +00:00
|
|
|
$(verbose) if test -x $(XMLLINT) && test -f $(xmldtd); then \
|
|
|
|
$(XMLLINT) --noout --path $(dir $(xmldtd)) --dtdvalid $(xmldtd) $@ ;\
|
2020-03-19 17:48:34 +00:00
|
|
|
else \
|
|
|
|
echo "$@ XML validation not run. Please install the xmllint tool." ;\
|
2005-06-01 18:34:34 +00:00
|
|
|
fi
|
2005-05-18 20:58:13 +00:00
|
|
|
|
2007-03-26 18:41:45 +00:00
|
|
|
xml: $(polxml)
|
2006-02-16 20:41:57 +00:00
|
|
|
|
2006-08-31 17:28:35 +00:00
|
|
|
html $(tmpdir)/html: $(polxml)
|
|
|
|
@echo "Building html interface reference documentation in $(htmldir)"
|
|
|
|
@test -d $(htmldir) || mkdir -p $(htmldir)
|
|
|
|
@test -d $(tmpdir) || mkdir -p $(tmpdir)
|
|
|
|
$(verbose) $(gendoc) -d $(htmldir) -T $(doctemplate) -x $(polxml)
|
|
|
|
$(verbose) cp $(doctemplate)/*.css $(htmldir)
|
|
|
|
@touch $(tmpdir)/html
|
2005-06-09 19:02:52 +00:00
|
|
|
|
2005-05-25 20:58:09 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Runtime binary policy patching of users
|
|
|
|
#
|
2006-08-31 17:28:35 +00:00
|
|
|
$(userpath)/system.users: $(m4support) $(tmpdir)/generated_definitions.conf $(user_files)
|
|
|
|
@mkdir -p $(tmpdir)
|
2005-05-25 20:58:09 +00:00
|
|
|
@echo "Installing system.users"
|
2006-08-31 17:28:35 +00:00
|
|
|
@echo "# " > $(tmpdir)/system.users
|
|
|
|
@echo "# Do not edit this file. " >> $(tmpdir)/system.users
|
|
|
|
@echo "# This file is replaced on reinstalls of this policy." >> $(tmpdir)/system.users
|
|
|
|
@echo "# Please edit local.users to make local changes." >> $(tmpdir)/system.users
|
|
|
|
@echo "#" >> $(tmpdir)/system.users
|
2006-08-08 21:56:45 +00:00
|
|
|
$(verbose) $(M4) -D self_contained_policy $(M4PARAM) $^ | $(SED) -r -e 's/^[[:blank:]]+//' \
|
2006-08-31 17:28:35 +00:00
|
|
|
-e '/^[[:blank:]]*($$|#)/d' >> $(tmpdir)/system.users
|
2011-10-19 14:59:16 +00:00
|
|
|
@$(INSTALL) -d -m 0755 $(@D)
|
|
|
|
$(verbose) $(INSTALL) -m 0644 $(tmpdir)/system.users $@
|
2005-05-25 20:58:09 +00:00
|
|
|
|
2006-08-31 17:28:35 +00:00
|
|
|
$(userpath)/local.users: config/local.users
|
2005-05-25 20:58:09 +00:00
|
|
|
@echo "Installing local.users"
|
2011-10-19 14:59:16 +00:00
|
|
|
@$(INSTALL) -d -m 0755 $(@D)
|
|
|
|
$(verbose) $(INSTALL) -b -m 0644 $< $@
|
2005-05-25 20:58:09 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
2006-10-04 17:25:34 +00:00
|
|
|
# Build Appconfig files
|
|
|
|
#
|
|
|
|
$(tmpdir)/initrc_context: $(appconf)/initrc_context
|
|
|
|
@mkdir -p $(tmpdir)
|
|
|
|
$(verbose) $(M4) $(M4PARAM) $(m4support) $^ | $(GREP) '^[a-z]' > $@
|
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Install Appconfig files
|
2005-05-25 20:58:09 +00:00
|
|
|
#
|
2006-08-31 17:28:35 +00:00
|
|
|
install-appconfig: $(appfiles)
|
2005-05-25 20:58:09 +00:00
|
|
|
|
2006-08-31 17:28:35 +00:00
|
|
|
$(installdir)/booleans: $(booleans)
|
|
|
|
@mkdir -p $(tmpdir)
|
2006-08-08 21:56:45 +00:00
|
|
|
$(verbose) $(SED) -r -e 's/false/0/g' -e 's/true/1/g' \
|
2006-08-31 17:28:35 +00:00
|
|
|
-e '/^[[:blank:]]*($$|#)/d' $(booleans) | $(SORT) > $(tmpdir)/booleans
|
2011-10-19 14:59:16 +00:00
|
|
|
@$(INSTALL) -d -m 0755 $(@D)
|
|
|
|
$(verbose) $(INSTALL) -m 0644 $(tmpdir)/booleans $@
|
2005-06-14 18:13:55 +00:00
|
|
|
|
2006-08-31 17:28:35 +00:00
|
|
|
$(contextpath)/files/media: $(appconf)/media
|
2011-10-19 14:59:16 +00:00
|
|
|
@$(INSTALL) -d -m 0755 $(@D)
|
|
|
|
$(verbose) $(INSTALL) -m 0644 $< $@
|
2005-05-25 20:58:09 +00:00
|
|
|
|
2011-07-28 17:12:28 +00:00
|
|
|
$(fcsubspath): config/file_contexts.subs_dist
|
2011-10-19 14:59:16 +00:00
|
|
|
@$(INSTALL) -d -m 0755 $(@D)
|
|
|
|
$(verbose) $(INSTALL) -m 0644 $< $@
|
2011-07-28 17:12:28 +00:00
|
|
|
|
2006-10-12 13:18:21 +00:00
|
|
|
$(contextpath)/users/%: $(appconf)/%_default_contexts
|
2011-10-19 14:59:16 +00:00
|
|
|
@$(INSTALL) -d -m 0755 $(@D)
|
|
|
|
$(verbose) $(INSTALL) -m 0644 $^ $@
|
2006-01-26 20:35:55 +00:00
|
|
|
|
2008-01-17 14:10:36 +00:00
|
|
|
$(appdir)/%: $(appconf)/%
|
2011-10-19 14:59:16 +00:00
|
|
|
$(verbose) $(M4) $(M4PARAM) $(m4support) $< > $(tmpdir)/$(@F)
|
|
|
|
@$(INSTALL) -d -m 0755 $(@D)
|
|
|
|
$(verbose) $(INSTALL) -m 0644 $(tmpdir)/$(@F) $@
|
2008-01-17 14:10:36 +00:00
|
|
|
|
2006-01-26 20:35:55 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Install policy headers
|
|
|
|
#
|
2007-03-26 18:41:45 +00:00
|
|
|
install-headers: $(layerxml) $(tunxml) $(boolxml)
|
2006-08-31 17:28:35 +00:00
|
|
|
@mkdir -p $(headerdir)
|
2009-08-17 13:49:53 +00:00
|
|
|
@echo "Installing $(NAME) policy headers."
|
2007-09-21 15:06:58 +00:00
|
|
|
$(verbose) $(INSTALL) -m 644 $^ $(headerdir)
|
2006-08-31 17:28:35 +00:00
|
|
|
$(verbose) mkdir -p $(headerdir)/support
|
2017-01-01 21:48:37 +00:00
|
|
|
$(verbose) $(INSTALL) -m 644 $(m4support) $(xmldtd) $(headerdir)/support
|
|
|
|
$(verbose) $(INSTALL) -m 755 $(word $(words $(genxml)),$(genxml)) $(headerdir)/support
|
2006-08-31 17:28:35 +00:00
|
|
|
$(verbose) $(genperm) $(avs) $(secclass) > $(headerdir)/support/all_perms.spt
|
|
|
|
$(verbose) for i in $(notdir $(all_layers)); do \
|
|
|
|
mkdir -p $(headerdir)/$$i ;\
|
2007-09-21 15:06:58 +00:00
|
|
|
$(INSTALL) -m 644 $(moddir)/$$i/*.if $(headerdir)/$$i ;\
|
2006-02-10 18:41:53 +00:00
|
|
|
done
|
2006-08-31 17:28:35 +00:00
|
|
|
$(verbose) echo "TYPE ?= $(TYPE)" > $(headerdir)/build.conf
|
|
|
|
$(verbose) echo "NAME ?= $(NAME)" >> $(headerdir)/build.conf
|
2006-02-10 18:41:53 +00:00
|
|
|
ifneq "$(DISTRO)" ""
|
2006-08-31 17:28:35 +00:00
|
|
|
$(verbose) echo "DISTRO ?= $(DISTRO)" >> $(headerdir)/build.conf
|
2006-02-10 18:41:53 +00:00
|
|
|
endif
|
2006-08-31 17:28:35 +00:00
|
|
|
$(verbose) echo "MONOLITHIC ?= n" >> $(headerdir)/build.conf
|
|
|
|
$(verbose) echo "DIRECT_INITRC ?= $(DIRECT_INITRC)" >> $(headerdir)/build.conf
|
2015-10-20 19:01:23 +00:00
|
|
|
$(verbose) echo "SYSTEMD ?= $(SYSTEMD)" >> $(headerdir)/build.conf
|
2018-10-27 16:13:32 +00:00
|
|
|
$(verbose) echo "CUSTOM_BUILDOPT ?= $(CUSTOM_BUILDOPT)" >> $(headerdir)/build.conf
|
2008-11-05 16:10:46 +00:00
|
|
|
$(verbose) echo "override UBAC := $(UBAC)" >> $(headerdir)/build.conf
|
2006-10-04 17:25:34 +00:00
|
|
|
$(verbose) echo "override MLS_SENS := $(MLS_SENS)" >> $(headerdir)/build.conf
|
|
|
|
$(verbose) echo "override MLS_CATS := $(MLS_CATS)" >> $(headerdir)/build.conf
|
|
|
|
$(verbose) echo "override MCS_CATS := $(MCS_CATS)" >> $(headerdir)/build.conf
|
2006-08-31 17:28:35 +00:00
|
|
|
$(verbose) $(INSTALL) -m 644 $(support)/Makefile.devel $(headerdir)/Makefile
|
2005-05-25 20:58:09 +00:00
|
|
|
|
2020-05-28 12:27:55 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Build policy interface database
|
|
|
|
#
|
|
|
|
build-interface-db: install-headers
|
|
|
|
@mkdir -p $(DESTDIR)/var/lib/sepolgen $(tmpdir)
|
|
|
|
$(verbose) $(SEPOLGEN_IFGEN) $(VERBOSE_FLAG) --interfaces $(headerdir) --output $(DESTDIR)/var/lib/sepolgen/interface_info
|
|
|
|
|
2006-02-01 13:22:14 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Install policy documentation
|
|
|
|
#
|
2020-04-22 16:13:02 +00:00
|
|
|
install-docs: $(tmpdir)/html $(docfiles)
|
2006-08-31 17:28:35 +00:00
|
|
|
@mkdir -p $(docsdir)/html
|
2006-02-01 13:22:14 +00:00
|
|
|
@echo "Installing policy documentation"
|
2006-08-31 17:28:35 +00:00
|
|
|
$(verbose) $(INSTALL) -m 644 $(docfiles) $(docsdir)
|
|
|
|
$(verbose) $(INSTALL) -m 644 $(wildcard $(htmldir)/*) $(docsdir)/html
|
2006-02-01 13:22:14 +00:00
|
|
|
|
2005-06-15 14:14:20 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Install policy sources
|
|
|
|
#
|
|
|
|
install-src:
|
2006-08-31 17:28:35 +00:00
|
|
|
rm -rf $(srcpath)/policy.old
|
2017-03-18 13:32:24 +00:00
|
|
|
if test -d $(srcpath)/policy; then \
|
|
|
|
mv $(srcpath)/policy $(srcpath)/policy.old ;\
|
|
|
|
fi
|
2006-08-31 17:28:35 +00:00
|
|
|
mkdir -p $(srcpath)/policy
|
|
|
|
cp -R . $(srcpath)/policy
|
2005-06-15 14:14:20 +00:00
|
|
|
|
2006-01-25 18:30:27 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Generate tags file
|
|
|
|
#
|
2020-04-01 19:00:02 +00:00
|
|
|
ctags: $(tags)
|
2006-08-31 17:28:35 +00:00
|
|
|
$(tags):
|
2006-01-25 18:30:27 +00:00
|
|
|
@($(CTAGS) --version | grep -q Exuberant) || (echo ERROR: Need exuberant-ctags to function!; exit 1)
|
2006-08-31 17:28:35 +00:00
|
|
|
@LC_ALL=C $(CTAGS) -f $(tags) --langdef=te --langmap=te:..te.if.spt \
|
2006-01-25 18:30:27 +00:00
|
|
|
--regex-te='/^type[ \t]+(\w+)(,|;)/\1/t,type/' \
|
|
|
|
--regex-te='/^typealias[ \t]+\w+[ \t+]+alias[ \t]+(\w+);/\1/t,type/' \
|
|
|
|
--regex-te='/^attribute[ \t]+(\w+);/\1/a,attribute/' \
|
|
|
|
--regex-te='/^[ \t]*define\(`(\w+)/\1/d,define/' \
|
|
|
|
--regex-te='/^[ \t]*interface\(`(\w+)/\1/i,interface/' \
|
2007-06-28 13:13:55 +00:00
|
|
|
--regex-te='/^[ \t]*template\(`(\w+)/\1/i,template/' \
|
2020-04-01 19:00:02 +00:00
|
|
|
--regex-te='/^[ \t]*bool[ \t]+(\w+)/\1/b,bool/' \
|
|
|
|
policy/modules/*/*.if policy/modules/*/*.te policy/support/*.spt
|
2006-01-25 18:30:27 +00:00
|
|
|
|
2006-02-01 13:22:14 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Filesystem labeling
|
|
|
|
#
|
|
|
|
checklabels:
|
2009-08-11 13:01:58 +00:00
|
|
|
@echo "Checking labels on filesystem types: $(fs_names)"
|
2006-08-31 17:28:35 +00:00
|
|
|
@if test -z "$(filesystems)"; then \
|
2006-02-01 13:22:14 +00:00
|
|
|
echo "No filesystems with extended attributes found!" ;\
|
|
|
|
false ;\
|
|
|
|
fi
|
2006-08-31 17:28:35 +00:00
|
|
|
$(verbose) $(SETFILES) -v -n $(fcpath) $(filesystems)
|
2006-02-01 13:22:14 +00:00
|
|
|
|
|
|
|
restorelabels:
|
2009-08-11 13:01:58 +00:00
|
|
|
@echo "Restoring labels on filesystem types: $(fs_names)"
|
2006-08-31 17:28:35 +00:00
|
|
|
@if test -z "$(filesystems)"; then \
|
2006-02-01 13:22:14 +00:00
|
|
|
echo "No filesystems with extended attributes found!" ;\
|
|
|
|
false ;\
|
|
|
|
fi
|
2006-08-31 17:28:35 +00:00
|
|
|
$(verbose) $(SETFILES) -v $(fcpath) $(filesystems)
|
2006-02-01 13:22:14 +00:00
|
|
|
|
|
|
|
relabel:
|
2009-08-11 13:01:58 +00:00
|
|
|
@echo "Relabeling filesystem types: $(fs_names)"
|
2006-08-31 17:28:35 +00:00
|
|
|
@if test -z "$(filesystems)"; then \
|
2006-02-01 13:22:14 +00:00
|
|
|
echo "No filesystems with extended attributes found!" ;\
|
|
|
|
false ;\
|
|
|
|
fi
|
2006-08-31 17:28:35 +00:00
|
|
|
$(verbose) $(SETFILES) $(fcpath) $(filesystems)
|
2006-02-01 13:22:14 +00:00
|
|
|
|
|
|
|
resetlabels:
|
2009-08-11 13:01:58 +00:00
|
|
|
@echo "Resetting labels on filesystem types: $(fs_names)"
|
2006-08-31 17:28:35 +00:00
|
|
|
@if test -z "$(filesystems)"; then \
|
2006-02-01 13:22:14 +00:00
|
|
|
echo "No filesystems with extended attributes found!" ;\
|
|
|
|
false ;\
|
|
|
|
fi
|
2006-08-31 17:28:35 +00:00
|
|
|
$(verbose) $(SETFILES) -F $(fcpath) $(filesystems)
|
2006-02-01 13:22:14 +00:00
|
|
|
|
2005-06-15 15:45:54 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Clean everything
|
|
|
|
#
|
2005-06-07 15:11:47 +00:00
|
|
|
bare: clean
|
2014-01-16 16:25:42 +00:00
|
|
|
$(verbose) rm -f $(polxml)
|
2020-04-06 10:22:05 +00:00
|
|
|
$(verbose) rm -fR $(doctmpdir)
|
2014-01-16 16:25:42 +00:00
|
|
|
$(verbose) rm -f $(tunxml)
|
|
|
|
$(verbose) rm -f $(boolxml)
|
|
|
|
$(verbose) rm -f $(mod_conf)
|
|
|
|
$(verbose) rm -f $(booleans)
|
|
|
|
$(verbose) rm -fR $(htmldir)
|
|
|
|
$(verbose) rm -f $(tags)
|
2006-02-15 17:59:58 +00:00
|
|
|
# don't remove these files if we're given a local root
|
|
|
|
ifndef LOCAL_ROOT
|
2014-01-16 16:25:42 +00:00
|
|
|
$(verbose) rm -f $(support)/*.pyc
|
2017-03-29 15:18:04 +00:00
|
|
|
$(verbose) rm -Rf $(support)/__pycache__/
|
2006-08-31 17:28:35 +00:00
|
|
|
ifneq ($(generated_te),)
|
2014-01-16 16:25:42 +00:00
|
|
|
$(verbose) rm -f $(generated_te)
|
2005-11-22 22:07:12 +00:00
|
|
|
endif
|
2006-08-31 17:28:35 +00:00
|
|
|
ifneq ($(generated_if),)
|
2014-01-16 16:25:42 +00:00
|
|
|
$(verbose) rm -f $(generated_if)
|
2005-11-22 22:07:12 +00:00
|
|
|
endif
|
2006-08-31 17:28:35 +00:00
|
|
|
ifneq ($(generated_fc),)
|
2014-01-16 16:25:42 +00:00
|
|
|
$(verbose) rm -f $(generated_fc)
|
2005-11-22 22:07:12 +00:00
|
|
|
endif
|
2006-02-15 17:59:58 +00:00
|
|
|
endif
|
2005-06-07 15:11:47 +00:00
|
|
|
|
2020-05-28 12:27:55 +00:00
|
|
|
.PHONY: install-src install-appconfig install-headers build-interface-db generate xml conf html bare tags
|