mirror of
https://github.com/wader/fq.git
synced 2024-12-23 05:13:30 +03:00
make: Move doc generate to helper script
This commit is contained in:
parent
e4e269b162
commit
75b59dbeff
13
Makefile
13
Makefile
@ -35,18 +35,7 @@ testcli:
|
||||
|
||||
.PHONY: doc
|
||||
doc: doc/file.mp3 doc/file.mp4
|
||||
$(eval REPODIR=$(shell pwd))
|
||||
$(eval TEMPDIR=$(shell mktemp -d))
|
||||
@cp -a doc/* "${TEMPDIR}"
|
||||
@go build -o "${TEMPDIR}/fq" main.go
|
||||
@for f in *.md doc/*.md ; do \
|
||||
cd "${TEMPDIR}" ; \
|
||||
echo $$f ; \
|
||||
mkdir -p $$(dirname "${TEMPDIR}/$$f") ; \
|
||||
cat "${REPODIR}/$$f" | PATH="${TEMPDIR}:${PATH}" go run "${REPODIR}/doc/mdsh.go" > "${TEMPDIR}/$$f" ; \
|
||||
mv "${TEMPDIR}/$$f" "${REPODIR}/$$f" ; \
|
||||
done
|
||||
@rm -rf "${TEMPDIR}"
|
||||
@doc/mdsh.sh *.md doc/*.md
|
||||
|
||||
doc/file.mp3: Makefile
|
||||
ffmpeg -y -f lavfi -i sine -f lavfi -i testsrc -map 0:0 -map 1:0 -t 20ms "$@"
|
||||
|
15
doc/mdsh.sh
Executable file
15
doc/mdsh.sh
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
REPODIR=$(pwd)
|
||||
TEMPDIR=$(mktemp -d)
|
||||
cp -a doc/* "${TEMPDIR}"
|
||||
go build -o "${TEMPDIR}/fq" main.go
|
||||
for f in "$@"; do
|
||||
cd "${TEMPDIR}"
|
||||
echo "Generate $f"
|
||||
mkdir -p "$(dirname "${TEMPDIR}/$f")"
|
||||
PATH="${TEMPDIR}:${PATH}" go run "${REPODIR}/doc/mdsh.go" >"${TEMPDIR}/$f" <"${REPODIR}/$f"
|
||||
mv "${TEMPDIR}/$f" "${REPODIR}/$f"
|
||||
done
|
||||
rm -rf "${TEMPDIR}"
|
Loading…
Reference in New Issue
Block a user