SHELL := /bin/zsh # PLATFORM := $(shell go env GOOS) PLATFORM=linux # ARCH := $(shell go env GOARCH) ARCH := amd64 GOPATH := $(shell go env GOPATH) GOBIN := $(GOPATH)/bin TARGET := websocket-proxy # Go related variables. GO_PATH := $(PWD):$(PWD)/vendor:$(GOPATH) VERSION := 0.0.1 ifeq (run,$(firstword $(MAKECMDGOALS))) # use the rest as arguments for "run" RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) # ...and turn them into do-nothing targets # $(eval $(RUN_ARGS):;@:) endif all: build docker build: @echo ".:: buiding binary for $(PLATFORM) ::." @rm -f $(TARGET) @GOPATH=$(GO_PATH) GOOS=$(PLATFORM) GOARCH=$(ARCH) go build -o $(TARGET) . docker: @echo ".:: building docker image ::." @docker build -t kafka-websocket-go:$(VERSION) . run: @echo ".:: starting server ::." @echo " bootstrap servers : $(RUN_ARGS)" @go run serv.go -addr :9000 --bootstrap-servers $(RUN_ARGS) vendor: @echo ".:: update submodule ::." @git submodule init @git submodule update @dep update