2020-06-08 03:29:51 +03:00
|
|
|
all: test
|
|
|
|
|
|
|
|
.PHONY: fq
|
2021-08-21 19:52:29 +03:00
|
|
|
fq: VERSION=$(shell git describe --all --long --dirty || echo nogit)
|
2020-06-08 03:29:51 +03:00
|
|
|
fq:
|
2021-08-21 19:52:29 +03:00
|
|
|
go build -ldflags "-X main.version=${VERSION}" -trimpath -o fq .
|
2020-06-08 03:29:51 +03:00
|
|
|
|
|
|
|
.PHONY: test
|
2021-08-21 19:52:29 +03:00
|
|
|
# figure out all go pakges with test files
|
|
|
|
test: PKGS=$(shell find . -name "*_test.go" | xargs -n 1 dirname | sort | uniq)
|
2021-09-14 14:05:57 +03:00
|
|
|
test: testjq
|
2021-09-04 01:54:51 +03:00
|
|
|
go test ${VERBOSE} ${COVER} ${PKGS}
|
2021-08-21 19:52:29 +03:00
|
|
|
|
2020-06-08 03:29:51 +03:00
|
|
|
testwrite: export WRITE_ACTUAL=1
|
|
|
|
testwrite: test
|
|
|
|
|
2021-09-04 01:54:51 +03:00
|
|
|
testv: export VERBOSE=-v
|
|
|
|
testv: test
|
|
|
|
|
2021-08-21 19:52:29 +03:00
|
|
|
cover: COVER=-cover -race -coverpkg=./... -coverprofile=cover.out
|
|
|
|
cover: test
|
|
|
|
go tool cover -html=cover.out -o cover.out.html
|
|
|
|
cat cover.out.html | grep '<option value="file' | sed -E 's/.*>(.*) \((.*)%\)<.*/\2 \1/' | sort -rn
|
|
|
|
|
2021-09-14 14:05:57 +03:00
|
|
|
.PHONY: testjq
|
|
|
|
testjq:
|
2020-06-08 03:29:51 +03:00
|
|
|
@for f in $$(find . -name "*_test.jq"); do \
|
|
|
|
echo $$f ; \
|
2021-08-14 20:50:17 +03:00
|
|
|
go run main.go -L "$$(dirname $$f)" -f "$$f" -n -r ; \
|
2020-06-08 03:29:51 +03:00
|
|
|
done
|
|
|
|
|
|
|
|
.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/file.mp3: Makefile
|
|
|
|
ffmpeg -y -f lavfi -i sine -f lavfi -i testsrc -map 0:0 -map 1:0 -t 20ms "$@"
|
|
|
|
|
|
|
|
doc/file.mp4: Makefile
|
|
|
|
ffmpeg -y -f lavfi -i sine -f lavfi -i testsrc -c:a aac -c:v h264 -f mp4 -t 20ms "$@"
|
|
|
|
|
|
|
|
.PHONY: gogenerate
|
|
|
|
gogenerate:
|
|
|
|
go generate -x ./...
|
|
|
|
|
|
|
|
.PHONY: lint
|
|
|
|
lint:
|
2021-08-21 12:25:21 +03:00
|
|
|
# bump: make-golangci-lint /golangci-lint@v([\d.]+)/ git:https://github.com/golangci/golangci-lint.git|^1
|
2021-09-07 19:19:39 +03:00
|
|
|
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.42.1 run
|
2020-06-08 03:29:51 +03:00
|
|
|
|
|
|
|
.PHONY: depgraph.svg
|
|
|
|
depgraph.svg:
|
2021-08-20 16:20:13 +03:00
|
|
|
go run github.com/kisielk/godepgraph@latest github.com/wader/fq | dot -Tsvg -o godepgraph.svg
|
2020-06-08 03:29:51 +03:00
|
|
|
|
|
|
|
.PHONY: formats.svg
|
|
|
|
formats.svg:
|
|
|
|
dev/formats_dot.jq | dot -Tsvg -o formats.svg
|
|
|
|
|
2021-08-31 15:14:12 +03:00
|
|
|
# make memprof ARGS=". test.mp3"
|
|
|
|
# make cpuprof ARGS=". test.mp3"
|
2020-06-08 03:29:51 +03:00
|
|
|
.PHONY: prof
|
|
|
|
prof:
|
2021-08-31 15:14:12 +03:00
|
|
|
go build -tags profile -o fq.prof main.go
|
|
|
|
CPUPROFILE=fq.cpu.prof MEMPROFILE=fq.mem.prof ./fq.prof ${ARGS}
|
2020-06-08 03:29:51 +03:00
|
|
|
.PHONY: memprof
|
|
|
|
memprof: prof
|
|
|
|
go tool pprof -http :5555 fq.prof fq.mem.prof
|
|
|
|
|
|
|
|
.PHONY: cpuprof
|
|
|
|
cpuprof: prof
|
|
|
|
go tool pprof -http :5555 fq.prof fq.cpu.prof
|
|
|
|
|
|
|
|
.PHONY: update-gomodreplace
|
2021-08-17 13:06:32 +03:00
|
|
|
update-gomod:
|
|
|
|
GOPROXY=direct go get -d github.com/wader/readline@fq
|
|
|
|
GOPROXY=direct go get -d github.com/wader/gojq@fq
|
|
|
|
go mod tidy
|