2017-05-16 07:34:54 +00:00
|
|
|
|
2024-10-05 03:37:23 +00:00
|
|
|
VERSION := 1.0.3
|
2024-10-05 04:25:57 +00:00
|
|
|
GOFLAGS_L := -ldflags='-s -w -X main.Version=v$(VERSION)' -buildvcs=false -gcflags='-trimpath=$(CURDIR)' -asmflags='-trimpath=$(CURDIR)'
|
|
|
|
GOFLAGS_W := -ldflags='-s -w -X main.Version=v$(VERSION) -H windowsgui' -buildvcs=false --tags=windowsqtstatic -gcflags='-trimpath=$(CURDIR)' -asmflags='-trimpath=$(CURDIR)'
|
2024-10-05 03:37:23 +00:00
|
|
|
SHELL := /bin/bash
|
|
|
|
# Allow overriding DOCKER with e.g. sudo docker
|
|
|
|
DOCKER := docker
|
|
|
|
MIQT_UIC := miqt-uic
|
|
|
|
MIQT_RCC := miqt-rcc
|
2024-10-05 04:25:57 +00:00
|
|
|
GO_WINRES := go-winres
|
|
|
|
SOURCES := $(wildcard *.go *.ui *.qrc) resources.go mainwindow_ui.go itemwindow_ui.go rsrc_windows_amd64.syso
|
2024-10-05 03:37:23 +00:00
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
all: build/qbolt build/qbolt.exe
|
|
|
|
|
|
|
|
.PHONY: dist
|
|
|
|
dist: build/qbolt-${VERSION}-windows-x86_64.zip build/qbolt-${VERSION}-debian12-x86_64.tar.xz
|
|
|
|
|
|
|
|
.PHONY: clean
|
2017-05-16 07:34:54 +00:00
|
|
|
clean:
|
2024-10-05 04:25:57 +00:00
|
|
|
rm -f qbolt || true
|
|
|
|
rm -rf build || true
|
|
|
|
rm -f windows-manifest.json || true
|
2017-05-21 02:33:46 +00:00
|
|
|
|
2024-10-05 04:25:57 +00:00
|
|
|
# Generated files
|
2017-05-21 02:33:46 +00:00
|
|
|
|
2024-10-05 03:37:23 +00:00
|
|
|
resources.rcc resources.go: resources.qrc
|
|
|
|
$(MIQT_RCC) resources.qrc
|
2017-05-21 02:33:46 +00:00
|
|
|
|
2024-10-05 03:37:23 +00:00
|
|
|
mainwindow_ui.go: mainwindow.ui
|
|
|
|
$(MIQT_UIC) -InFile mainwindow.ui -OutFile mainwindow_ui.go
|
2017-05-21 02:33:46 +00:00
|
|
|
|
2024-10-05 03:37:23 +00:00
|
|
|
itemwindow_ui.go: itemwindow.ui
|
|
|
|
$(MIQT_UIC) -InFile itemwindow.ui -OutFile itemwindow_ui.go
|
2017-05-20 02:57:19 +00:00
|
|
|
|
2024-10-05 04:25:57 +00:00
|
|
|
windows-manifest.json: windows-manifest.template.json Makefile
|
|
|
|
cat windows-manifest.template.json | sed -re 's_%VERSION%_$(VERSION)_' > windows-manifest.json
|
|
|
|
|
|
|
|
rsrc_windows_amd64.syso: windows-manifest.json
|
|
|
|
$(GO_WINRES) make --in windows-manifest.json
|
|
|
|
rm rsrc_windows_386.syso || true # we do not build x86_32
|
|
|
|
|
|
|
|
# Linux release
|
|
|
|
|
|
|
|
build/qbolt: $(SOURCES)
|
|
|
|
go build $(GOFLAGS_L) -o build/qbolt
|
2024-10-05 03:37:23 +00:00
|
|
|
upx build/qbolt
|
2017-05-21 02:33:46 +00:00
|
|
|
|
2024-10-05 03:37:23 +00:00
|
|
|
build/qbolt-${VERSION}-debian12-x86_64.tar.xz: build/qbolt
|
2024-10-05 04:25:57 +00:00
|
|
|
XZ_OPTS=-9e tar caf build/qbolt-${VERSION}-debian12-x86_64.tar.xz -C build qbolt --owner=0 --group=0
|
2017-05-21 02:51:22 +00:00
|
|
|
|
2024-10-05 04:25:57 +00:00
|
|
|
# Windows release (docker)
|
2021-04-12 05:44:17 +00:00
|
|
|
|
2024-10-05 04:25:57 +00:00
|
|
|
build/qbolt.exe: $(SOURCES)
|
2024-10-05 03:37:23 +00:00
|
|
|
( $(DOCKER) image ls | fgrep qbolt-win64-cross ) || ( cd docker && $(DOCKER) build -t qbolt-win64-cross:latest -f win64-cross.Dockerfile . )
|
2024-10-05 04:25:57 +00:00
|
|
|
$(DOCKER) run --rm -v $(CURDIR):/qbolt -w /qbolt qbolt-win64-cross:latest /bin/sh -c "go build $(GOFLAGS_W) -o build/qbolt.exe"
|
|
|
|
upx --force build/qbolt.exe
|
2021-04-12 05:44:17 +00:00
|
|
|
|
2024-10-05 03:37:23 +00:00
|
|
|
build/qbolt-${VERSION}-windows-x86_64.zip: build/qbolt.exe
|
2024-10-05 04:25:57 +00:00
|
|
|
zip -9 -j build/qbolt-${VERSION}-windows-x86_64.zip build/qbolt.exe
|