Preparing for 2.0, improved dist command.

Packing binaries and files in a more sane manner, which should make
distributing releases easier moving forward. Will likely replace the
NAS_VERSION variable with something more dynamic moving forward.
This commit is contained in:
Gabriel Simmer 2020-04-06 23:56:57 +01:00
parent cdf8c9a598
commit 10779b8000
No known key found for this signature in database
GPG key ID: 33BA4D83B160A0A9

View file

@ -1,18 +1,22 @@
.DEFAULT_GOAL := build
NAS_VERSION := 2.0.0
build:
go build
make_build_dir:
mkdir -p build/{bin,assets,tars}
pi:
env GOOS=linux GOARCH=arm GOARM=5 go build -o nas-arm
build: make_build_dir
go build -o build/bin/nas
small:
go build -ldflags="-s -w"
upx --brute nas -9 --no-progress
pi: make_build_dir
env GOOS=linux GOARCH=arm GOARM=5 go build -o build/bin/nas-arm
small_pi:
env GOOS=linux GOARCH=arm GOARM=5 go build -o nas-arm -ldflags="-s -w"
upx --brute nas-arm -9 --no-progress
small: make_build_dir
go build -o build/bin/nas -ldflags="-s -w"
upx --brute build/bin/nas -9 --no-progress
small_pi: make_build_dir
env GOOS=linux GOARCH=arm GOARM=5 go build -o build/bin/nas-arm -ldflags="-s -w"
upx --brute build/bin/nas-arm -9 --no-progress
run:
go run webserver.go
@ -20,9 +24,10 @@ run:
test:
go test ./... -cover
dist: clean small small_pi
mkdir build
mv nas* build
dist: clean make_build_dir small small_pi
cp -r assets/* build/assets
tar -czf build/tars/nas-$(NAS_VERSION)-arm.tar.gz build/assets build/bin/nas-arm README.md LICENSE
tar -czf build/tars/nas-$(NAS_VERSION)-x86.tar.gz build/assets build/bin/nas README.md LICENSE
clean:
rm -rf build