Last active
April 11, 2018 16:23
-
-
Save jugyo/b47fe2c36262b9714d2ba1172c5ddc5f to your computer and use it in GitHub Desktop.
Makefile for go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GOCMD=go | |
GOBUILD=$(GOCMD) build | |
GOCLEAN=$(GOCMD) clean | |
GOTEST=$(GOCMD) test | |
GOGET=$(GOCMD) get | |
BINARY_NAME=mybinary | |
BINARY_LINUX=$(BINARY_NAME)_linux | |
all: test build | |
build: | |
GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_NAME) -v | |
test: | |
$(GOTEST) -v ./... | |
clean: | |
$(GOCLEAN) | |
rm -f $(BINARY_NAME) | |
rm -f $(BINARY_LINUX) | |
run: | |
$(GOBUILD) -o $(BINARY_NAME) -v ./... | |
./$(BINARY_NAME) | |
deps: | |
$(GOGET) cloud.google.com/go/storage | |
build-linux: | |
GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_LINUX) -v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment