generate graphviz png
This commit is contained in:
parent
cd9bdb80c1
commit
f398f52e55
33
Makefile
33
Makefile
@ -1,5 +1,8 @@
|
|||||||
.PHONY: help
|
|
||||||
|
|
||||||
|
ignore_file = .git/info/exclude
|
||||||
|
|
||||||
|
|
||||||
|
.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 | \
|
||||||
@ -20,23 +23,45 @@ queries = queries authqueries
|
|||||||
|
|
||||||
query_formats = $(patsubst %, .dbs/%.txt, $(queries))
|
query_formats = $(patsubst %, .dbs/%.txt, $(queries))
|
||||||
|
|
||||||
.dbs/:
|
dotquery_formats = $(patsubst %, .dbs/%.dot, $(queries))
|
||||||
|
|
||||||
|
.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) .dbs/network.txt
|
$(RM) $@
|
||||||
$(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)
|
||||||
|
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)
|
||||||
|
dot < $< -T png > $@
|
||||||
|
|
||||||
|
ignored += network.png
|
||||||
|
|
||||||
##########
|
##########
|
||||||
|
|
||||||
|
$(ignore_file): $(MAKEFILE_LIST)
|
||||||
|
echo $(ignored) | tr ' ' '\n' > $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) -r .dbs
|
$(RM) -r $(ignored)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user