github.com/XiaoMi/Gaea@v1.2.5/Makefile (about) 1 ROOT:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) 2 GAEA_OUT:=$(ROOT)/bin/gaea 3 GAEA_CC_OUT:=$(ROOT)/bin/gaea-cc 4 PKG:=$(shell go list -m) 5 6 .PHONY: all build gaea gaea-cc parser clean test build_with_coverage 7 all: build test 8 9 build: parser gaea gaea-cc 10 11 gaea: 12 go build -o $(GAEA_OUT) $(shell bash gen_ldflags.sh $(GAEA_OUT) $(PKG)/core $(PKG)/cmd/gaea) 13 14 gaea-cc: 15 go build -o $(GAEA_CC_OUT) $(shell bash gen_ldflags.sh $(GAEA_CC_OUT) $(PKG)/core $(PKG)/cmd/gaea-cc) 16 17 parser: 18 cd parser && make && cd .. 19 20 clean: 21 @rm -rf bin 22 @rm -f .coverage.out .coverage.html 23 24 test: 25 go test -coverprofile=.coverage.out ./... 26 go tool cover -func=.coverage.out -o .coverage.func 27 tail -1 .coverage.func 28 go tool cover -html=.coverage.out -o .coverage.html 29 30 build_with_coverage: 31 go test -c cmd/gaea/main.go cmd/gaea/main_test.go -coverpkg ./... -covermode=count -o bin/gaea