Makefile 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. GOBIN ?= .
  2. GO111MODULE=on
  3. ifneq ($(OS),Windows_NT)
  4. EXE =
  5. else
  6. EXE = .exe
  7. endif
  8. PKG = $(shell go env GOOS)_$(shell go env GOARCH)
  9. TAGS ?=
  10. all: ${GOBIN}/hercules${EXE}
  11. test: all
  12. go test gopkg.in/src-d/hercules.v10
  13. ${GOBIN}/protoc-gen-gogo${EXE}:
  14. go build github.com/gogo/protobuf/protoc-gen-gogo
  15. ifneq ($(OS),Windows_NT)
  16. internal/pb/pb.pb.go: internal/pb/pb.proto ${GOBIN}/protoc-gen-gogo
  17. PATH="${PATH}:${GOBIN}" protoc --gogo_out=internal/pb --proto_path=internal/pb internal/pb/pb.proto
  18. else
  19. internal/pb/pb.pb.go: internal/pb/pb.proto ${GOBIN}/protoc-gen-gogo.exe
  20. export PATH="${PATH};${GOBIN}" && \
  21. protoc --gogo_out=internal/pb --proto_path=internal/pb internal/pb/pb.proto
  22. endif
  23. python/labours/pb_pb2.py: internal/pb/pb.proto
  24. protoc --python_out python/labours --proto_path=internal/pb internal/pb/pb.proto
  25. cmd/hercules/plugin_template_source.go: cmd/hercules/plugin.template
  26. cd cmd/hercules && go generate
  27. vendor:
  28. go mod vendor
  29. ${GOBIN}/hercules${EXE}: vendor *.go */*.go */*/*.go */*/*/*.go internal/pb/pb.pb.go python/labours/pb_pb2.py cmd/hercules/plugin_template_source.go
  30. go build -tags "$(TAGS)" -ldflags "-X gopkg.in/src-d/hercules.v10.BinaryGitHash=$(shell git rev-parse HEAD)" gopkg.in/src-d/hercules.v10/cmd/hercules