Compare commits

..

No commits in common. "f95d28d72ef0ed10f6ec80639246172edfe25fb8" and "a9a2a536454775fc9fc811bbc19a871e8e4764d4" have entirely different histories.

6 changed files with 54 additions and 317 deletions

View file

@ -1,35 +1,4 @@
# Usage example
##
## Local configuration
##
##
## Configuration of input variables for libraries
##
PLANTUML_SRC_DIR = $(SOURCE_DIR)/plantuml
PLANTUML_DEST_DIR = $(IMAGES_DIR)/plantuml
MOCODO_SRC_DIR = $(SOURCE_DIR)/mocodo
MOCODO_DEST_DIR = $(IMAGES_DIR)/mocodo
GRAPHVIZ_SRC_DIR = $(SOURCE_DIR)/graphviz
GRAPHVIZ_DEST_DIR = $(IMAGES_DIR)/graphviz
##
## Include libraries
##
include mocodo.mk
include dot.mk
include plantuml.mk
##
## Rules
##
.PHONY: build
build: plantuml-build mocodo-build graphviz-build
.PHONY: clean
clean: plantuml-clean mocodo-clean graphviz-clean
-include mocodo.mk
-include dot.mk
-include plantuml.mk

View file

@ -1,106 +1,60 @@
<!--
# SPDX-License-Identifier: LGPL-3.0-or-later
#
# SPDX-FileCopyrightText: 2023 Glenn Y. Rolland <glenux@glenux.net>
# Copyright © 2023 Glenn Y. Rolland <glenux@glenux.net>
-->
# Makefiles Forever # Makefiles Forever
A drop-in collection of makefiles libraries for your projects A drop-in collection of makefiles libraries for your projects
## Description ## Description
* plantuml.makefile — Automate the building [plantuml](https://plantuml.com/) diagrams. * plantuml.makefile — Build [plantuml](https://plantuml.com/) diagrams
* graphviz.mk — Streamline the creation of [graphviz](https://graphviz.org/) graph diagrams. * dot.mk — Build [graphviz](https://graphviz.org/) graph diagrams
* mocodo.mk — Facilitate the development of [mocodo](http://mocodo.wingi.net/) entity-relation and logical diagrams. * mocodo.mk — Build [mocodo](http://mocodo.wingi.net/) entity-relation and logical diagrams
* mypaint.mk - Automate the conversion of [mypaint](https://mypaint.app/) openraster images to usual image formats.
## Usage ## Usage
### Adding to your project Add this repository as a GIT submodule of your project
To include 'Makefiles Forever' in your project, add this repository as a GIT
submodule:
```shell-session ```shell-session
$ git submodule add https://github.com/glenux/makefiles-forever .makefiles $ git submodule add https://github.com/glenux/makefiles-forever .makefiles
``` ```
### Configuring your makefiles Include needed features in the end of your makefile
In your project's makefile, include the necessary modules. __The `include` instructions must be located
__before your existing targets__.
```makefile ```makefile
# [... variable definitions ...] # [...]
# Include as many Makefiles Forever features as your want -include .makefiles/featureA.mk
include .makefiles/plantuml.mk -include .makefiles/featureB.mk
include .makefiles/mocodo.mk
include .makefiles/graphviz.mk
# [... targets definitions ...]
``` ```
Declare API variables (ex: `*_SRC_DIR`, `*_DEST_DIR`) for each module Declare API variables (ex: `*_SRC_DIR`, `*_DEST_DIR`) for each module
```makefile ```makefile
# PlantUML Configuration # Configuration for featureA from Makefiles Forever
PLANTUML_SRC_DIR=/path/to/plantuml/files FEATUREA_SRC_DIR=/path/to/somewhere
PLANTUML_DEST_DIR=/path/to/output/directory FEATUREA_DEST_DIR=/some/other/path
# Mocodo Configuration # Configuration for featureB from Makefiles Forever
MOCODO_SRC_DIR=/path/to/mocodo/files FEATUREA_SRC_DIR=/another/path
MOCODO_DEST_DIR=/path/to/output/directory FEATUREB_DEST_DIR=/a/different/one
# Graphviz Configuration
GRAPHVIZ_SRC_DIR=/path/to/mocodo/files
GRAPHVIZ_DEST_DIR=/path/to/output/directory
# [ ... etc ...]
``` ```
Use pre-defined targets in your build process, as dependencies of your existing Use pre-defined targets as dependencies of your targets:
targets:
```makefile ```makefile
build: featureA-build
build: featureB-build
build: plantuml-build mocodo-build graphviz-build clean: featureA-clean
clean: featureB-clean
clean: plantuml-clean mocodo-clean graphviz-clean
``` ```
Feature files usually define more targets than just build and clean, and you Feature files usually define more targets than just build and clean, and you
can use those too! can use those too!
## Best practices used in our .mk modules ## Good practices for coding .mk files
* Parallel Execution: We ensure targets are available from the root makefile and avoid descending into subdirectories for parallel execution. * Keep task parallelism in mind
* Modular Design: We keep our makefiles modular for easy maintenance and scalability. * Make all targets available from root makefile
* Documentation: We comment our makefiles for clarity and ease of use by others. * Do not descend in subdirectories
## Contributing
Contributions are what make the open-source community such an amazing place to
learn, inspire, and create. Any contributions you make are **greatly
appreciated**.
## Troubleshooting and Support
If you encounter any issues or need support, please open an issue in
[the project's issue tracker](https://code.apps.glenux.net/glenux/makefiles-forever/issues).
We strive to be responsive and helpful.
## License
Distributed under the LGPL-3.0-or-later License. See `LICENSE` file for more
information.
## Acknowledgments
* A special thanks to all contributors and users of this project for their
valuable feedback and support.

View file

@ -1,8 +1,3 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
#
# SPDX-FileCopyrightText: 2023 Glenn Y. Rolland <glenux@glenux.net>
# Copyright © 2023 Glenn Y. Rolland <glenux@glenux.net>
## ##
## GRAPHVIZ MODULE ## GRAPHVIZ MODULE
## ##
@ -20,18 +15,11 @@ GRAPHVIZ_DEST_DIR ?=
## Find .dot graphs ## Find .dot graphs
GRAPHVIZ_DOT := $(shell find $(GRAPHVIZ_SRC_DIR) \( -name '*.dot' ! -name '_*' \)) GRAPHVIZ_DOT := $(shell find $(GRAPHVIZ_SRC_DIR) \( -name '*.dot' ! -name '_*' \))
GRAPHVIZ_DOT_SVG := $(patsubst $(GRAPHVIZ_SRC_DIR)/%.dot,$(GRAPHVIZ_DEST_DIR)/%.dot.svg,$(GRAPHVIZ_DOT)) GRAPHVIZ_DOT_SVG := $(patsubst $(GRAPHVIZ_SRC_DIR)/%.dot,$(GRAPHVIZ_DEST_DIR)/%.dot.svg,$(GRAPHVIZ_DOT))
GRAPHVIZ_DOT_PNG := $(patsubst $(GRAPHVIZ_SRC_DIR)/%.dot,$(GRAPHVIZ_DEST_DIR)/%.dot.png,$(GRAPHVIZ_DOT))
GRAPHVIZ_DOT_PDF := $(patsubst $(GRAPHVIZ_SRC_DIR)/%.dot,$(GRAPHVIZ_DEST_DIR)/%.dot.pdf,$(GRAPHVIZ_DOT))
## Find .circo graphs ## Find .circo graphs
GRAPHVIZ_CIRCO := $(shell find $(GRAPHVIZ_SRC_DIR) \( -name '*.circo' ! -name '_*' \)) GRAPHVIZ_CIRCO := $(shell find $(GRAPHVIZ_SRC_DIR) \( -name '*.circo' ! -name '_*' \))
GRAPHVIZ_CIRCO_SVG := $(patsubst $(GRAPHVIZ_SRC_DIR)/%.circo,$(GRAPHVIZ_DEST_DIR)/%.circo.svg,$(GRAPHVIZ_CIRCO)) GRAPHVIZ_CIRCO_SVG := $(patsubst $(GRAPHVIZ_SRC_DIR)/%.circo,$(GRAPHVIZ_DEST_DIR)/%.circo.svg,$(GRAPHVIZ_CIRCO))
GRAPHVIZ_CIRCO_PNG := $(patsubst $(GRAPHVIZ_SRC_DIR)/%.circo,$(GRAPHVIZ_DEST_DIR)/%.circo.png,$(GRAPHVIZ_CIRCO))
GRAPHVIZ_CIRCO_PDF := $(patsubst $(GRAPHVIZ_SRC_DIR)/%.circo,$(GRAPHVIZ_DEST_DIR)/%.circo.pdf,$(GRAPHVIZ_CIRCO))
GRAPHVIZ_SVG := $(GRAPHVIZ_DOT_SVG) $(GRAPHVIZ_CIRCO_SVG) GRAPHVIZ_SVG := $(GRAPHVIZ_DOT_SVG) $(GRAPHVIZ_CIRCO_SVG)
GRAPHVIZ_PNG := $(GRAPHVIZ_DOT_PNG) $(GRAPHVIZ_CIRCO_PNG)
GRAPHVIZ_PDF := $(GRAPHVIZ_DOT_PDF) $(GRAPHVIZ_CIRCO_PDF)
## ##
## Prerequisistes (system packages) ## Prerequisistes (system packages)
@ -52,38 +40,21 @@ $(GRAPHVIZ_DEST_DIR)/%.circo.svg: $(GRAPHVIZ_SRC_DIR)/%.circo | $(GRAPHVIZ_DEST_
circo -Tsvg $< > $@ circo -Tsvg $< > $@
$(GRAPHVIZ_SVG): | $(GRAPHVIZ_DEST_DIR) $(GRAPHVIZ_SVG): | $(GRAPHVIZ_DEST_DIR)
mkdir -p $(GRAPHVIZ_DEST_DIR)
$(GRAPHVIZ_PDF): | $(GRAPHVIZ_DEST_DIR)
$(GRAPHVIZ_PNG): | $(GRAPHVIZ_DEST_DIR)
.PHONY: graphviz-build-dot-svg
graphviz-build-dot-svg: $(GRAPHVIZ_DOT_SVG) graphviz-build-dot-svg: $(GRAPHVIZ_DOT_SVG)
.PHONY: graphviz-build-circo-svg
graphviz-build-circo-svg: $(GRAPHVIZ_CIRCO_SVG) graphviz-build-circo-svg: $(GRAPHVIZ_CIRCO_SVG)
.PHONY: graphviz-build-svg
graphviz-build-svg: graphviz-build-dot-svg graphviz-build-circo-svg graphviz-build-svg: graphviz-build-dot-svg graphviz-build-circo-svg
.PHONY: graphviz-buil
graphviz-build: graphviz-build-svg graphviz-build: graphviz-build-svg
# Clean # Clean
# #
.PHONY: graphviz-clean-svg
graphviz-clean-svg: graphviz-clean-svg:
rm -f $(GRAPHVIZ_SVG) rm -f $(GRAPHVIZ_SVG)
.PHONY: graphviz-clean-pdf graphviz-clean: graphviz-clean-svg
graphviz-clean-pdf:
rm -f $(GRAPHVIZ_PDF)
.PHONY: graphviz-clean-png
graphviz-clean-png:
rm -f $(GRAPHVIZ_PNG)
.PHONY: graphviz-clean
graphviz-clean: graphviz-clean-svg graphviz-clean-png graphviz-clean-pdf

View file

@ -1,8 +1,3 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
#
# SPDX-FileCopyrightText: 2023 Glenn Y. Rolland <glenux@glenux.net>
# Copyright © 2023 Glenn Y. Rolland <glenux@glenux.net>
## ##
## MOCODO MODULE ## MOCODO MODULE
## ##
@ -10,31 +5,26 @@
## ##
## External variables (API) ## External variables (API)
## ##
MOCODO_OPT ?= --colors brewer-6 --shapes verdana MOCODO_OPT=--colors brewer-6 --shapes verdana
MOCODO_SRC_DIR ?= MOCODO_SRC_DIR=
MOCODO_DEST_DIR ?= MOCODO_DEST_DIR=
## ##
## Internal variables (lazy recursive evaluation) ## Internal variables
## ##
MOCODO_MCD_FILES=$(shell find $(MOCODO_SRC_DIR) \( -name '*.mcd' ! -name '_*' \))
MOCODO_MCD_MLD=$(patsubst $(MOCODO_SRC_DIR)/%.mcd,$(MOCODO_DEST_DIR)/%.mcd.mld,$(MOCODO_MCD_FILES))
MOCODO_MCD_SVG=$(patsubst $(MOCODO_SRC_DIR)/%.mcd,$(MOCODO_DEST_DIR)/%.mcd.svg,$(MOCODO_MCD_FILES))
MOCODO_MCD_PDF=$(patsubst $(MOCODO_SRC_DIR)/%.mcd,$(MOCODO_DEST_DIR)/%.mcd.pdf,$(MOCODO_MCD_FILES))
## Find .mcd and .mld files MOCODO_MLD_FILES=$(shell find $(MOCODO_SRC_DIR) \( -name '*.mld' ! -name '_*' \)) $(MOCODO_MCD_MLD)
## Convert .mcd to .mcd.mld, .mcd.svg and .mcd.pdf files MOCODO_MLD_SVG=$(patsubst $(MOCODO_SRC_DIR)/%.mld,$(MOCODO_DEST_DIR)/%.mld.svg,$(MOCODO_MLD_FILES))
## Convert .mld to .mld.svg, and .mld.pdf files MOCODO_MLD_PDF=$(patsubst $(MOCODO_SRC_DIR)/%.mld,$(MOCODO_DEST_DIR)/%.mld.pdf,$(MOCODO_MLD_FILES))
MOCODO_MCD_FILES = $(shell find $(MOCODO_SRC_DIR) \( -name '*.mcd' ! -name '_*' \))
MOCODO_MCD_MLD = $(patsubst $(MOCODO_SRC_DIR)/%.mcd,$(MOCODO_DEST_DIR)/%.mcd.mld,$(MOCODO_MCD_FILES))
MOCODO_MCD_SVG = $(patsubst $(MOCODO_SRC_DIR)/%.mcd,$(MOCODO_DEST_DIR)/%.mcd.svg,$(MOCODO_MCD_FILES))
MOCODO_MCD_PDF = $(patsubst $(MOCODO_SRC_DIR)/%.mcd,$(MOCODO_DEST_DIR)/%.mcd.pdf,$(MOCODO_MCD_FILES))
MOCODO_MLD_FILES = $(shell find $(MOCODO_SRC_DIR) \( -name '*.mld' ! -name '_*' \)) $(MOCODO_MCD_MLD)
MOCODO_MLD_SVG = $(patsubst $(MOCODO_SRC_DIR)/%.mld,$(MOCODO_DEST_DIR)/%.mld.svg,$(MOCODO_MLD_FILES))
MOCODO_MLD_PDF = $(patsubst $(MOCODO_SRC_DIR)/%.mld,$(MOCODO_DEST_DIR)/%.mld.pdf,$(MOCODO_MLD_FILES))
## ##
## Prerequisistes (system packages) ## Prerequisistes (system packages)
## ##
MOCODO_APT_PACKAGES = ghostscript librsvg2-bin MOCODO_APT_PACKAGES=ghostscript librsvg2-bin
## ##
## Rules ## Rules
@ -81,56 +71,26 @@ $(MOCODO_DEST_DIR)/%.mcd.pdf: $(MOCODO_SRC_DIR)/%.mcd.svg
# rsvg-convert -f pdf $< > $@ # rsvg-convert -f pdf $< > $@
rsvg-convert -f ps $< | gs -sDEVICE=pdfwrite -sOutputFile=$@ -f - rsvg-convert -f ps $< | gs -sDEVICE=pdfwrite -sOutputFile=$@ -f -
.PHONY: mocodo-mcd-mld
mocodo-mcd-mld: $(MOCODO_MCD_MLD) mocodo-mcd-mld: $(MOCODO_MCD_MLD)
.PHONY: mocodo-mcd-svg
mocodo-mcd-svg: $(MOCODO_MCD_SVG) mocodo-mcd-svg: $(MOCODO_MCD_SVG)
.PHONY: mocodo-mld-pdf
mocodo-mcd-pdf: $(MOCODO_MCD_PDF)
.PHONY: mocodo-mld-svg
mocodo-mld-svg: $(MOCODO_MLD_SVG) mocodo-mld-svg: $(MOCODO_MLD_SVG)
.PHONY: mocodo-mld-pdf mocodo-mcd-pdf: $(MOCODO_MCD_PDF)
mocodo-mld-pdf: $(MOCODO_MLD_PDF) mocodo-mld-pdf: $(MOCODO_MLD_PDF)
.PHONY: mocodo-svg
mocodo-svg: mocodo-mcd-svg mocodo-mld-svg mocodo-svg: mocodo-mcd-svg mocodo-mld-svg
.PHONY: mocodo-pdf
mocodo-pdf: mocodo-mcd-pdf mocodo-mld-pdf mocodo-pdf: mocodo-mcd-pdf mocodo-mld-pdf
.PHONY: mocodo-clean-mld
mocodo-clean-mld: mocodo-clean-mld:
rm -f $(MOCODO_MCD_MLD) rm -f $(MOCODO_MCD_MLD)
.PHONY: mocodo-clean-svg
mocodo-clean-svg: mocodo-clean-svg:
rm -f $(MOCODO_MCD_SVG) $(MOCODO_MLD_SVG) rm -f $(MOCODO_MCD_SVG) $(MOCODO_MLD_SVG)
.PHONY: mocodo-clean-pdf
mocodo-clean-pdf: mocodo-clean-pdf:
rm -f $(MOCODO_MCD_PDF) $(MOCODO_MLD_PDF) rm -f $(MOCODO_MCD_PDF) $(MOCODO_MLD_PDF)
.PHONY: mocodo-clean
mocodo-clean: mocodo-clean-mld mocodo-clean-svg mocodo-clean-pdf mocodo-clean: mocodo-clean-mld mocodo-clean-svg mocodo-clean-pdf
.PHONY: mocodo-info
mocodo-info:
@echo "MOCODO:"
@echo " External variables:"
@echo " MOCODO_OPT: $(MOCODO_OPT)"
@echo " MOCODO_SRC_DIR: $(MOCODO_SRC_DIR)"
@echo " MOCODO_DEST_DIR: $(MOCODO_DEST_DIR)"
@echo " Internal variables"
@echo " MOCODO_MCD_FILES: $(MOCODO_MCD_FILES)"
@echo " MOCODO_MLD_FILES: $(MOCODO_MLD_FILES)"
@echo " MOCODO_MCD_MLD: $(MOCODO_MCD_MLD)"
@echo " MOCODO_MCD_SVG: $(MOCODO_MCD_SVG)"
@echo " MOCODO_MCD_PDF: $(MOCODO_MCD_PDF)"
@echo " MOCODO_MLD_FILES: $(MOCODO_MLD_FILES)"
@echo " MOCODO_MLD_SVG: $(MOCODO_MLD_SVG)"
@echo " MOCODO_MLD_PDF: $(MOCODO_MLD_PDF)"

View file

@ -1,100 +0,0 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
#
# SPDX-FileCopyrightText: 2023 Glenn Y. Rolland <glenux@glenux.net>
# Copyright © 2023 Glenn Y. Rolland <glenux@glenux.net>
##
## MYPAINT MODULE
##
##
## External variables (API)
##
MYPAINT_SUFFIX ?= ora
MYPAINT_SRC_DIR ?=
MYPAINT_DEST_DIR ?=
MYPAINT_PDF_DENSITY ?= 75
MYPAINT_JPG_QUALITY ?= 100
##
## Internal variables (lazy recursive evaluation)
##
## Find .ora files
MYPAINT_ORA = $(shell find $(MYPAINT_SRC_DIR) \( -name '*.ora' ! -name '_*' \))
MYPAINT_ORA_PNG = $(patsubst $(MYPAINT_SRC_DIR)/%.ora,$(MYPAINT_DEST_DIR)/%.ora.png,$(MYPAINT_ORA))
MYPAINT_ORA_JPG = $(patsubst $(MYPAINT_SRC_DIR)/%.ora,$(MYPAINT_DEST_DIR)/%.ora.jpg,$(MYPAINT_ORA))
MYPAINT_ORA_PDF = $(patsubst $(MYPAINT_SRC_DIR)/%.ora,$(MYPAINT_DEST_DIR)/%.ora.pdf,$(MYPAINT_ORA))
##
## Prerequisistes (system packages)
##
MYPAINT_APT_PACKAGES := unzip mypaint imagemagick
##
## Rules
##
$(MYPAINT_DEST_DIR):
mkdir -p $(MYPAINT_DEST_DIR)
$(MYPAINT_DEST_DIR)/%.ora.png: $(MYPAINT_SRC_DIR)/%.ora | $(MYPAINT_DEST_DIR)
TMPDIR="$$(mktemp -d)" \
&& unzip -q $< -d "$$TMPDIR" mergedimage.png \
&& touch "$$TMPDIR/mergedimage.png" \
&& mv "$$TMPDIR/mergedimage.png" $@
$(MYPAINT_DEST_DIR)/%.ora.jpg: $(MYPAINT_DEST_DIR)/%.ora.png | $(MYPAINT_DEST_DIR)
convert -quality $(MYPAINT_JPG_QUALITY) $< $@
$(MYPAINT_DEST_DIR)/%.ora.pdf: $(MYPAINT_DEST_DIR)/%.ora.png | $(MYPAINT_DEST_DIR)
convert -density $(MYPAINT_PDF_DENSITY) $< $@
.PHONY: mypaint-ora-jpg
mypaint-ora-jpg: $(MYPAINT_ORA_JPG)
.PHONY: mypaint-ora-png
mypaint-ora-png: $(MYPAINT_ORA_PNG)
.PHONY: mypaint-ora-pdf
mypaint-ora-pdf: $(MYPAINT_ORA_PDF)
.PHONY: mypaint-jpg
mypaint-jpg: mypaint-ora-jpg
.PHONY: mypaint-png
mypaint-png: mypaint-ora-png
.PHONY: mypaint-pdf
mypaint-pdf: mypaint-ora-pdf
.PHONY: mypaint-clean-jpg
mypaint-clean-jpg:
rm -f $(MYPAINT_ORA_JPG)
.PHONY: mypaint-clean-png
mypaint-clean-png:
rm -f $(MYPAINT_ORA_PNG)
.PHONY: mypaint-clean-pdf
mypaint-clean-pdf:
rm -f $(MYPAINT_ORA_PDF)
.PHONY: mypaint-clean
mypaint-clean: mypaint-clean-pdf mypaint-clean-jpg
.PHONY: mypaint-info
mypaint-info:
@echo "MYPAINT:"
@echo " External variables:"
@echo " MYPAINT_SUFFIX: $(MYPAINT_SUFFIX)"
@echo " MYPAINT_SRC_DIR: $(MYPAINT_SRC_DIR)"
@echo " MYPAINT_DEST_DIR: $(MYPAINT_DEST_DIR)"
@echo " MYPAINT_PDF_DENSITY: $(MYPAINT_PDF_DENSITY)"
@echo " MYPAINT_JPG_QUALITY: $(MYPAINT_JPG_QUALITY)"
@echo " Internal variables"
@echo " MYPAINT_ORA: $(MYPAINT_ORA)"
@echo " MYPAINT_ORA_PNG: $(MYPAINT_ORA_PDF)"
@echo " MYPAINT_ORA_PDF: $(MYPAINT_ORA_PDF)"
@echo " MYPAINT_ORA_JPG: $(MYPAINT_ORA_JPG)"

View file

@ -1,8 +1,3 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
#
# SPDX-FileCopyrightText: 2023 Glenn Y. Rolland <glenux@glenux.net>
# Copyright © 2023 Glenn Y. Rolland <glenux@glenux.net>
## ##
## PLANTUML MODULE ## PLANTUML MODULE
## ##
@ -13,24 +8,17 @@
PLANTUML_SUFFIX ?= uml PLANTUML_SUFFIX ?= uml
PLANTUML_SRC_DIR ?= PLANTUML_SRC_DIR ?=
PLANTUML_DEST_DIR ?= PLANTUML_DEST_DIR ?=
PLANTUML_PLANTUML_COMMAND ?= podman run -i plantuml/plantuml plantuml
PLANTUML_RSVGCONVERT_COMMAND ?= rsvg-convert
PLANTUML_GHOSTSCRIPT_COMMAND ?= gs
## ##
## Internal variables (lazy recursive evaluation) ## Internal variables (lazy recursive evaluation)
## ##
## Find .uml files ## Find .uml graphs
PLANTUML_UML = $(shell find $(PLANTUML_SRC_DIR) \( -name '*.uml' ! -name '_*' \)) PLANTUML_UML = $(shell find $(PLANTUML_SRC_DIR) \( -name '*.uml' ! -name '_*' \))
PLANTUML_UML_PNG = $(patsubst $(PLANTUML_SRC_DIR)/%.uml,$(PLANTUML_DEST_DIR)/%.uml.png,$(PLANTUML_UML)) PLANTUML_UML_PNG = $(patsubst $(PLANTUML_SRC_DIR)/%.uml,$(PLANTUML_DEST_DIR)/%.uml.png,$(PLANTUML_UML))
PLANTUML_UML_SVG = $(patsubst $(PLANTUML_SRC_DIR)/%.uml,$(PLANTUML_DEST_DIR)/%.uml.svg,$(PLANTUML_UML)) PLANTUML_UML_SVG = $(patsubst $(PLANTUML_SRC_DIR)/%.uml,$(PLANTUML_DEST_DIR)/%.uml.svg,$(PLANTUML_UML))
PLANTUML_UML_PDF = $(patsubst $(PLANTUML_SRC_DIR)/%.uml,$(PLANTUML_DEST_DIR)/%.uml.pdf,$(PLANTUML_UML)) PLANTUML_UML_PDF = $(patsubst $(PLANTUML_SRC_DIR)/%.uml,$(PLANTUML_DEST_DIR)/%.uml.pdf,$(PLANTUML_UML))
##
## Prerequisistes (system packages)
##
GRAPHVIZ_APT_PACKAGES := plantuml librsvg2-bin ghostscript
## ##
## Rules ## Rules
@ -40,14 +28,14 @@ $(PLANTUML_DEST_DIR):
mkdir -p $(PLANTUML_DEST_DIR) mkdir -p $(PLANTUML_DEST_DIR)
$(PLANTUML_DEST_DIR)/%.uml.png: $(PLANTUML_SRC_DIR)/%.uml | $(PLANTUML_DEST_DIR) $(PLANTUML_DEST_DIR)/%.uml.png: $(PLANTUML_SRC_DIR)/%.uml | $(PLANTUML_DEST_DIR)
$(PLANTUML_COMMAND) -pipe -tpng < $< > $@ podman run -i plantuml/plantuml plantuml -pipe -tpng < $< > $@
$(PLANTUML_DEST_DIR)/%.uml.svg: $(PLANTUML_SRC_DIR)/%.uml | $(PLANTUML_DEST_DIR) $(PLANTUML_DEST_DIR)/%.uml.svg: $(PLANTUML_SRC_DIR)/%.uml | $(PLANTUML_DEST_DIR)
$(PLANTUML_COMMAND) -pipe -tsvg < $< > $@ podman run -i plantuml/plantuml plantuml -pipe -tsvg < $< > $@
$(PLANTUML_DEST_DIR)/%.uml.pdf: $(PLANTUML_DEST_DIR)/%.uml.svg | $(PLANTUML_DEST_DIR) $(PLANTUML_DEST_DIR)/%.uml.pdf: $(PLANTUML_DEST_DIR)/%.uml.svg | $(PLANTUML_DEST_DIR)
$(PLANTUML_RSVGCONVERT_COMMAND) -f ps $< | $(PLANTUML_GHOSTSCRIPT_COMMAND) -sDEVICE=pdfwrite -sOutputFile=$@ -f - #podman run -i plantuml/plantuml plantuml -pipe -tpdf < $< > $@
rsvg-convert -f pdf -o $@ $<
.PHONY: plantuml-uml-svg .PHONY: plantuml-uml-svg
plantuml-uml-svg: $(PLANTUML_UML_SVG) plantuml-uml-svg: $(PLANTUML_UML_SVG)
@ -84,17 +72,12 @@ plantuml-clean: plantuml-clean-pdf plantuml-clean-svg
.PHONY: plantuml-info .PHONY: plantuml-info
plantuml-info: plantuml-info:
@echo "PLANTUML:" @echo "PLANTUML_DEST_DIR: $(PLANTUML_DEST_DIR)"
@echo " External variables:" @echo "PLANTUML_SRC_DIR: $(PLANTUML_SRC_DIR)"
@echo " PLANTUML_SUFFIX: $(PLANTUML_SUFFIX)" @echo "--"
@echo " PLANTUML_DEST_DIR: $(PLANTUML_DEST_DIR)" @echo "PLANTUML_UML: $(PLANTUML_UML)"
@echo " PLANTUML_SRC_DIR: $(PLANTUML_SRC_DIR)" @echo "PLANTUML_UML_PDF: $(PLANTUML_UML_PDF)"
@echo " PLANTUML_PLANTUML_COMMAND: $(PLANTUML_PLANTUML_COMMAND)" @echo "PLANTUML_UML_SVG: $(PLANTUML_UML_SVG)"
@echo " PLANTUML_RSVGCONVERT_COMMAND: $(PLANTUML_RSVGCONVERT_COMMAND)"
@echo " PLANTUML_GHOSTSCRIPT_COMMAND: $(PLANTUML_GHOSTSCRIPT_COMMAND)" .SUFFIXES:
@echo " Internal variables"
@echo " PLANTUML_UML: $(PLANTUML_UML)"
@echo " PLANTUML_UML_PDF: $(PLANTUML_UML_PDF)"
@echo " PLANTUML_UML_PNG: $(PLANTUML_UML_PNG)"
@echo " PLANTUML_UML_SVG: $(PLANTUML_UML_SVG)"