2021-07-23 13:39:44 +00:00
|
|
|
##
|
|
|
|
## MOCODO MODULE
|
|
|
|
##
|
2021-07-14 22:38:16 +00:00
|
|
|
|
2021-07-23 13:39:44 +00:00
|
|
|
##
|
|
|
|
## External variables (API)
|
|
|
|
##
|
2021-07-14 22:38:16 +00:00
|
|
|
MOCODO_OPT=--colors brewer-6 --shapes verdana
|
2021-07-23 13:39:44 +00:00
|
|
|
MOCODO_SRC_DIR=
|
|
|
|
MOCODO_DEST_DIR=
|
|
|
|
|
|
|
|
##
|
|
|
|
## 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))
|
|
|
|
|
|
|
|
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)
|
|
|
|
##
|
2021-07-15 12:14:31 +00:00
|
|
|
MOCODO_APT_PACKAGES=ghostscript librsvg2-bin
|
|
|
|
|
2021-07-23 13:39:44 +00:00
|
|
|
##
|
|
|
|
## Rules
|
|
|
|
##
|
|
|
|
$(MOCODO_DEST_DIR)/%.mcd.mld: $(MOCODO_SRC_DIR)/%.mcd
|
2021-07-14 22:38:16 +00:00
|
|
|
tmp=$$(mktemp -d) \
|
|
|
|
&& pipenv run mocodo \
|
|
|
|
$(MOCODO_OPT) \
|
|
|
|
--mld --no_mcd \
|
|
|
|
--relations diagram \
|
|
|
|
--input $< \
|
|
|
|
--output $${tmp} \
|
|
|
|
&& mv $${tmp}/*.mld $@ \
|
|
|
|
&& rm -fr $${tmp} \
|
|
|
|
&& touch --reference $< $@
|
|
|
|
|
2021-07-23 13:39:44 +00:00
|
|
|
$(MOCODO_DEST_DIR)/%.mcd.svg: $(MOCODO_SRC_DIR)/%.mcd
|
2021-07-14 22:38:16 +00:00
|
|
|
tmp=$$(mktemp -d) \
|
|
|
|
&& pipenv run mocodo \
|
|
|
|
$(MOCODO_OPT) \
|
|
|
|
--mld --no_mcd \
|
|
|
|
--relations diagram \
|
|
|
|
--input $< \
|
|
|
|
--output $${tmp} \
|
|
|
|
&& mv $${tmp}/*.svg $@ \
|
|
|
|
&& rm -fr $${tmp} \
|
|
|
|
&& touch --reference $< $@
|
|
|
|
|
2021-07-23 13:39:44 +00:00
|
|
|
$(MOCODO_DEST_DIR)/%.mld.svg: $(MOCODO_SRC_DIR)/%.mld
|
2021-07-14 22:38:16 +00:00
|
|
|
tmp=$$(mktemp -d) \
|
|
|
|
&& pipenv run mocodo \
|
|
|
|
$(MOCODO_OPT) \
|
|
|
|
--input $< \
|
|
|
|
--output $${tmp} \
|
|
|
|
&& mv $${tmp}/*.svg $@ \
|
|
|
|
&& rm -fr $${tmp} \
|
|
|
|
&& touch --reference $< $@
|
|
|
|
|
2021-07-23 13:39:44 +00:00
|
|
|
$(MOCODO_DEST_DIR)/%.mld.pdf: $(MOCODO_SRC_DIR)/%.mld.svg
|
2021-07-15 12:14:31 +00:00
|
|
|
# rsvg-convert -f pdf $< > $@
|
|
|
|
rsvg-convert -f ps $< | gs -sDEVICE=pdfwrite -sOutputFile=$@ -f -
|
2021-07-14 22:38:16 +00:00
|
|
|
|
2021-07-23 13:39:44 +00:00
|
|
|
$(MOCODO_DEST_DIR)/%.mcd.pdf: $(MOCODO_SRC_DIR)/%.mcd.svg
|
2021-07-15 12:14:31 +00:00
|
|
|
# rsvg-convert -f pdf $< > $@
|
|
|
|
rsvg-convert -f ps $< | gs -sDEVICE=pdfwrite -sOutputFile=$@ -f -
|
|
|
|
|
2021-07-14 22:38:16 +00:00
|
|
|
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
|
|
|
|
|