Initial import

This commit is contained in:
Glenn Y. Rolland 2021-07-15 00:38:16 +02:00
commit 0659580291
5 changed files with 118 additions and 0 deletions

4
Makefile Normal file
View file

@ -0,0 +1,4 @@
-include mocodo.mk
-include dot.mk
-include plantuml.mk

27
README.md Normal file
View file

@ -0,0 +1,27 @@
# Makefiles forever
A collection of makefiles for every imaginable use
## Description
* plantuml.makefile — Build [plantuml](https://plantuml.com/) diagrams
* dot.mk — Build [graphviz](https://graphviz.org/) graph diagrams
* mocodo.mk — Build [mocodo](http://mocodo.wingi.net/) entity-relation and logical diagrams
## Usage
* Add this repository as a GIT submodule of your project
git submodule add
* Include needed features in your makefile
-include path/to/makefiles-forever/feature.mk
## Good practices
* Keep task parallelism in mind
* Make all targets available from root makefile
* Do not descend in subdirectories

0
dot.mk Normal file
View file

87
mocodo.mk Normal file
View file

@ -0,0 +1,87 @@
## API
MOCODO_DIRECTORIES=?.
MOCODO_OPT=--colors brewer-6 --shapes verdana
## INTERNALS
MOCODO_MCD_FILES=$(shell find $(IMAGES_DIR) \( -name '*.mcd' ! -name '_*' \))
MOCODO_MCD_MLD=$(patsubst $(IMAGES_DIR)/%.mcd,$(BUILD_IMAGES_DIR)/%.mcd.mld,$(MOCODO_MCD_FILES))
MOCODO_MCD_SVG=$(patsubst $(IMAGES_DIR)/%.mcd,$(BUILD_IMAGES_DIR)/%.mcd.svg,$(MOCODO_MCD_FILES))
MOCODO_MCD_PDF=$(patsubst $(IMAGES_DIR)/%.mcd,$(BUILD_IMAGES_DIR)/%.mcd.pdf,$(MOCODO_MCD_FILES))
MOCODO_MLD_FILES=$(shell find $(IMAGES_DIR) \( -name '*.mld' ! -name '_*' \)) $(MOCODO_MCD_MLD)
MOCODO_MLD_SVG=$(patsubst $(IMAGES_DIR)/%.mld,$(BUILD_IMAGES_DIR)/%.mld.svg,$(MOCODO_MLD_FILES))
MOCODO_MLD_PDF=$(patsubst $(IMAGES_DIR)/%.mld,$(BUILD_IMAGES_DIR)/%.mld.pdf,$(MOCODO_MLD_FILES))
%.mcd.mld: %.mcd
tmp=$$(mktemp -d) \
&& pipenv run mocodo \
$(MOCODO_OPT) \
--mld --no_mcd \
--relations diagram \
--input $< \
--output $${tmp} \
&& mv $${tmp}/*.mld $@ \
&& rm -fr $${tmp} \
&& touch --reference $< $@
%.mcd.svg: %.mcd
tmp=$$(mktemp -d) \
&& pipenv run mocodo \
$(MOCODO_OPT) \
--mld --no_mcd \
--relations diagram \
--input $< \
--output $${tmp} \
&& mv $${tmp}/*.svg $@ \
&& rm -fr $${tmp} \
&& touch --reference $< $@
%.mld.svg: %.mld
tmp=$$(mktemp -d) \
&& pipenv run mocodo \
$(MOCODO_OPT) \
--input $< \
--output $${tmp} \
&& mv $${tmp}/*.svg $@ \
&& rm -fr $${tmp} \
&& touch --reference $< $@
%.mld.pdf: %.mld.svg
inkscape \
--export-type=pdf \
--export-overwrite \
--export-filename $@ \
$<
%.mcd.pdf: %.mcd.svg
inkscape \
--export-type=pdf \
--export-overwrite \
--export-filename $@ \
$<
mocodo-mcd-mld: $(MOCODO_MCD_MLD)
mocodo-mcd-svg: $(MOCODO_MCD_SVG)
mocodo-mld-svg: $(MOCODO_MLD_SVG)
mocodo-mcd-pdf: $(MOCODO_MCD_PDF)
mocodo-mld-pdf: $(MOCODO_MLD_PDF)
mocodo-svg: mocodo-mcd-svg mocodo-mld-svg
mocodo-pdf: mocodo-mcd-pdf mocodo-mld-pdf
mocodo-clean-mld:
rm -f $(MOCODO_MCD_MLD)
mocodo-clean-svg:
rm -f $(MOCODO_MCD_SVG) $(MOCODO_MLD_SVG)
mocodo-clean-pdf:
rm -f $(MOCODO_MCD_PDF) $(MOCODO_MLD_PDF)
mocodo-clean: mocodo-clean-mld mocodo-clean-svg mocodo-clean-pdf

0
plantuml.mk Normal file
View file