X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=Makefile;h=52576170a5b4dbbb47b678dee3b15e2e3390e972;hb=a4e8bf2efe9189ce795f87ab07adbb3780d01d7d;hp=e5bd0bd04a4fb5aea1f66a1d030bf898e93f664d;hpb=280b1c6c83b676ef4e592f4ecf60cb5b54b6a753;p=govpp.git diff --git a/Makefile b/Makefile index e5bd0bd..5257617 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ SHELL := /usr/bin/env bash -o pipefail VERSION ?= $(shell git describe --always --tags --dirty) COMMIT ?= $(shell git rev-parse HEAD) -BUILD_STAMP ?= $(shell git log -1 --format="%ct") +BUILD_STAMP ?= $(shell git log -1 --format='%ct') BUILD_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD) BUILD_HOST ?= $(shell hostname) @@ -10,7 +10,7 @@ BUILD_USER ?= $(shell id -un) GO ?= go -GOVPP_PKG := $(shell go list) +GOVPP_PKG := git.fd.io/govpp.git LDFLAGS = \ -X ${GOVPP_PKG}/version.version=$(VERSION) \ -X ${GOVPP_PKG}/version.commitHash=$(COMMIT) \ @@ -24,7 +24,7 @@ endif GO_BUILD_TAGS ?= novpp -GO_BUILD_ARGS = -ldflags "${LDFLAGS}" +GO_BUILD_ARGS = -ldflags "$(LDFLAGS)" ifneq ($(GO_BUILD_TAGS),) GO_BUILD_ARGS += -tags="${GO_BUILD_TAGS}" endif @@ -38,13 +38,7 @@ endif VPP_VERSION = $(shell dpkg-query -f '\${Version}' -W vpp) VPP_IMG ?= ligato/vpp-base:latest -BINAPI_DIR ?= ./examples/binapi - -help: - @echo "List of make targets:" - grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' - -.DEFAULT = help +BINAPI_DIR ?= ./binapi bin: mkdir -p bin @@ -64,6 +58,7 @@ clean: ## Clean all $(GO) clean -v ./... test: ## Run unit tests + $(GO) version @echo "# running tests" $(GO) test -tags="${GO_BUILD_TAGS}" ./... @@ -79,7 +74,7 @@ install: install-generator install-proxy ## Install all install-generator: ## Install binapi-generator @echo "# installing binapi-generator ${VERSION}" - $(GO) install ${GO_BUILD_ARGS} ./cmd/binapi-generator + @$(GO) install ${GO_BUILD_ARGS} ./cmd/binapi-generator install-proxy: ## Install vpp-proxy @echo "# installing vpp-proxy ${VERSION}" @@ -97,15 +92,22 @@ gen-binapi-docker: install-generator ## Generate binapi code (using Docker) @echo "# generating binapi in docker image ${VPP_IMG}" $(eval cmds := $(shell go generate -n $(BINAPI_DIR) 2>&1 | tr "\n" ";")) docker run -t --rm \ + -e DEBUG_GOVPP \ -v "$(shell which binapi-generator):/usr/local/bin/binapi-generator:ro" \ - -v "$(shell pwd):/govpp" -w /govpp \ + -v "$(shell pwd):/govpp" \ + -w /govpp \ -u "$(shell id -u):$(shell id -g)" \ "${VPP_IMG}" \ - sh -exc "cd $(BINAPI_DIR) && $(cmds)" + sh -ec "cd $(BINAPI_DIR) && $(cmds)" extras: @make -C extras +help: + @echo "List of make targets:" + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + +.DEFAULT_GOAL = help .PHONY: help \ build cmd examples clean \