From f4859b37d8627c24836127444a9aff22b313ceed Mon Sep 17 00:00:00 2001 From: jason-gao Date: Mon, 9 Dec 2019 16:47:40 +0800 Subject: [PATCH] add Makefile --- .gitignore | 2 +- Makefile | 41 +++++++++++++++++++++++++++++++++++++++++ mergeUpstream.sh | 7 +++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 Makefile create mode 100755 mergeUpstream.sh diff --git a/.gitignore b/.gitignore index 6f02f8d..7be961f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,4 @@ filegirl.yaml fileboy-darwin-amd64.bin fileboy-linux-amd64.bin fileboy-windows-amd64.exe - +./bin/* diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5433b28 --- /dev/null +++ b/Makefile @@ -0,0 +1,41 @@ +# notice +# Make is very picky about spaces vs. tabs. +# Command lines absolutely must be indented with a single tab, and not spaces. +# You may need to adjust your editor to generate tab characters. +# http://blog.chinaunix.net/uid/28458801/sid-171170-list-1.html + +# use: +# make build-mac 编译 +# make start-mac 启动 + +# make build-start-mac 编译+启动 +init: + go get gopkg.in/yaml.v2 + go get gopkg.in/fsnotify/fsnotify.v1 + +build-mac: ;@echo "编译-mac版"; + CGO_ENABLED=0 GOARCH=amd64 GOOS=darwin go build -ldflags "-s -w" -o ./bin/fileboy-darwin-amd64.bin + +build-linux: ;@echo "编译-linux版"; + CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -ldflags "-s -w" -o ./bin/fileboy-linux-amd64.bin + +build-win: ;@echo "编译-windows版"; + CGO_ENABLED=0 GOARCH=amd64 GOOS=windows go build -ldflags "-s -w" -o ./bin/fileboy-windows-amd64.exe + +build-all: build-mac build-linux build-win + +start-linux: ;@echo "启动服务"; + ./bin/fileboy-linux-amd64.bin init + ./bin/fileboy-linux-amd64.bin + +start-mac: ;@echo "启动服务"; + ./bin/fileboy-darwin-amd64.bin init + ./bin/fileboy-darwin-amd64.bin + +start-win: ;@echo "启动服务"; + ./bin/fileboy-windows-amd64.exe init + ./bin/fileboy-windows-amd64.exe + +build-start-mac: build-mac start-mac + +.PHONY: build-mac build-linux build-win build-all start-linux start-mac start-win build-start-mac \ No newline at end of file diff --git a/mergeUpstream.sh b/mergeUpstream.sh new file mode 100755 index 0000000..15074e5 --- /dev/null +++ b/mergeUpstream.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# 合并上游-fork来源 +git remote add upstream https://github.com/dengsgo/fileboy.git +git fetch upstream +git checkout master +git merge upstream/master \ No newline at end of file