Makefile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. ifneq (${DISABLE_TENSORFLOW},1)
  9. TAGS ?= tensorflow
  10. endif
  11. BBLFSH_DEP =
  12. all: ${GOPATH}/bin/hercules${EXE}
  13. test: all
  14. go test gopkg.in/src-d/hercules.v5
  15. ${GOPATH}/bin/protoc-gen-gogo${EXE}:
  16. go get -v github.com/gogo/protobuf/protoc-gen-gogo
  17. ifneq ($(OS),Windows_NT)
  18. internal/pb/pb.pb.go: internal/pb/pb.proto ${GOPATH}/bin/protoc-gen-gogo
  19. PATH=${PATH}:${GOPATH}/bin protoc --gogo_out=internal/pb --proto_path=internal/pb internal/pb/pb.proto
  20. else
  21. internal/pb/pb.pb.go: internal/pb/pb.proto ${GOPATH}/bin/protoc-gen-gogo.exe
  22. export PATH="${PATH};${GOPATH}\bin" && \
  23. protoc --gogo_out=internal/pb --proto_path=internal/pb internal/pb/pb.proto
  24. endif
  25. internal/pb/pb_pb2.py: internal/pb/pb.proto
  26. protoc --python_out internal/pb --proto_path=internal/pb internal/pb/pb.proto
  27. cmd/hercules/plugin_template_source.go: cmd/hercules/plugin.template
  28. cd cmd/hercules && go generate
  29. vendor:
  30. dep ensure -v
  31. ifeq ($(OS),Windows_NT)
  32. BBLFSH_DEP = vendor/gopkg.in/bblfsh/client-go.v2/tools/include
  33. vendor/gopkg.in/bblfsh/client-go.v2/tools/include:
  34. cd vendor/gopkg.in/bblfsh/client-go.v2 && make cgo-dependencies
  35. endif
  36. ${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}
  37. go get -tags "$(TAGS)" -ldflags "-X gopkg.in/src-d/hercules.v5.BinaryGitHash=$(shell git rev-parse HEAD)" gopkg.in/src-d/hercules.v5/cmd/hercules