commit 0659580291b18efbf68ff3fa6faaa1a4e106a799 Author: Glenn Y. Rolland Date: Thu Jul 15 00:38:16 2021 +0200 Initial import diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f08136c --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ + +-include mocodo.mk +-include dot.mk +-include plantuml.mk diff --git a/README.md b/README.md new file mode 100644 index 0000000..7bac89a --- /dev/null +++ b/README.md @@ -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 + + diff --git a/dot.mk b/dot.mk new file mode 100644 index 0000000..e69de29 diff --git a/mocodo.mk b/mocodo.mk new file mode 100644 index 0000000..cb93495 --- /dev/null +++ b/mocodo.mk @@ -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 + diff --git a/plantuml.mk b/plantuml.mk new file mode 100644 index 0000000..e69de29