2020-05-15 11:41:11 +00:00
|
|
|
CWD = $(shell pwd)
|
|
|
|
HTMLDIR = $(CWD)/html
|
|
|
|
PDFDIR = $(CWD)/pdf
|
|
|
|
TMPDIR = $(CWD)/tmp
|
|
|
|
TESTDIR = $(CWD)/../test
|
2015-12-15 20:13:27 +00:00
|
|
|
|
|
|
|
# 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 \
|
2017-06-12 08:31:40 +00:00
|
|
|
cil_infiniband_statements.md \
|
2015-12-15 20:13:27 +00:00
|
|
|
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
|
2018-02-24 04:57:33 +00:00
|
|
|
SED ?= sed
|
|
|
|
|
|
|
|
OS := $(shell uname)
|
|
|
|
ifeq ($(OS), Darwin)
|
|
|
|
SED := gsed
|
|
|
|
endif
|
2014-08-26 12:02:58 +00:00
|
|
|
|
2015-12-15 20:13:27 +00:00
|
|
|
all: html pdf
|
2014-08-26 12:02:58 +00:00
|
|
|
|
2015-12-15 20:13:27 +00:00
|
|
|
$(TMPDIR):
|
|
|
|
mkdir -p $(TMPDIR)
|
2014-08-26 12:02:58 +00:00
|
|
|
|
2015-12-15 20:13:27 +00:00
|
|
|
$(TMPDIR)/%.md: %.md | $(TMPDIR)
|
|
|
|
cp -f $< $(TMPDIR)/
|
|
|
|
@# Substitute markdown links for conversion into PDF links
|
2018-02-24 04:57:33 +00:00
|
|
|
$(SED) -i -re 's:(\[`[^`]*`\])\([^#]*([^\)]):\1\(\2:g' $@
|
2014-08-26 12:02:58 +00:00
|
|
|
|
2015-12-15 20:13:27 +00:00
|
|
|
$(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.
|
2021-02-10 15:58:52 +00:00
|
|
|
$(SED) -i '1i Example Policy\n=========\n```secil' $@
|
2015-12-15 20:13:27 +00:00
|
|
|
echo '```' >> $@
|
2014-08-26 12:02:58 +00:00
|
|
|
|
2015-12-15 20:13:27 +00:00
|
|
|
html: $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil
|
|
|
|
mkdir -p $(HTMLDIR)
|
|
|
|
$(PANDOC) -t html $^ -o $(HTMLDIR)/$(HTML_OUT)
|
2014-08-26 12:02:58 +00:00
|
|
|
|
2015-12-15 20:13:27 +00:00
|
|
|
pdf: $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil
|
|
|
|
mkdir -p $(PDFDIR)
|
|
|
|
$(PANDOC) --standalone --toc $^ -o $(PDFDIR)/$(PDF_OUT)
|
2014-08-26 12:02:58 +00:00
|
|
|
|
2015-03-31 14:17:01 +00:00
|
|
|
clean:
|
2015-12-15 20:13:27 +00:00
|
|
|
rm -rf $(HTMLDIR)
|
|
|
|
rm -rf $(PDFDIR)
|
|
|
|
rm -rf $(TMPDIR)
|