GO_BUILD_FLAGS ?= -trimpath GO_BUILD_LDFLAGS ?= -s -w all: test fq # used to force make to always redo .PHONY: always fq: always CGO_ENABLED=0 go build -o fq -ldflags "${GO_BUILD_LDFLAGS}" ${GO_BUILD_FLAGS} . test: always testgo testjq testcli test-race: always testgo-race testjq testcli # figure out all go packages with test files testgo: PKGS=$(shell find . -name "*_test.go" | xargs -n 1 dirname | sort | uniq) testgo: always go test -timeout 20m ${RACE} ${VERBOSE} ${COVER} ${PKGS} testgo-race: RACE=-race testgo-race: testgo testjq: $(shell find . -name "*.jq.test") %.jq.test: fq @echo $@ @./fq -rRs -L pkg/interp 'include "jqtest"; run_tests' $@ testcli: fq @pkg/cli/test_exp.sh ./fq pkg/cli/test_repl.exp @pkg/cli/test_exp.sh ./fq pkg/cli/test_cli_ctrlc.exp @pkg/cli/test_exp.sh ./fq pkg/cli/test_cli_ctrld.exp cover: COVER=-cover -coverpkg=./... -coverprofile=cover.out cover: test go tool cover -html=cover.out -o cover.out.html cat cover.out.html | grep '