add Makefile

master
jason-gao 2019-12-09 16:47:40 +08:00
parent 06fb9f6a97
commit f4859b37d8
3 changed files with 49 additions and 1 deletions

2
.gitignore vendored
View File

@ -5,4 +5,4 @@ filegirl.yaml
fileboy-darwin-amd64.bin
fileboy-linux-amd64.bin
fileboy-windows-amd64.exe
./bin/*

41
Makefile Normal file
View File

@ -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

7
mergeUpstream.sh Executable file
View File

@ -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