makefile: distribution targets

This commit is contained in:
mappu 2017-05-21 14:51:22 +12:00
parent d7c3bfd1f5
commit 1c81444645

View File

@ -1,13 +1,19 @@
export PATH := /usr/lib/mxe/usr/bin:$(PATH) export PATH := /usr/lib/mxe/usr/bin:$(PATH)
GOFLAGS := -ldflags='-s -w' -gcflags='-trimpath=$(CURDIR)' -asmflags='-trimpath=$(CURDIR)' GOFLAGS := -ldflags='-s -w' -gcflags='-trimpath=$(CURDIR)' -asmflags='-trimpath=$(CURDIR)'
VERSION := 1.0.0
.PHONY: all clean .PHONY: all dist clean
all: \ all: \
qbolt/qbolt.a \ qbolt/qbolt.a \
build/linux/qbolt \ build/linux/qbolt \
build/win32/qbolt.exe build/win32/release/qbolt.exe
dist: \
build/dist/qbolt-${VERSION}-win32.zip \
build/dist/qbolt-${VERSION}-src.tar.gz \
build/dist/qbolt-${VERSION}-linux_amd64.tar.xz
clean: clean:
if [ -f qbolt/qbolt.a ] ; then rm qbolt/qbolt.a ; fi if [ -f qbolt/qbolt.a ] ; then rm qbolt/qbolt.a ; fi
@ -37,7 +43,28 @@ qbolt/qbolt.a: build/linux/qbolt.a
build/linux/qbolt: build/linux/qbolt.a qbolt/* build/linux/qbolt: build/linux/qbolt.a qbolt/*
cd build/linux && qmake ../../qbolt/qbolt.pro && make cd build/linux && qmake ../../qbolt/qbolt.pro && make
# Linux distribution
build/dist/qbolt-${VERSION}-linux_amd64.tar.xz: build/linux/qbolt
XZ_OPTS=-9 tar caf build/dist/qbolt-${VERSION}-linux_amd64.tar.xz -C build/linux qbolt --owner=0 --group=0
# Windows binaries # Windows binaries
build/win32/release/qbolt.exe: build/win32/qbolt.a qbolt/* build/win32/release/qbolt.exe: build/win32/qbolt.a qbolt/*
cd build/win32 && i686-w64-mingw32.static-qmake-qt5 ../../qbolt/qbolt.pro && make cd build/win32 && i686-w64-mingw32.static-qmake-qt5 ../../qbolt/qbolt.pro && make
# Windows distribution
build/win32/dist/qbolt.exe: build/win32/release/qbolt.exe
mkdir -p build/win32/dist
cp build/win32/release/qbolt.exe build/win32/dist/qbolt.exe
upx --lzma build/win32/dist/qbolt.exe
build/dist/qbolt-${VERSION}-win32.zip: build/win32/dist/qbolt.exe
mkdir -p build/dist
zip -0 -j build/dist/qbolt-${VERSION}-win32.zip build/win32/dist/qbolt.exe
# Source code archives
build/dist/qbolt-${VERSION}-src.tar.gz:
hg archive build/dist/qbolt-${VERSION}-src.tar.gz