Skip to content
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.

Commit

Permalink
add makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
martinnirtl committed Feb 17, 2020
1 parent 9a0e23e commit 6e9a4be
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
export CGO_ENABLED = 0

export GO111MODULE := on

project_dir = $(shell pwd)
builds_dir = $(shell echo $${builds_dir:-$(project_dir)/builds})

UNAME_S := $(shell uname -s)
UNAME_P := $(shell uname -p)

GOOS = linux
ifeq ($(UNAME_S),Darwin)
GOOS = darwin
endif

GOARCH = amd64
ifneq ($(UNAME_P),x86_64)
GOARCH = 386
endif

.PHONY: _build
_build:
@echo "=> building dockma via go build"
@echo ""
@builds_dir=${builds_dir} GOOS=${GOOS} GOARCH=${GOARCH} go build -o "$(builds_dir)/dockma_$(GOOS)_$(GOARCH)" cmd/dockma.go
@echo "built $(builds_dir)/doctl_$(GOOS)_$(GOARCH)"

.PHONY: native
native: _build
@echo "==> build local version"
@echo ""
@mv $(builds_dir)/doctl_$(GOOS)_$(GOARCH) $(builds_dir)/doctl
@echo "installed as $(builds_dir)/doctl"

.PHONY: clean
clean:
@echo "==> remove builds"
@echo ""
@rm -rf builds

.PHONY: example
example:
@echo "==> test"
@echo ""
@echo "built $(builds_dir)/doctl_$(GOOS)_$(GOARCH)"

0 comments on commit 6e9a4be

Please sign in to comment.