Compare commits
No commits in common. "f398f52e558059f687e7a9260903895da227a26d" and "aa65808edd60cff0bd0550bd2ebf50e2e4b521ac" have entirely different histories.
f398f52e55
...
aa65808edd
67
Makefile
67
Makefile
@ -1,8 +1,5 @@
|
|||||||
|
|
||||||
ignore_file = .git/info/exclude
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
|
|
||||||
help: ## Print the help message
|
help: ## Print the help message
|
||||||
@awk 'BEGIN {FS = ":.*?## "} /^[0-9a-zA-Z._-]+:.*?## / {printf "\033[36m%s\033[0m : %s\n", $$1, $$2}' $(MAKEFILE_LIST) | \
|
@awk 'BEGIN {FS = ":.*?## "} /^[0-9a-zA-Z._-]+:.*?## / {printf "\033[36m%s\033[0m : %s\n", $$1, $$2}' $(MAKEFILE_LIST) | \
|
||||||
sort | \
|
sort | \
|
||||||
@ -23,45 +20,63 @@ queries = queries authqueries
|
|||||||
|
|
||||||
query_formats = $(patsubst %, .dbs/%.txt, $(queries))
|
query_formats = $(patsubst %, .dbs/%.txt, $(queries))
|
||||||
|
|
||||||
dotquery_formats = $(patsubst %, .dbs/%.dot, $(queries))
|
.dbs/:
|
||||||
|
|
||||||
.dbs/: | $(ignore_file)
|
|
||||||
mkdir $@
|
mkdir $@
|
||||||
|
|
||||||
ignored += .dbs/
|
|
||||||
|
|
||||||
$(query_formats): .dbs/%.txt: | .dbs/
|
$(query_formats): .dbs/%.txt: | .dbs/
|
||||||
echo "[ {{name}} ] -- $(basename $(@F)) --> [ {{$(basename $(@F))}} ]" > $@
|
echo "[ {{name}} ] -- $(basename $(@F)) --> [ {{$(basename $(@F))}} ]" > $@
|
||||||
|
|
||||||
$(dotquery_formats): .dbs/%.dot: | .dbs/
|
|
||||||
echo '{{name}} -> {{$(basename $(@F))}} [ label="$(basename $(@F))" ];' > $@
|
|
||||||
|
|
||||||
.PHONY: map
|
.PHONY: map
|
||||||
map: .dbs/network.txt ## Show a network map
|
map: .dbs/network.txt ## Show a network map
|
||||||
$(graph_cmd) < $<
|
$(graph_cmd) < $<
|
||||||
|
|
||||||
.dbs/network.txt: network.rec $(query_formats)
|
.dbs/network.txt: network.rec $(query_formats)
|
||||||
$(RM) $@
|
$(RM) .dbs/network.txt
|
||||||
$(foreach relation, $(queries), \
|
$(foreach relation, $(queries), \
|
||||||
recsel $< -t lxc -e "$(relation) != ''" -p name,$(relation) | recfmt -f .dbs/$(relation).txt >> $@ ;\
|
recsel $< -t lxc -e "$(relation) != ''" -p name,$(relation) | recfmt -f .dbs/$(relation).txt >> $@ ;\
|
||||||
)
|
)
|
||||||
|
|
||||||
.dbs/network.dot: network.rec $(dotquery_formats)
|
########## Man Pages ##########
|
||||||
echo 'digraph network {' > $@
|
|
||||||
$(foreach relation, $(queries), \
|
|
||||||
recsel $< -t lxc -e "$(relation) != ''" -p name,$(relation) | recfmt -f .dbs/$(relation).dot >> $@ ;\
|
|
||||||
)
|
|
||||||
echo '}' >> $@
|
|
||||||
|
|
||||||
network.png: .dbs/network.dot $(ignore_file) $(ignore_file)
|
mandir = $(HOME)/.local/man/man6
|
||||||
dot < $< -T png > $@
|
|
||||||
|
|
||||||
ignored += network.png
|
kralizec_docs != grep -rl "^section:" kralizec
|
||||||
|
kralmans = $(kralizec_docs:kralizec/%/README.md=$(mandir)/%.6)
|
||||||
|
|
||||||
|
$(mandir)/%.6: kralizec/%/README.md
|
||||||
|
lowdown -stman $< > $@
|
||||||
|
|
||||||
|
krov_docs != grep -rl "^section:" krov
|
||||||
|
krovmans = $(krov_docs:krov/%/README.md=$(mandir)/%.6)
|
||||||
|
|
||||||
|
$(mandir)/%.6: krov/%/README.md
|
||||||
|
lowdown -stman $< > $@
|
||||||
|
|
||||||
|
splint_docs != grep -rl "^section:" splintrs
|
||||||
|
splintmans = $(splint_docs:splintrs/%/README.md=$(mandir)/%.6)
|
||||||
|
|
||||||
|
$(mandir)/%.6: splintrs/%/README.md
|
||||||
|
lowdown -stman $< > $@
|
||||||
|
|
||||||
|
setup_docs != grep -rl "^section:" setup
|
||||||
|
setupmans = $(setup_docs:setup/%.md=$(mandir)/%.6)
|
||||||
|
|
||||||
|
$(mandir)/%.6: setup/%.md
|
||||||
|
lowdown -stman $< > $@
|
||||||
|
|
||||||
|
$(mandir):
|
||||||
|
mkdir -p $@
|
||||||
|
|
||||||
|
$(kralmans) $(krovmans) $(splintmans) $(setupmans) :| $(mandir)
|
||||||
|
|
||||||
|
.PHONY: pages
|
||||||
|
pages: $(kralmans) $(krovmans) $(setupmans) $(splintmans)
|
||||||
|
$(info $(kralmans))
|
||||||
|
@test ! $(command -v mandb) || mandb --user-db
|
||||||
|
$(info Open DMZ's man pages with 'man 6 <tab>')
|
||||||
|
|
||||||
##########
|
##########
|
||||||
|
|
||||||
$(ignore_file): $(MAKEFILE_LIST)
|
|
||||||
echo $(ignored) | tr ' ' '\n' > $@
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) -r $(ignored)
|
$(RM) $(kralmans) $(krovmans)
|
||||||
|
$(RM) -r .dbs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user