123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- # Luis Figueiredo (luisf@hexasoftware.com)
- #
- GOPATH=$(CURDIR)/deps:$(CURDIR)
- DIST=./DIST
- BUILDENV=
- GETENV=
- # Source in packages names
- # What packages to build
- # CLI Packages
- CLI=demos/cmd/demo1
- BIN=$(addprefix $(DIST)/, $(notdir $(CLI)))
- # Windows build
- ifeq ($(GOOS),windows)
- ENV+=CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ CGO_ENABLED=1 GOOS=$(GOOS) GOARCH=$(GOARCH)
- BIN:=$(addsuffix .exe, $(BIN))
- endif
- .PHONY: all deps clean dist-clean $(BIN)
- all: $(BIN) deps
- @$(ENV) echo -e "\e[32;01mBuilt for OS: `go env GOOS`, ARCH: `go env GOARCH`\e[0m"
-
- $(BIN): deps
- $(BUILDENV) GOPATH="$(GOPATH)" go build -o $@ $(CLI)
- # generate
- generate:
- GOPATH="$(GOPATH)" go generate -v ./src/...
- test:
- $(ENV) gocov test -race ./src/... | gocov report
- #$(BIN): $(addprefix src/,$(SOURCE))
- # echo $<
- deps:
- $(GETENV) GOPATH="$(GOPATH)" go get -v ./src/... # everything from source
- # test package
- $(GETENV) GOPATH="$(GOPATH)" go get -v -t ./src/...
- clean:
- rm -rf $(DIST)
- dist-clean: clean
- rm -rf bin
- rm -rf pkg
- rm -rf deps
- $(DIST):
- mkdir -p $(DIST)
|