File: Makefile

package info (click to toggle)
yosys 0.52-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 69,796 kB
  • sloc: ansic: 696,955; cpp: 239,736; python: 14,617; yacc: 3,529; sh: 2,175; makefile: 1,945; lex: 697; perl: 445; javascript: 323; tcl: 162; vhdl: 115
file content (50 lines) | stat: -rw-r--r-- 1,184 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
all: examples all_tex

# 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'

ifneq ($(shell :; command -v rsync),)
RSYNC_CP ?= rsync -t
else
RSYNC_CP ?= cp -a
endif

# find all code example makefiles
.PHONY: examples
CODE_EXAMPLES := ../code_examples/*/Makefile
examples: $(CODE_EXAMPLES)

# target to convert all dot files
# needs to be run *after* examples, otherwise no dot files will be found
.PHONY: convert
DOT_FILES := $(shell find . -name *.dot)
convert: $(DOT_FILES:.dot=.pdf) $(DOT_FILES:.dot=.svg)

# use empty FORCE target because .PHONY ignores % expansion
FORCE:
../%/Makefile: FORCE
	@make -C $(@D) dots
	@mkdir -p $*
	@find $(@D) -name *.dot -exec $(RSYNC_CP) {} $* \;

# find and build all tex files
.PHONY: all_tex
TEX_FILES := $(shell find . -name *.tex)
all_tex: $(TEX_FILES:.tex=.pdf) $(TEX_FILES:.tex=.svg)

%.pdf: %.dot
	$(FAKETIME) dot -Tpdf -o $@ $<

%.pdf: %.tex
	cd $(@D) && $(FAKETIME) pdflatex $(<F) --interaction=nonstopmode

%.svg: %.pdf
	pdf2svg $< $@

.PHONY: clean tidy
tidy:
	rm -f  **/*.log **/*.aux

clean: tidy
	rm -rf code_examples
	rm -f **/*.pdf **/*.svg