diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..433bbf4 --- /dev/null +++ b/Makefile @@ -0,0 +1,73 @@ +# +# Makefile for contented +# + +VERSION:=1.0.0 + +SOURCES:=Makefile \ + static \ + cmd $(wildcard cmd/contented/*.go) \ + $(wildcard *.go) + +GOFLAGS := -ldflags='-s -w -X code.ivysaur.me/contented.SERVER_HEADER=contented/${VERSION}' -gcflags='-trimpath=$(GOPATH)' -asmflags='-trimpath=$(GOPATH)' + +# +# Phony targets +# + +.PHONY: all dist clean + +all: build/linux64/contented build/win32/contented.exe + +dist: \ + _dist/contented-$(VERSION)-linux64.tar.gz \ + _dist/contented-$(VERSION)-win32.7z \ + _dist/contented-$(VERSION)-src.zip + +clean: + if [ -f ./staticResources.go ] ; then rm ./staticResources.go ; fi + if [ -d ./build ] ; then rm -r ./build ; fi + if [ -f ./contented ] ; then rm ./contented ; fi + +# +# Generated files +# + +staticResources.go: static/ static/* + go-bindata -o staticResources.go -prefix static -pkg contented static + + +# +# Release artefacts +# + +build/linux64/contented: $(SOURCES) staticResources.go + mkdir -p build/linux64 + (cd cmd/contented ; \ + CGO_ENABLED=1 GOOS=linux GOARCH=amd64 \ + go build $(GOFLAGS) -o ../../build/linux64/contented \ + ) + +build/win32/contented.exe: $(SOURCES) staticResources.go + mkdir -p build/win32 + (cd cmd/contented ; \ + PATH=/usr/lib/mxe/usr/bin:$(PATH) CC=i686-w64-mingw32.static-gcc \ + CGO_ENABLED=1 GOOS=windows GOARCH=386 \ + go build $(GOFLAGS) -o ../../build/win32/contented.exe \ + ) + +_dist/contented-$(VERSION)-linux64.tar.gz: build/linux64/contented + mkdir -p _dist + tar caf _dist/contented-$(VERSION)-linux64.tar.gz -C build/linux64 contented --owner=0 --group=0 + +_dist/contented-$(VERSION)-win32.7z: build/win32/contented.exe + mkdir -p _dist + ( cd build/win32 ; \ + if [ -f dist.7z ] ; then rm dist.7z ; fi ; \ + 7z a dist.7z contented.exe ; \ + mv dist.7z ../../_dist/contented-$(VERSION)-win32.7z \ + ) + +_dist/contented-$(VERSION)-src.zip: $(SOURCES) + hg archive --type=zip _dist/contented-$(VERSION)-src.zip + diff --git a/Server.go b/Server.go index 000415c..3009734 100644 --- a/Server.go +++ b/Server.go @@ -10,7 +10,7 @@ import ( "github.com/mxk/go-flowrate/flowrate" ) -var SERVER_HEADER string = `contented/0.1` +var SERVER_HEADER string = `contented/0.0.0-dev` type ServerPublicProperties struct { AppTitle string