Skip to content

Commit

Permalink
import Makefile to compile linux/windows/macos platform support
Browse files Browse the repository at this point in the history
  • Loading branch information
qianguozheng committed Sep 13, 2018
1 parent 6bb169b commit 8dd52b8
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions cmd/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
BUILD_NAME:=twitterdownloader
BUILD_VERSION:=1.0
SOURCE:=*.go
LDFLAGS:=-ldflags "-X main.Version=${BUILD_VERSION}"

all: deps build install

deps:
#安装依赖
#[ -x glide ] && glide install || yum install glide

test:
go test

build: test
go build -o ${BUILD_NAME} ${SOURCE}

build_linux: test
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ${BUILD_NAME} ${SOURCE}

build_win: test
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o ${BUILD_NAME} ${SOURCE}

build_macos: test
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o ${BUILD_NAME} ${SOURCE}

install: deps build
go install
#生成配置文件等
#cp app.conf.example /etc/app.conf
#release: build build_win build_macos

clean:
go clean

.PHONY: all deps test build build_linux build_win install clean

0 comments on commit 8dd52b8

Please sign in to comment.