-
-
Save sohlich/f89a2fa39a79172d984c to your computer and use it in GitHub Desktop.
Makefile for Golang projects
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) | |
GOBUILD=$(GO) build | |
GOCLEAN=$(GO) clean | |
GOGET=$(GO) get | |
EXENAME=main | |
export GOPATH=$(CURDIR) | |
myname: | |
@echo "I am a makefile" | |
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 | |
get: | |
@$(GOGET) github.com/gorilla/mux | |
@$(GOGET) github.com/go-sql-driver/mysql | |
@$(GOGET) github.com/Sirupsen/logrus | |
build: | |
@echo "start building..." | |
$(GOBUILD) $(EXENAME) | |
@echo "Yay! all DONE!" | |
clean: | |
@echo "cleanning" | |
@rm -rf $(BUILDPATH)/bin/$(EXENAME) | |
@rm -rf $(BUILDPATH)/pkg | |
@rm -rf $(BUILDPATH)/src/github.com | |
all: makedir get build |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment