Makefile 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. GOPATH ?= $(shell go env GOPATH)
  2. ifneq ($(OS),Windows_NT)
  3. EXE =
  4. else
  5. EXE = .exe
  6. endif
  7. PKG = $(shell go env GOOS)_$(shell go env GOARCH)
  8. TAGS ?=
  9. BBLFSH_DEP =
  10. all: ${GOPATH}/bin/hercules${EXE}
  11. test: all
  12. go test gopkg.in/src-d/hercules.v6
  13. ${GOPATH}/bin/protoc-gen-gogo${EXE}:
  14. go get -v github.com/gogo/protobuf/protoc-gen-gogo
  15. ifneq ($(OS),Windows_NT)
  16. internal/pb/pb.pb.go: internal/pb/pb.proto ${GOPATH}/bin/protoc-gen-gogo
  17. PATH=${PATH}:${GOPATH}/bin 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 ${GOPATH}/bin/protoc-gen-gogo.exe
  20. export PATH="${PATH};${GOPATH}\bin" && \
  21. protoc --gogo_out=internal/pb --proto_path=internal/pb internal/pb/pb.proto
  22. endif
  23. internal/pb/pb_pb2.py: internal/pb/pb.proto
  24. protoc --python_out internal/pb --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. dep ensure -v
  29. ifeq ($(OS),Windows_NT)
  30. BBLFSH_DEP = vendor/gopkg.in/bblfsh/client-go.v2/tools/include
  31. vendor/gopkg.in/bblfsh/client-go.v2/tools/include:
  32. cd vendor/gopkg.in/bblfsh/client-go.v2 && make cgo-dependencies
  33. endif
  34. ${GOPATH}/bin/hercules${EXE}: vendor *.go */*.go */*/*.go */*/*/*.go internal/pb/pb.pb.go internal/pb/pb_pb2.py cmd/hercules/plugin_template_source.go ${BBLFSH_DEP}
  35. go get -tags "$(TAGS)" -ldflags "-X gopkg.in/src-d/hercules.v6.BinaryGitHash=$(shell git rev-parse HEAD)" gopkg.in/src-d/hercules.v6/cmd/hercules