Files
yosys/docs/source/_images/Makefile
T

52 lines
1.3 KiB
Makefile
Raw Normal View History

all: examples all_tex
2023-08-03 09:20:29 +12:00
2023-11-14 18:54:16 +13:00
# set a fake time in pdf generation to prevent unnecessary differences in output
FAKETIME := TZ='Z' faketime -f '2022-01-01 00:00:00 x0,001'
2023-08-03 09:20:29 +12:00
ifneq ($(shell :; command -v rsync),)
RSYNC_CP ?= rsync -t
else
RSYNC_CP ?= cp -a
endif
2023-11-14 18:54:16 +13:00
# find all code example makefiles
.PHONY: examples
CODE_EXAMPLES := ../code_examples/*/Makefile
examples: $(CODE_EXAMPLES)
2022-11-16 00:55:22 +13:00
2024-08-23 12:52:15 +12:00
# target to convert all dot files
# needs to be run *after* examples, otherwise no dot files will be found
2023-11-14 18:54:16 +13:00
.PHONY: convert
2024-08-23 12:52:15 +12:00
DOT_FILES := $(shell find . -name *.dot)
convert: $(DOT_FILES:.dot=.pdf) $(DOT_FILES:.dot=.svg)
2022-11-16 00:55:22 +13:00
2024-08-23 12:52:15 +12:00
# use empty FORCE target because .PHONY ignores % expansion
2023-11-14 18:54:16 +13:00
FORCE:
../%/Makefile: FORCE
@make -C $(@D) dots
@mkdir -p $*
@find $(@D) -name *.dot -exec $(RSYNC_CP) {} $* \;
2022-11-16 00:55:22 +13:00
2023-11-14 18:54:16 +13:00
# find and build all tex files
.PHONY: all_tex
2024-08-23 12:52:15 +12:00
TEX_FILES := $(shell find . -name *.tex)
2023-11-14 18:54:16 +13:00
all_tex: $(TEX_FILES:.tex=.pdf) $(TEX_FILES:.tex=.svg)
2023-08-03 09:20:29 +12:00
2026-05-05 10:24:04 +12:00
# limit output size to US letter (same as latexpdf output) to avoid oversize error
2023-11-14 18:54:16 +13:00
%.pdf: %.dot
2026-05-22 12:31:30 +02:00
@$(FAKETIME) dot -Tpdf -Gsize="8.5,11" -o $@ $< >/dev/null 2>&1
2022-11-16 00:55:22 +13:00
%.pdf: %.tex
2026-05-22 12:31:30 +02:00
@cd $(@D) && $(FAKETIME) pdflatex $(<F) --interaction=nonstopmode >/dev/null 2>&1
2022-11-16 00:55:22 +13:00
%.svg: %.pdf
2026-05-22 12:31:30 +02:00
@pdf2svg $< $@ >/dev/null 2>&1
2022-11-16 00:55:22 +13:00
.PHONY: clean tidy
tidy:
2026-05-22 12:31:30 +02:00
@rm -f **/*.log **/*.aux
2023-11-14 18:54:16 +13:00
2022-11-16 00:55:22 +13:00
clean: tidy
2026-05-22 12:31:30 +02:00
@rm -rf code_examples
@rm -f **/*.pdf **/*.svg