mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-22 05:59:58 +00:00
4ad0abd983
Environment variable TMPDIR may be already set for the user building and this could be equal to $XDG_RUNTIME_DIR or /tmp which are existing directories. Then when running 'make clean', there are unintended side effects: rm -rf /run/user/1000 rm: cannot remove '/run/user/1000/dconf/user': Permission denied rm: cannot remove '/run/user/1000/systemd': Permission denied rm: cannot remove '/run/user/1000/gnupg': Permission denied rm: cannot remove '/run/user/1000/dbus-1': Is a directory rm: cannot remove '/run/user/1000/inaccessible': Permission denied make[1]: *** [Makefile:68: clean] Error 1 Fix by always setting the variable. Signed-off-by: Topi Miettinen <toiwoton@gmail.com> Suggested-by: Petr Lautrbach <plautrba@redhat.com> Acked-by: Petr Lautrbach <plautrba@redhat.com>
69 lines
1.7 KiB
Makefile
69 lines
1.7 KiB
Makefile
CWD = $(shell pwd)
|
|
HTMLDIR = $(CWD)/html
|
|
PDFDIR = $(CWD)/pdf
|
|
TMPDIR = $(CWD)/tmp
|
|
TESTDIR = $(CWD)/../test
|
|
|
|
# All the markdown files that make up the guide:
|
|
FILE_LIST ?= cil_introduction.md \
|
|
cil_reference_guide.md \
|
|
cil_access_vector_rules.md \
|
|
cil_call_macro_statements.md \
|
|
cil_class_and_permission_statements.md \
|
|
cil_conditional_statements.md \
|
|
cil_constraint_statements.md \
|
|
cil_container_statements.md \
|
|
cil_context_statement.md \
|
|
cil_default_object_statements.md \
|
|
cil_file_labeling_statements.md \
|
|
cil_mls_labeling_statements.md \
|
|
cil_network_labeling_statements.md \
|
|
cil_policy_config_statements.md \
|
|
cil_role_statements.md \
|
|
cil_sid_statements.md \
|
|
cil_type_statements.md \
|
|
cil_user_statements.md \
|
|
cil_infiniband_statements.md \
|
|
cil_xen_statements.md
|
|
|
|
PANDOC_FILE_LIST = $(addprefix $(TMPDIR)/,$(FILE_LIST))
|
|
|
|
PDF_OUT=CIL_Reference_Guide.pdf
|
|
HTML_OUT=CIL_Reference_Guide.html
|
|
PANDOC = pandoc
|
|
SED ?= sed
|
|
|
|
OS := $(shell uname)
|
|
ifeq ($(OS), Darwin)
|
|
SED := gsed
|
|
endif
|
|
|
|
all: html pdf
|
|
|
|
$(TMPDIR):
|
|
mkdir -p $(TMPDIR)
|
|
|
|
$(TMPDIR)/%.md: %.md | $(TMPDIR)
|
|
cp -f $< $(TMPDIR)/
|
|
@# Substitute markdown links for conversion into PDF links
|
|
$(SED) -i -re 's:(\[`[^`]*`\])\([^#]*([^\)]):\1\(\2:g' $@
|
|
|
|
$(TMPDIR)/policy.cil: $(TESTDIR)/policy.cil
|
|
cp -f $< $@
|
|
@# add a title for the TOC to policy.cil. This is needed to play nicely with the PDF conversion.
|
|
$(SED) -i '1i Example Policy\n=========\n```' $@
|
|
echo '```' >> $@
|
|
|
|
html: $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil
|
|
mkdir -p $(HTMLDIR)
|
|
$(PANDOC) -t html $^ -o $(HTMLDIR)/$(HTML_OUT)
|
|
|
|
pdf: $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil
|
|
mkdir -p $(PDFDIR)
|
|
$(PANDOC) --standalone --toc $^ -o $(PDFDIR)/$(PDF_OUT)
|
|
|
|
clean:
|
|
rm -rf $(HTMLDIR)
|
|
rm -rf $(PDFDIR)
|
|
rm -rf $(TMPDIR)
|