]>
Commit | Line | Data |
---|---|---|
88d14a22 CP |
1 | # |
2 | # Makefile for the security policy. | |
3 | # | |
4 | # Targets: | |
5 | # | |
6 | # install - compile and install the policy configuration, and context files. | |
7 | # load - compile, install, and load the policy configuration. | |
8 | # reload - compile, install, and load/reload the policy configuration. | |
9 | # relabel - relabel filesystems based on the file contexts configuration. | |
10 | # checklabels - check filesystems against the file context configuration | |
11 | # restorelabels - check filesystems against the file context configuration | |
12 | # and restore the label of files with incorrect labels | |
13 | # policy - compile the policy configuration locally for testing/development. | |
14 | # | |
15 | # The default target is 'policy'. | |
16 | # | |
b4cd1533 | 17 | # |
8e0ef1f9 | 18 | # Please see build.conf for policy build options. |
b4cd1533 CP |
19 | # |
20 | ||
b4cd1533 CP |
21 | ######################################## |
22 | # | |
b67488e3 | 23 | # NO OPTIONS BELOW HERE |
b4cd1533 CP |
24 | # |
25 | ||
8e0ef1f9 CP |
26 | include build.conf |
27 | ||
120988c4 CP |
28 | # refpolicy version |
29 | VERSION = $(shell cat VERSION) | |
30 | ||
b4cd1533 | 31 | # executable paths |
120988c4 CP |
32 | BINDIR := /usr/bin |
33 | SBINDIR := /usr/sbin | |
40a1f3db | 34 | CHECKPOLICY := $(BINDIR)/checkpolicy |
fb0a3a98 | 35 | CHECKMODULE := $(BINDIR)/checkmodule |
c767b14c | 36 | SEMODULE := $(SBINDIR)/semodule |
fb0a3a98 | 37 | SEMOD_PKG := $(BINDIR)/semodule_package |
547283e2 | 38 | LOADPOLICY := $(SBINDIR)/load_policy |
b4cd1533 | 39 | SETFILES := $(SBINDIR)/setfiles |
1beba1c6 | 40 | GENHOMEDIRCON := $(SBINDIR)/genhomedircon |
fb0a3a98 | 41 | XMLLINT := $(BINDIR)/xmllint |
8df65f13 | 42 | SECHECK := $(BINDIR)/sechecker |
0447352a | 43 | |
c7b41e95 CP |
44 | CFLAGS := -Wall |
45 | ||
fb0a3a98 | 46 | # policy source layout |
c04f2abe CP |
47 | POLDIR := policy |
48 | MODDIR := $(POLDIR)/modules | |
49 | FLASKDIR := $(POLDIR)/flask | |
50 | SECCLASS := $(FLASKDIR)/security_classes | |
51 | ISIDS := $(FLASKDIR)/initial_sids | |
52 | AVS := $(FLASKDIR)/access_vectors | |
fb0a3a98 CP |
53 | |
54 | # policy building support tools | |
3a80ec29 | 55 | SUPPORT := support |
95db4228 | 56 | GENXML := $(SUPPORT)/segenxml.py |
3a80ec29 | 57 | GENDOC := $(SUPPORT)/sedoctool.py |
c04f2abe | 58 | GENPERM := $(SUPPORT)/genclassperms.py |
254bbc7b | 59 | FCSORT := $(SUPPORT)/fc_sort |
84eb353c | 60 | SETTUN := $(SUPPORT)/set_tunables |
3a80ec29 | 61 | |
fb0a3a98 CP |
62 | # documentation paths |
63 | DOCS = doc | |
64 | POLXML = $(DOCS)/policy.xml | |
65 | XMLDTD = $(DOCS)/policy.dtd | |
66 | LAYERXML = metadata.xml | |
67 | HTMLDIR = $(DOCS)/html | |
68 | DOCTEMPLATE = $(DOCS)/templates | |
5bd1a703 | 69 | DOCFILES = $(DOCS)/Makefile.example $(addprefix $(DOCS)/,example.te example.if example.fc) |
fb0a3a98 CP |
70 | |
71 | # config file paths | |
120988c4 CP |
72 | GLOBALTUN = $(POLDIR)/global_tunables |
73 | GLOBALBOOL = $(POLDIR)/global_booleans | |
74 | MOD_CONF = $(POLDIR)/modules.conf | |
75 | TUNABLES = $(POLDIR)/tunables.conf | |
76 | BOOLEANS = $(POLDIR)/booleans.conf | |
77 | ROLEMAP = $(POLDIR)/rolemap | |
fb0a3a98 CP |
78 | |
79 | # install paths | |
120988c4 CP |
80 | PKGNAME ?= refpolicy-$(VERSION) |
81 | PREFIX = $(DESTDIR)/usr | |
82 | TOPDIR = $(DESTDIR)/etc/selinux | |
83 | INSTALLDIR = $(TOPDIR)/$(NAME) | |
84 | SRCPATH = $(INSTALLDIR)/src | |
85 | USERPATH = $(INSTALLDIR)/users | |
86 | CONTEXTPATH = $(INSTALLDIR)/contexts | |
87 | FCPATH = $(CONTEXTPATH)/files/file_contexts | |
88 | SHAREDIR = $(PREFIX)/share/selinux | |
89 | MODPKGDIR = $(SHAREDIR)/$(NAME) | |
90 | HEADERDIR = $(SHAREDIR)/refpolicy/include | |
91 | DOCSDIR = $(PREFIX)/share/doc/$(PKGNAME) | |
c767b14c CP |
92 | |
93 | # compile strict policy if requested. | |
94 | ifneq ($(findstring strict,$(TYPE)),) | |
3f026a90 | 95 | M4PARAM += -D strict_policy |
c767b14c CP |
96 | endif |
97 | ||
98 | # compile targeted policy if requested. | |
99 | ifneq ($(findstring targeted,$(TYPE)),) | |
3f026a90 | 100 | M4PARAM += -D targeted_policy |
c767b14c | 101 | endif |
b4cd1533 | 102 | |
134191be | 103 | # enable MLS if requested. |
a0824843 | 104 | ifneq ($(findstring -mls,$(TYPE)),) |
3f026a90 CP |
105 | M4PARAM += -D enable_mls |
106 | CHECKPOLICY += -M | |
107 | CHECKMODULE += -M | |
134191be CP |
108 | endif |
109 | ||
a0824843 CP |
110 | # enable MLS if MCS requested. |
111 | ifneq ($(findstring -mcs,$(TYPE)),) | |
3f026a90 CP |
112 | M4PARAM += -D enable_mcs |
113 | CHECKPOLICY += -M | |
114 | CHECKMODULE += -M | |
b67488e3 CP |
115 | endif |
116 | ||
25a0c61f CP |
117 | # enable distribution-specific policy |
118 | ifneq ($(DISTRO),) | |
3f026a90 | 119 | M4PARAM += -D distro_$(DISTRO) |
25a0c61f CP |
120 | endif |
121 | ||
b07eaef9 CP |
122 | # enable polyinstantiation |
123 | ifeq ($(POLY),y) | |
3f026a90 | 124 | M4PARAM += -D enable_polyinstantiation |
b07eaef9 CP |
125 | endif |
126 | ||
b67488e3 | 127 | ifneq ($(OUTPUT_POLICY),) |
3f026a90 | 128 | CHECKPOLICY += -c $(OUTPUT_POLICY) |
b67488e3 CP |
129 | endif |
130 | ||
3f026a90 CP |
131 | # if not set, use the type as the name. |
132 | NAME ?= $(TYPE) | |
134191be | 133 | |
142e9f40 | 134 | ifeq ($(DIRECT_INITRC),y) |
3f026a90 | 135 | M4PARAM += -D direct_sysadm_daemon |
142e9f40 CP |
136 | endif |
137 | ||
9b3756bf CP |
138 | ifeq ($(QUIET),y) |
139 | verbose = @ | |
140 | endif | |
141 | ||
3f026a90 | 142 | M4PARAM += -D hide_broken_symptoms |
ee7f66b0 | 143 | |
37227dcd CP |
144 | # we need exuberant ctags; unfortunately it is named |
145 | # differently on different distros | |
146 | ifeq ($(DISTRO),debian) | |
147 | CTAGS := ctags-exuberant | |
148 | endif | |
149 | ||
150 | ifeq ($(DISTRO),gentoo) | |
151 | CTAGS := exuberant-ctags | |
152 | endif | |
153 | ||
a4fae7fa | 154 | CTAGS ?= ctags |
37227dcd | 155 | |
b4cd1533 | 156 | # determine the policy version and current kernel version if possible |
134191be | 157 | PV := $(shell $(CHECKPOLICY) -V |cut -f 1 -d ' ') |
b4cd1533 CP |
158 | KV := $(shell cat /selinux/policyvers) |
159 | ||
160 | # dont print version warnings if we are unable to determine | |
161 | # the currently running kernel's policy version | |
162 | ifeq ($(KV),) | |
134191be | 163 | KV := $(PV) |
b4cd1533 CP |
164 | endif |
165 | ||
fb0a3a98 | 166 | M4SUPPORT = $(wildcard $(POLDIR)/support/*.spt) |
0fbe15dc | 167 | |
c0e4fe2c | 168 | APPCONF := config/appconfig-$(TYPE) |
c9a26b3e | 169 | APPDIR := $(CONTEXTPATH) |
049e11af | 170 | APPFILES := $(addprefix $(APPDIR)/,default_contexts default_type initrc_context failsafe_context userhelper_context removable_context dbus_contexts customizable_types) $(CONTEXTPATH)/files/media |
2926f9c7 | 171 | CONTEXTFILES += $(wildcard $(APPCONF)/*_context*) $(APPCONF)/media |
bdb2fac0 | 172 | USER_FILES := $(POLDIR)/users |
c9a26b3e | 173 | |
57869a68 | 174 | ALL_LAYERS := $(filter-out $(MODDIR)/CVS,$(shell find $(wildcard $(MODDIR)/*) -maxdepth 0 -type d)) |
e12e5738 CP |
175 | |
176 | GENERATED_TE := $(basename $(foreach dir,$(ALL_LAYERS),$(wildcard $(dir)/*.te.in))) | |
177 | GENERATED_IF := $(basename $(foreach dir,$(ALL_LAYERS),$(wildcard $(dir)/*.if.in))) | |
178 | GENERATED_FC := $(basename $(foreach dir,$(ALL_LAYERS),$(wildcard $(dir)/*.fc.in))) | |
179 | ||
8ae194f6 CP |
180 | # sort here since it removes duplicates, which can happen |
181 | # when a generated file is already generated | |
182 | DETECTED_MODS := $(sort $(foreach dir,$(ALL_LAYERS),$(wildcard $(dir)/*.te)) $(GENERATED_TE)) | |
19db6ba5 | 183 | |
fb0a3a98 | 184 | # modules.conf setting for base module |
e8b3e30a | 185 | MODBASE := base |
fb0a3a98 | 186 | |
e0a9001b | 187 | # modules.conf setting for loadable module |
e8b3e30a | 188 | MODMOD := module |
fb0a3a98 | 189 | |
e0a9001b CP |
190 | # modules.conf setting for unused module |
191 | MODUNUSED := off | |
192 | ||
fb0a3a98 | 193 | # extract settings from modules.conf |
c767b14c CP |
194 | BASE_MODS := $(addsuffix .te,$(shell awk '/^[[:blank:]]*[[:alpha:]]/{ if ($$3 == "$(MODBASE)") print $$1 }' $(MOD_CONF) 2> /dev/null)) |
195 | MOD_MODS := $(addsuffix .te,$(shell awk '/^[[:blank:]]*[[:alpha:]]/{ if ($$3 == "$(MODMOD)") print $$1 }' $(MOD_CONF) 2> /dev/null)) | |
e0a9001b | 196 | OFF_MODS := $(addsuffix .te,$(shell awk '/^[[:blank:]]*[[:alpha:]]/{ if ($$3 == "$(MODUNUSED)") print $$1 }' $(MOD_CONF) 2> /dev/null)) |
712566ee | 197 | |
120988c4 CP |
198 | # filesystems to be labeled |
199 | FILESYSTEMS = $(shell mount | grep -v "context=" | egrep -v '\((|.*,)bind(,.*|)\)' | awk '/(ext[23]| xfs| jfs).*rw/{print $$3}';) | |
200 | ||
4ace0fa5 CP |
201 | ######################################## |
202 | # | |
203 | # Functions | |
204 | # | |
205 | ||
206 | # parse-rolemap modulename,outputfile | |
207 | define parse-rolemap | |
9b3756bf | 208 | $(verbose) m4 $(M4PARAM) $(ROLEMAP) | \ |
4ace0fa5 CP |
209 | awk '/^[[:blank:]]*[A-Za-z]/{ print "gen_require(type " $$3 "; role " $$1 ";)\n$1_per_userdomain_template(" $$2 "," $$3 "," $$1 ")" }' >> $2 |
210 | endef | |
211 | ||
212 | # peruser-expansion modulename,outputfile | |
213 | define peruser-expansion | |
9b3756bf | 214 | $(verbose) echo "ifdef(\`""$1""_per_userdomain_template',\`" > $2 |
4ace0fa5 | 215 | $(call parse-rolemap,$1,$2) |
9b3756bf | 216 | $(verbose) echo "')" >> $2 |
4ace0fa5 CP |
217 | endef |
218 | ||
b4cd1533 CP |
219 | ######################################## |
220 | # | |
fb0a3a98 | 221 | # Load appropriate rules |
b4cd1533 | 222 | # |
b4cd1533 | 223 | |
fb0a3a98 CP |
224 | ifeq ($(MONOLITHIC),y) |
225 | include Rules.monolithic | |
226 | else | |
227 | include Rules.modular | |
b4cd1533 | 228 | endif |
b4cd1533 | 229 | |
88d14a22 CP |
230 | ######################################## |
231 | # | |
fb0a3a98 | 232 | # Generated files |
b4cd1533 | 233 | # |
f2e4ab3a | 234 | $(MODDIR)/kernel/corenetwork.if: $(MODDIR)/kernel/corenetwork.if.m4 $(MODDIR)/kernel/corenetwork.if.in |
61bbe531 CP |
235 | @echo "#" > $@ |
236 | @echo "# This is a generated file! Instead of modifying this file, the" >> $@ | |
237 | @echo "# $(notdir $@).in or $(notdir $@).m4 file should be modified." >> $@ | |
238 | @echo "#" >> $@ | |
9b3756bf CP |
239 | $(verbose) cat $(MODDIR)/kernel/corenetwork.if.in >> $@ |
240 | $(verbose) egrep "^[[:blank:]]*network_(interface|node|port)\(.*\)" $(@:.if=.te).in \ | |
cf6141a7 | 241 | | m4 -D self_contained_policy $(M4PARAM) $(MODDIR)/kernel/corenetwork.if.m4 - \ |
f2e4ab3a | 242 | | sed -e 's/dollarsone/\$$1/g' -e 's/dollarszero/\$$0/g' >> $@ |
f2e4ab3a CP |
243 | |
244 | $(MODDIR)/kernel/corenetwork.te: $(MODDIR)/kernel/corenetwork.te.m4 $(MODDIR)/kernel/corenetwork.te.in | |
61bbe531 CP |
245 | @echo "#" > $@ |
246 | @echo "# This is a generated file! Instead of modifying this file, the" >> $@ | |
247 | @echo "# $(notdir $@).in or $(notdir $@).m4 file should be modified." >> $@ | |
248 | @echo "#" >> $@ | |
9b3756bf | 249 | $(verbose) m4 -D self_contained_policy $(M4PARAM) $^ \ |
61bbe531 | 250 | | sed -e 's/dollarsone/\$$1/g' -e 's/dollarszero/\$$0/g' >> $@ |
f2e4ab3a | 251 | |
84eb353c CP |
252 | ######################################## |
253 | # | |
254 | # Create config files | |
255 | # | |
4f9f30c8 | 256 | conf: $(MOD_CONF) $(BOOLEANS) $(GENERATED_TE) $(GENERATED_IF) $(GENERATED_FC) |
d2d6c8ce | 257 | |
4f9f30c8 CP |
258 | $(MOD_CONF) $(BOOLEANS): $(POLXML) |
259 | @echo "Updating $(MOD_CONF) and $(BOOLEANS)" | |
9b3756bf | 260 | $(verbose) cd $(DOCS) && ../$(GENDOC) -t ../$(BOOLEANS) -m ../$(MOD_CONF) -x ../$(POLXML) |
84eb353c | 261 | |
6d314fd3 CP |
262 | ######################################## |
263 | # | |
264 | # Documentation generation | |
265 | # | |
266 | ||
d2d6c8ce | 267 | # minimal dependencies here, because we don't want to rebuild |
84eb353c | 268 | # this and its dependents every time the dependencies |
19db6ba5 CP |
269 | # change. Also use all .if files here, rather then just the |
270 | # enabled modules. | |
d233bfce | 271 | $(POLXML): $(DETECTED_MODS:.te=.if) $(foreach dir,$(ALL_LAYERS),$(dir)/$(LAYERXML)) |
88c72f44 | 272 | @echo "Creating $@" |
84eb353c | 273 | @mkdir -p tmp |
9b3756bf CP |
274 | $(verbose) echo '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>' > $@ |
275 | $(verbose) echo '<!DOCTYPE policy SYSTEM "$(notdir $(XMLDTD))">' >> $@ | |
276 | $(verbose) $(GENXML) -w -m $(LAYERXML) -t $(GLOBALTUN) -b $(GLOBALBOOL) $(ALL_LAYERS) >> $@ | |
277 | $(verbose) if test -x $(XMLLINT) && test -f $(XMLDTD); then \ | |
0447352a | 278 | $(XMLLINT) --noout --dtdvalid $(XMLDTD) $@ ;\ |
004db90d | 279 | fi |
6d314fd3 | 280 | |
120988c4 | 281 | html tmp/html: $(POLXML) |
2de03f30 | 282 | @echo "Building html interface reference documentation in $(HTMLDIR)" |
20030ef5 | 283 | @mkdir -p $(HTMLDIR) |
9b3756bf CP |
284 | $(verbose) cd $(DOCS) && ../$(GENDOC) -d ../$(HTMLDIR) -T ../$(DOCTEMPLATE) -x ../$(POLXML) |
285 | $(verbose) cp $(DOCTEMPLATE)/*.css $(HTMLDIR) | |
120988c4 | 286 | @touch tmp/html |
20030ef5 | 287 | |
c9a26b3e CP |
288 | ######################################## |
289 | # | |
290 | # Runtime binary policy patching of users | |
291 | # | |
1fb83a76 | 292 | $(USERPATH)/system.users: $(M4SUPPORT) tmp/generated_definitions.conf $(USER_FILES) |
c9a26b3e CP |
293 | @mkdir -p $(USERPATH) |
294 | @echo "Installing system.users" | |
295 | @echo "# " > tmp/system.users | |
296 | @echo "# Do not edit this file. " >> tmp/system.users | |
297 | @echo "# This file is replaced on reinstalls of this policy." >> tmp/system.users | |
298 | @echo "# Please edit local.users to make local changes." >> tmp/system.users | |
299 | @echo "#" >> tmp/system.users | |
9b3756bf | 300 | $(verbose) m4 -D self_contained_policy $(M4PARAM) $^ | sed -r -e 's/^[[:blank:]]+//' \ |
7dca64fa | 301 | -e '/^[[:blank:]]*($$|#)/d' >> tmp/system.users |
9b3756bf | 302 | $(verbose) install -m 644 tmp/system.users $@ |
c9a26b3e | 303 | |
1beba1c6 | 304 | $(USERPATH)/local.users: config/local.users |
c9a26b3e CP |
305 | @mkdir -p $(USERPATH) |
306 | @echo "Installing local.users" | |
9b3756bf | 307 | $(verbose) install -b -m 644 $< $@ |
c9a26b3e CP |
308 | |
309 | ######################################## | |
310 | # | |
311 | # Appconfig files | |
312 | # | |
313 | install-appconfig: $(APPFILES) | |
314 | ||
4f9f30c8 | 315 | $(INSTALLDIR)/booleans: $(BOOLEANS) |
1beba1c6 | 316 | @mkdir -p $(INSTALLDIR) |
9b3756bf | 317 | $(verbose) sed -r -e 's/false/0/g' -e 's/true/1/g' \ |
7dca64fa | 318 | -e '/^[[:blank:]]*($$|#)/d' $(BOOLEANS) | sort > tmp/booleans |
9b3756bf | 319 | $(verbose) install -m 644 tmp/booleans $@ |
1beba1c6 | 320 | |
2926f9c7 | 321 | $(CONTEXTPATH)/files/media: $(APPCONF)/media |
1beba1c6 | 322 | @mkdir -p $(CONTEXTPATH)/files/ |
9b3756bf | 323 | $(verbose) install -m 644 $< $@ |
c9a26b3e | 324 | |
2926f9c7 | 325 | $(APPDIR)/default_contexts: $(APPCONF)/default_contexts |
1beba1c6 | 326 | @mkdir -p $(APPDIR) |
9b3756bf | 327 | $(verbose) install -m 644 $< $@ |
c9a26b3e | 328 | |
2926f9c7 | 329 | $(APPDIR)/removable_context: $(APPCONF)/removable_context |
1beba1c6 | 330 | @mkdir -p $(APPDIR) |
9b3756bf | 331 | $(verbose) install -m 644 $< $@ |
c9a26b3e | 332 | |
2926f9c7 | 333 | $(APPDIR)/default_type: $(APPCONF)/default_type |
1beba1c6 | 334 | @mkdir -p $(APPDIR) |
9b3756bf | 335 | $(verbose) install -m 644 $< $@ |
c9a26b3e | 336 | |
2926f9c7 | 337 | $(APPDIR)/userhelper_context: $(APPCONF)/userhelper_context |
1beba1c6 | 338 | @mkdir -p $(APPDIR) |
9b3756bf | 339 | $(verbose) install -m 644 $< $@ |
c9a26b3e | 340 | |
2926f9c7 | 341 | $(APPDIR)/initrc_context: $(APPCONF)/initrc_context |
1beba1c6 | 342 | @mkdir -p $(APPDIR) |
9b3756bf | 343 | $(verbose) install -m 644 $< $@ |
c9a26b3e | 344 | |
2926f9c7 | 345 | $(APPDIR)/failsafe_context: $(APPCONF)/failsafe_context |
1beba1c6 | 346 | @mkdir -p $(APPDIR) |
9b3756bf | 347 | $(verbose) install -m 644 $< $@ |
c9a26b3e | 348 | |
2926f9c7 | 349 | $(APPDIR)/dbus_contexts: $(APPCONF)/dbus_contexts |
1beba1c6 | 350 | @mkdir -p $(APPDIR) |
9b3756bf | 351 | $(verbose) install -m 644 $< $@ |
c9a26b3e | 352 | |
2926f9c7 | 353 | $(APPDIR)/users/root: $(APPCONF)/root_default_contexts |
1beba1c6 | 354 | @mkdir -p $(APPDIR)/users |
9b3756bf CP |
355 | $(verbose) install -m 644 $< $@ |
356 | ||
357 | ######################################## | |
358 | # | |
359 | # Install policy headers | |
360 | # | |
120988c4 CP |
361 | install-headers: $(DETECTED_MODS:.te=.if) $(ROLEMAP) $(M4SUPPORT) |
362 | @mkdir -p $(HEADERDIR) | |
363 | @echo "Installing policy headers" | |
9b3756bf CP |
364 | $(verbose) install -m 644 $^ $(HEADERDIR) |
365 | $(verbose) $(GENPERM) $(AVS) $(SECCLASS) > $(HEADERDIR)/all_perms.spt | |
c9a26b3e | 366 | |
120988c4 CP |
367 | ######################################## |
368 | # | |
369 | # Install policy documentation | |
370 | # | |
5bd1a703 | 371 | install-docs: $(DOCFILES) build.conf tmp/html |
120988c4 CP |
372 | @mkdir -p $(DOCSDIR)/html |
373 | @echo "Installing policy documentation" | |
5bd1a703 | 374 | $(verbose) install -m 644 $(DOCFILES) $(DOCSDIR) |
120988c4 CP |
375 | $(verbose) install -m 644 build.conf $(DOCSDIR)/build.conf.example |
376 | $(verbose) install -m 644 $(wildcard $(HTMLDIR)/*) $(DOCSDIR)/html | |
377 | ||
c592e52e CP |
378 | ######################################## |
379 | # | |
380 | # Install policy sources | |
381 | # | |
382 | install-src: | |
383 | rm -rf $(SRCPATH)/policy.old | |
384 | -mv $(SRCPATH)/policy $(SRCPATH)/policy.old | |
385 | mkdir -p $(SRCPATH)/policy | |
386 | cp -R . $(SRCPATH)/policy | |
387 | ||
37227dcd CP |
388 | ######################################## |
389 | # | |
390 | # Generate tags file | |
391 | # | |
392 | tags: | |
393 | @($(CTAGS) --version | grep -q Exuberant) || (echo ERROR: Need exuberant-ctags to function!; exit 1) | |
394 | @LC_ALL=C $(CTAGS) --langdef=te --langmap=te:..te.if.spt \ | |
395 | --regex-te='/^type[ \t]+(\w+)(,|;)/\1/t,type/' \ | |
396 | --regex-te='/^typealias[ \t]+\w+[ \t+]+alias[ \t]+(\w+);/\1/t,type/' \ | |
397 | --regex-te='/^attribute[ \t]+(\w+);/\1/a,attribute/' \ | |
398 | --regex-te='/^[ \t]*define\(`(\w+)/\1/d,define/' \ | |
399 | --regex-te='/^[ \t]*interface\(`(\w+)/\1/i,interface/' \ | |
400 | --regex-te='/^[ \t]*bool[ \t]+(\w+)/\1/b,bool/' policy/modules/*/*.{if,te} policy/support/*.spt | |
401 | ||
120988c4 CP |
402 | ######################################## |
403 | # | |
404 | # Filesystem labeling | |
405 | # | |
406 | checklabels: | |
407 | @echo "Checking labels on filesystem types: ext2 ext3 xfs jfs" | |
408 | @if test -z "$(FILESYSTEMS)"; then \ | |
409 | echo "No filesystems with extended attributes found!" ;\ | |
410 | false ;\ | |
411 | fi | |
412 | $(verbose) $(SETFILES) -v -n $(FCPATH) $(FILESYSTEMS) | |
413 | ||
414 | restorelabels: | |
415 | @echo "Restoring labels on filesystem types: ext2 ext3 xfs jfs" | |
416 | @if test -z "$(FILESYSTEMS)"; then \ | |
417 | echo "No filesystems with extended attributes found!" ;\ | |
418 | false ;\ | |
419 | fi | |
420 | $(verbose) $(SETFILES) -v $(FCPATH) $(FILESYSTEMS) | |
421 | ||
422 | relabel: | |
423 | @echo "Relabeling filesystem types: ext2 ext3 xfs jfs" | |
424 | @if test -z "$(FILESYSTEMS)"; then \ | |
425 | echo "No filesystems with extended attributes found!" ;\ | |
426 | false ;\ | |
427 | fi | |
428 | $(verbose) $(SETFILES) $(FCPATH) $(FILESYSTEMS) | |
429 | ||
430 | resetlabels: | |
431 | @echo "Resetting labels on filesystem types: ext2 ext3 xfs jfs" | |
432 | @if test -z "$(FILESYSTEMS)"; then \ | |
433 | echo "No filesystems with extended attributes found!" ;\ | |
434 | false ;\ | |
435 | fi | |
436 | $(verbose) $(SETFILES) -F $(FCPATH) $(FILESYSTEMS) | |
437 | ||
102a59ba CP |
438 | ######################################## |
439 | # | |
440 | # Clean everything | |
441 | # | |
0fbe15dc | 442 | bare: clean |
12b559a4 | 443 | rm -f $(POLXML) |
254bbc7b CP |
444 | rm -f $(SUPPORT)/*.pyc |
445 | rm -f $(FCSORT) | |
19db6ba5 | 446 | rm -f $(MOD_CONF) |
4f9f30c8 | 447 | rm -f $(BOOLEANS) |
20030ef5 | 448 | rm -fR $(HTMLDIR) |
37227dcd | 449 | rm -f tags |
c767b14c CP |
450 | ifneq ($(GENERATED_TE),) |
451 | rm -f $(GENERATED_TE) | |
452 | endif | |
453 | ifneq ($(GENERATED_IF),) | |
454 | rm -f $(GENERATED_IF) | |
455 | endif | |
456 | ifneq ($(GENERATED_FC),) | |
457 | rm -f $(GENERATED_FC) | |
458 | endif | |
0fbe15dc | 459 | |
37227dcd | 460 | .PHONY: install-src install-appconfig conf html bare tags |
b8c79823 CP |
461 | .SUFFIXES: |
462 | .SUFFIXES: .c |