mirror of
https://github.com/jimeh/rbheap.git
synced 2026-02-19 04:46:40 +00:00
50 lines
1005 B
Makefile
50 lines
1005 B
Makefile
DEV_DEPS = github.com/mailru/easyjson/...
|
|
|
|
NAME = rbheap
|
|
BINARY = bin/${NAME}
|
|
VERSION ?= $(shell cat VERSION)
|
|
|
|
SOURCES = $(shell find . -name '*.go' -o -name 'Makefile' -o -name 'VERSION')
|
|
|
|
all: bootstrap generate build
|
|
bootstrap: dev-deps dep-ensure
|
|
|
|
$(BINARY): $(SOURCES)
|
|
CGO_ENABLED=0 go build -a -o ${BINARY} -ldflags \ "\
|
|
-s -w \
|
|
-X main.version=${VERSION} \
|
|
-X main.commit=$(shell git show --format="%h" --no-patch) \
|
|
-X main.date=$(shell date +%Y-%m-%dT%T%z)"
|
|
|
|
.PHONY: build
|
|
build: $(BINARY)
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
$(eval BIN_DIR := $(shell dirname ${BINARY}))
|
|
if [ -f ${BINARY} ]; then rm ${BINARY}; fi
|
|
if [ -d ${BIN_DIR} ]; then rmdir ${BIN_DIR}; fi
|
|
|
|
.PHONY: test
|
|
test:
|
|
go test ./...
|
|
|
|
.PHONY: generate
|
|
generate: dev-deps
|
|
go generate ./...
|
|
|
|
%_easyjson.go: %.go
|
|
easyjson -all $^
|
|
|
|
.PHONY: dep-ensure
|
|
dep-ensure:
|
|
dep ensure
|
|
|
|
.PHONY: dev-deps
|
|
dev-deps:
|
|
@$(foreach DEP,$(DEV_DEPS),go get $(DEP);)
|
|
|
|
.PHONY: update-dev-deps
|
|
update-dev-deps:
|
|
@$(foreach DEP,$(DEV_DEPS),go get -u $(DEP);)
|