1 FILES=$(wildcard src/*.rs)
2 DOCFILES=$(addsuffix .html,$(addprefix docs/,$(notdir $(basename $(FILES)))))
3 WORKSPACEFILES=$(addprefix workspace/,$(FILES))
5 all: docs workspace crates
6 .PHONY: docs workspace crates
11 .tmp/docs/%.rs: src/%.rs Makefile pycco-rs dup-unimpl.sed
14 @# sed-fu: remove the "@" from "//@", and remove trailing "/*@*/", replace lines ending in "/*@@*/" by "unimplemented!()".
15 @# Also coalesce multiple adjacent such lines to one.
16 @sed 's|^\(\s*//\)@|\1|;s|\s*/\*@\*/$$||;s|\(\s*\)\S.*/\*@@\*/|\1unimplemented!()|' $< | sed -f dup-unimpl.sed > $@
18 docs/%.html: .tmp/docs/%.rs
19 ~/.local/pipx/venvs/pycco/bin/python pycco-rs $<
22 # The generated files are shipped only for the benefit of Windows users, who
23 # typically don't have the necessary tools for generating the workspace
25 workspace: $(WORKSPACEFILES) docs/workspace.zip
27 workspace/src/%.rs: src/%.rs Makefile dup-unimpl.sed
28 @mkdir -p .tmp/docs workspace/src/
30 @# sed-fu: remove lines starting with "//@", and replace those ending in "/*@*/" or "/*@@*/" by "unimplemented!()".
31 @# Also coalesce multiple adjacent such lines to one.
32 @sed '/^\s*\/\/@/d;s|\(\s*\)\S.*/\*@@\?\*/|\1unimplemented!()|' $< | sed -f dup-unimpl.sed > $@
34 workspace/src/main.rs:
35 # Don't touch this file
37 docs/workspace.zip: $(WORKSPACEFILES) workspace/Cargo.toml workspace/Cargo.lock
42 crates: $(WORKSPACEFILES)
44 @cd workspace && cargo build
45 @cd solutions && cargo build && cargo test