~welt/murse

8b059d08e0764ea1f6bd414d426fa44f6274421d — welt 2 months ago a4599da
Update Makefile.
1 files changed, 65 insertions(+), 2 deletions(-)

M Makefile
M Makefile => Makefile +65 -2
@@ 1,4 1,67 @@
.POSIX:

REF := $(shell ( git describe --tags --exact-match 2>/dev/null || git rev-parse HEAD ) | sed 1q )
TMPDIR = /tmp/murse-$(REF)

default:
	go build -tags netgo -ldflags '-s -w' -o build/linux/murse

all: clean linux linux386 windows windows386

clean:
	rm -rf build 

linux:
	CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags netgo -ldflags '-s -w' -o murse
	mkdir -p build/linux/amd64
	CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags netgo -ldflags '-s -w' -o build/linux/amd64/murse
linux386:
	mkdir -p build/linux/386
	CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -tags netgo -ldflags '-s -w' -o build/linux/386/murse
windows:
	CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -tags netgo -ldflags "-s -w" -o murse.exe 
	mkdir -p build/windows/amd64
	CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -tags netgo -ldflags "-s -w" -o build/windows/amd64/murse.exe 
windows386:
	mkdir -p build/windows/386
	CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -tags netgo -ldflags "-s -w" -o build/windows/386/murse.exe

release:
	rm -rf $(TMPDIR)
	mkdir $(TMPDIR)
	git clone ./ $(TMPDIR)

	cd $(TMPDIR);\
	git checkout $(REF);\
	go mod vendor;\

	cd $(TMPDIR);\
	make all sign archive
	
	mkdir -p build/artifacts
	cp $(TMPDIR)/build/artifacts/* build/artifacts/

	cd $(TMPDIR);\
	make clean;\
	rm -rf .git

	tar czf build/artifacts/murse-$(REF)-src.tar.gz  -C $(TMPDIR)/ .

	rm -rf $(TMPDIR)

upload:
	hut git artifact upload build/artifacts/*

archive:
	mkdir -p build/artifacts
	tar czf build/artifacts/murse-$(REF)-linux-amd64.tar.gz build/linux/amd64/*
	tar czf build/artifacts/murse-$(REF)-linux-386.tar.gz build/linux/386/*
	zip build/murse-$(REF)-windows-amd64.zip build/windows/amd64/*
	zip build/murse-$(REF)-windows-386.zip build/windows/386/*

sign:
	gpg --output build/linux/amd64/murse.sig --detach-sig build/linux/amd64/murse
	gpg --output build/linux/386/murse.sig --detach-sig build/linux/386/murse
	gpg --output build/windows/amd64/murse.exe.sig --detach-sig build/windows/amd64/murse.exe
	gpg --output build/windows/386/murse.exe.sig --detach-sig build/windows/386/murse.exe

ref:
	@echo $(REF)
\ No newline at end of file