OpenStack API client for golang
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. # golang-client Makefile
  2. # Follows the interface defined in the Golang CTI proposed
  3. # in https://review.openstack.org/410355
  4. #REPO_VERSION?=$(shell git describe --tags)
  5. GIT_HOST = git.openstack.org
  6. SHELL := /bin/bash
  7. PWD := $(shell pwd)
  8. BASE_DIR := $(shell basename $(PWD))
  9. # Keep an existing GOPATH, make a private one if it is undefined
  10. GOPATH_DEFAULT := $(PWD)/.go
  11. export GOPATH ?= $(GOPATH_DEFAULT)
  12. PKG := $(shell awk '/^package: / { print $$2 }' glide.yaml)
  13. DEST := $(GOPATH)/src/$(PKG)
  14. GOFLAGS :=
  15. TAGS :=
  16. LDFLAGS :=
  17. # Default target
  18. .PHONY: all
  19. all: build
  20. # CTI targets
  21. .PHONY: depend
  22. depend: work
  23. cd $(DEST) && glide install
  24. .PHONY: depend-update
  25. depend-update: work
  26. cd $(DEST) && glide update
  27. .PHONY: build
  28. build: depend
  29. cd $(DEST) && go build $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)'' ./...
  30. .PHONY: install
  31. install: depend
  32. cd $(DEST) && go install $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)'' ./...
  33. .PHONY: test
  34. test: test-unit
  35. .PHONY: test-unit
  36. test-unit: depend
  37. test-unit: TAGS += unit
  38. test-unit: test-flags
  39. .PHONY: test-flags
  40. test-flags:
  41. cd $(DEST) && go test $(GOFLAGS) -tags '$(TAGS)' ./...
  42. # The above pipeline is required because gofmt always returns 0 and we need
  43. # to detect if any files are listed as having format problems.
  44. .PHONY: fmt
  45. fmt: work
  46. files=$$(cd $(DEST) && gofmt -l . | tee >(cat - >&2)); [ -z "$$files" ]
  47. .PHONY: fmtfix
  48. fmtfix: work
  49. cd $(DEST) && go fmt ./...
  50. lint:
  51. @echo "$@ not yet implemented"
  52. cover:
  53. @echo "$@ not yet implemented"
  54. docs:
  55. @echo "$@ not yet implemented"
  56. godoc:
  57. @echo "$@ not yet implemented"
  58. releasenotes:
  59. @echo "Reno not yet implemented for this repo"
  60. translation:
  61. @echo "$@ not yet implemented"
  62. # Do the work here
  63. # Set up the development environment
  64. env:
  65. @echo "PWD: $(PWD)"
  66. @echo "BASE_DIR: $(BASE_DIR)"
  67. @echo "GOPATH: $(GOPATH)"
  68. @echo "DEST: $(DEST)"
  69. @echo "PKG: $(PKG)"
  70. # Get our dev/test dependencies in place
  71. bootstrap:
  72. tools/test-setup.sh
  73. work: $(GOPATH) $(DEST)
  74. $(GOPATH):
  75. mkdir -p $(GOPATH)
  76. $(DEST): $(GOPATH)
  77. mkdir -p $(shell dirname $(DEST))
  78. ln -s $(PWD) $(DEST)
  79. .bindep:
  80. virtualenv .bindep
  81. .bindep/bin/pip install bindep
  82. bindep: .bindep
  83. @.bindep/bin/bindep -b -f bindep.txt || true
  84. install-distro-packages:
  85. tools/install-distro-packages.sh
  86. clean:
  87. rm -rf .bindep
  88. realclean: clean
  89. rm -rf vendor
  90. if [ "$(GOPATH)" = "$(GOPATH_DEFAULT)" ]; then \
  91. rm -rf $(GOPATH); \
  92. fi
  93. shell: work
  94. cd $(DEST) && $(SHELL) -i
  95. .PHONY: bindep clean cover depend docs fmt functional lint realclean \
  96. relnotes test translation