Makefile 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # Luis Figueiredo (luisf@casemyway.com)
  2. #
  3. GOPATH=$(CURDIR)/deps:$(CURDIR)
  4. DIST=./DIST
  5. BUILDENV=
  6. GETENV=
  7. # Source in packages names
  8. # What packages to build
  9. # CLI Packages
  10. CLI=flowserver/cmd/flowserver
  11. BIN=$(addprefix $(DIST)/, $(notdir $(CLI)))
  12. # Windows build
  13. ifeq ($(GOOS),windows)
  14. ENV+=CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ CGO_ENABLED=1 GOOS=$(GOOS) GOARCH=$(GOARCH)
  15. BIN:=$(addsuffix .exe, $(BIN))
  16. endif
  17. .PHONY: all deps clean dist-clean $(BIN)
  18. all: $(BIN) deps
  19. @$(ENV) echo -e "\e[32;01mBuilt for OS: `go env GOOS`, ARCH: `go env GOARCH`\e[0m"
  20. $(BIN): deps
  21. $(BUILDENV) GOPATH="$(GOPATH)" go build -o $@ $(CLI)
  22. # generate
  23. generate:
  24. GOPATH="$(GOPATH)" go generate -v ./src/...
  25. test:
  26. $(ENV) gocov test ./src/... | gocov report
  27. #$(BIN): $(addprefix src/,$(SOURCE))
  28. # echo $<
  29. deps:
  30. $(GETENV) GOPATH="$(GOPATH)" go get -v ./src/... # everything from source
  31. # test package
  32. $(GETENV) GOPATH="$(GOPATH)" go get -v -t ./src/...
  33. clean:
  34. rm -rf $(DIST)
  35. dist-clean: clean
  36. rm -rf bin
  37. rm -rf pkg
  38. rm -rf deps
  39. $(DIST):
  40. mkdir -p $(DIST)