Makefile 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. GOPATH ?= $(shell go env GOPATH)
  2. ifneq ($(OS),Windows_NT)
  3. EXE =
  4. else
  5. EXE = .exe
  6. ifneq (oneshell, $(findstring oneshell, $(.FEATURES)))
  7. $(error GNU make 3.82 or later is required)
  8. endif
  9. endif
  10. all: ${GOPATH}/bin/hercules${EXE}
  11. test: all
  12. go test gopkg.in/src-d/hercules.v3
  13. ${GOPATH}/bin/protoc-gen-gogo${EXE}:
  14. go get -v github.com/gogo/protobuf/protoc-gen-gogo
  15. ifneq ($(OS),Windows_NT)
  16. pb/pb.pb.go: pb/pb.proto ${GOPATH}/bin/protoc-gen-gogo
  17. PATH=${PATH}:${GOPATH}/bin protoc --gogo_out=pb --proto_path=pb pb/pb.proto
  18. else
  19. .ONESHELL:
  20. pb/pb.pb.go: pb/pb.proto ${GOPATH}/bin/protoc-gen-gogo.exe
  21. SET PATH=${PATH}${GOPATH}\bin
  22. protoc --gogo_out=pb --proto_path=pb pb/pb.proto
  23. endif
  24. pb/pb_pb2.py: pb/pb.proto
  25. protoc --python_out pb --proto_path=pb pb/pb.proto
  26. cmd/hercules/plugin_template_source.go: cmd/hercules/plugin.template
  27. cd cmd/hercules && go generate
  28. ifneq ($(OS),Windows_NT)
  29. ${GOPATH}/src/gopkg.in/bblfsh/client-go.v2:
  30. go get -d -v gopkg.in/bblfsh/client-go.v2/... && \
  31. cd ${GOPATH}/src/gopkg.in/bblfsh/client-go.v2 && \
  32. make dependencies
  33. else
  34. ${GOPATH}/src/gopkg.in/bblfsh/client-go.v2:
  35. echo Custom actions are needed, refer to https://github.com/bblfsh/client-go/blob/master/WINDOWS.md
  36. endif
  37. ${GOPATH}/bin/hercules${EXE}: *.go cmd/hercules/*.go rbtree/*.go yaml/*.go toposort/*.go pb/*.go ${GOPATH}/src/gopkg.in/bblfsh/client-go.v2 pb/pb.pb.go pb/pb_pb2.py cmd/hercules/plugin_template_source.go
  38. go get -ldflags "-X gopkg.in/src-d/hercules.v3.BinaryGitHash=$(shell git rev-parse HEAD)" gopkg.in/src-d/hercules.v3/cmd/hercules