Last active
June 5, 2016 16:03
-
-
Save vgangireddyin/72f4fe96170642816d7be17d8a90ca56 to your computer and use it in GitHub Desktop.
Basic Makefile for Golang
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
BUILDPATH=$(CURDIR) | |
GO=$(shell which go) | |
GOINSTALL=$(GO) install | |
GOCLEAN=$(GO) clean | |
GOGET=$(GO) get | |
EXENAME=main | |
export GOPATH=$(BUILDPATH) | |
makedir: | |
@echo "start building tree" | |
@if [ ! -d $(BUILDPATH)/bin ]; \ | |
then \ | |
mkdir -p $(BUILDPATH)/bin;\ | |
fi | |
@if [ ! -d $(BUILDPATH)/pkg ];\ | |
then \ | |
mkdir -p $(BUILDPATH)/pkg;\ | |
fi | |
@if [ ! -d $(BUILDPATH)/src ]; \ | |
then \ | |
mkdir -p $(BUILDPATH)/src;\ | |
fi | |
get: | |
@echo "getting all dependencies" | |
$(GOGET) | |
build: | |
$(GOINSTALL) $(EXENAME) | |
@echo "build sucessfully" | |
clean: | |
@rm -rf $(BUILDPATH)/bin/$(EXENAME) | |
@rm -rf $(BUILDPATH)/pkg | |
all: makedir get build |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment