From 8dd52b852e670d573c889c08d0975c3225bf5a99 Mon Sep 17 00:00:00 2001 From: qianguozheng Date: Thu, 13 Sep 2018 11:11:26 +0800 Subject: [PATCH] import Makefile to compile linux/windows/macos platform support --- cmd/Makefile | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 cmd/Makefile diff --git a/cmd/Makefile b/cmd/Makefile new file mode 100644 index 0000000..d064ce6 --- /dev/null +++ b/cmd/Makefile @@ -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