GO_BUILD_FLAGS ?= -trimpath GO_BUILD_LDFLAGS ?= -s -w GO_TEST_RACE_FLAGS ?=-race all: test fq .PHONY: fq fq: VERSION=$(shell git describe --all --long --dirty 2>/dev/null || echo nogit) fq: CGO_ENABLED=0 go build -o fq -ldflags "${GO_BUILD_LDFLAGS} -X main.version=${VERSION}" ${GO_BUILD_FLAGS} . .PHONY: test test: testgo testjq testcli .PHONY: testgo # figure out all go pakges with test files testgo: PKGS=$(shell find . -name "*_test.go" | xargs -n 1 dirname | sort | uniq) testgo: go test ${GO_TEST_RACE_FLAGS} ${VERBOSE} ${COVER} ${PKGS} .PHONY: testgov testgov: export VERBOSE=-v testgov: testgo .PHONY: testjq testjq: fq @pkg/interp/testjq.sh ./fq pkg/interp/*_test.jq .PHONY: testcli testcli: fq @pkg/cli/test.sh ./fq pkg/cli/test.exp .PHONY: actual actual: export WRITE_ACTUAL=1 actual: testgo .PHONY: cover cover: COVER=-cover -coverpkg=./... -coverprofile=cover.out cover: test go tool cover -html=cover.out -o cover.out.html cat cover.out.html | grep '