Final CTI update
Adds build, install targets, updates test* targets Change-Id: Id7394568e4c99c7a56f3c48a6a2a8150c034719e
This commit is contained in:
parent
5999092516
commit
f8471e4334
41
Makefile
41
Makefile
@ -5,6 +5,7 @@
|
|||||||
#REPO_VERSION?=$(shell git describe --tags)
|
#REPO_VERSION?=$(shell git describe --tags)
|
||||||
|
|
||||||
GIT_HOST = git.openstack.org
|
GIT_HOST = git.openstack.org
|
||||||
|
SHELL := /bin/bash
|
||||||
|
|
||||||
PWD := $(shell pwd)
|
PWD := $(shell pwd)
|
||||||
BASE_DIR := $(shell basename $(PWD))
|
BASE_DIR := $(shell basename $(PWD))
|
||||||
@ -12,26 +13,54 @@ BASE_DIR := $(shell basename $(PWD))
|
|||||||
GOPATH_DEFAULT := $(PWD)/.go
|
GOPATH_DEFAULT := $(PWD)/.go
|
||||||
export GOPATH ?= $(GOPATH_DEFAULT)
|
export GOPATH ?= $(GOPATH_DEFAULT)
|
||||||
PKG := $(shell awk '/^package: / { print $$2 }' glide.yaml)
|
PKG := $(shell awk '/^package: / { print $$2 }' glide.yaml)
|
||||||
DEST := $(GOPATH)/src/$(GIT_HOST)/openstack/$(BASE_DIR)
|
|
||||||
DEST := $(GOPATH)/src/$(PKG)
|
DEST := $(GOPATH)/src/$(PKG)
|
||||||
|
|
||||||
|
GOFLAGS :=
|
||||||
|
TAGS :=
|
||||||
|
LDFLAGS :=
|
||||||
|
|
||||||
|
# Default target
|
||||||
|
.PHONY: all
|
||||||
|
all: build
|
||||||
|
|
||||||
# CTI targets
|
# CTI targets
|
||||||
|
|
||||||
|
.PHONY: depend
|
||||||
depend: work
|
depend: work
|
||||||
cd $(DEST) && glide install
|
cd $(DEST) && glide install
|
||||||
|
|
||||||
|
.PHONY: depend-update
|
||||||
depend-update: work
|
depend-update: work
|
||||||
cd $(DEST) && glide update
|
cd $(DEST) && glide update
|
||||||
|
|
||||||
test: unit functional
|
.PHONY: build
|
||||||
|
build: depend
|
||||||
|
cd $(DEST) && go build $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)'' ./...
|
||||||
|
|
||||||
unit: depend
|
.PHONY: install
|
||||||
cd $(DEST) && go test -tags=unit ./...
|
install: depend
|
||||||
|
cd $(DEST) && go install $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)'' ./...
|
||||||
|
|
||||||
functional:
|
.PHONY: test
|
||||||
@echo "$@ not yet implemented"
|
test: test-unit
|
||||||
|
|
||||||
|
.PHONY: test-unit
|
||||||
|
test-unit: depend
|
||||||
|
test-unit: TAGS += unit
|
||||||
|
test-unit: test-flags
|
||||||
|
|
||||||
|
.PHONY: test-flags
|
||||||
|
test-flags:
|
||||||
|
cd $(DEST) && go test $(GOFLAGS) -tags '$(TAGS)' ./...
|
||||||
|
|
||||||
|
# The above pipeline is required because gofmt always returns 0 and we need
|
||||||
|
# to detect if any files are listed as having format problems.
|
||||||
|
.PHONY: fmt
|
||||||
fmt: work
|
fmt: work
|
||||||
|
files=$$(cd $(DEST) && gofmt -l . | tee >(cat - >&2)); [ -z "$$files" ]
|
||||||
|
|
||||||
|
.PHONY: fmtfix
|
||||||
|
fmtfix: work
|
||||||
cd $(DEST) && go fmt ./...
|
cd $(DEST) && go fmt ./...
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user