2017-05-16 07:34:54 +00:00
|
|
|
|
2024-10-05 03:37:23 +00:00
|
|
|
VERSION := 1.0.3
|
|
|
|
GOFLAGS := -ldflags='-s -w -X main.Version=v$(VERSION)' -buildvcs=false -gcflags='-trimpath=$(CURDIR)' -asmflags='-trimpath=$(CURDIR)'
|
|
|
|
SHELL := /bin/bash
|
|
|
|
# Allow overriding DOCKER with e.g. sudo docker
|
|
|
|
DOCKER := docker
|
|
|
|
MIQT_UIC := miqt-uic
|
|
|
|
MIQT_RCC := miqt-rcc
|
|
|
|
SOURCES := $(wildcard *.go *.ui *.qrc)
|
|
|
|
GENERATED_SOURCES := resources.go mainwindow_ui.go itemwindow_ui.go
|
|
|
|
|
|
|
|
.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 03:37:23 +00:00
|
|
|
rm qbolt || true
|
|
|
|
rm -r build || true
|
2017-05-21 02:33:46 +00:00
|
|
|
|
2024-10-05 03:37:23 +00:00
|
|
|
# Linux binaries
|
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 03:37:23 +00:00
|
|
|
build/qbolt: $(SOURCES) $(GENERATED_SOURCES)
|
|
|
|
go build $(GOFLAGS) -o build/qbolt
|
|
|
|
upx build/qbolt
|
2017-05-21 02:33:46 +00:00
|
|
|
|
2017-05-21 02:51:22 +00:00
|
|
|
# Linux distribution
|
|
|
|
|
2024-10-05 03:37:23 +00:00
|
|
|
build/qbolt-${VERSION}-debian12-x86_64.tar.xz: build/qbolt
|
|
|
|
XZ_OPTS=-9 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
|
|
|
|
2021-04-12 05:44:17 +00:00
|
|
|
# Dockerized Windows build
|
|
|
|
|
2024-10-05 03:37:23 +00:00
|
|
|
build/qbolt.exe: $(SOURCES) $(GENERATED_SOURCES)
|
|
|
|
( $(DOCKER) image ls | fgrep qbolt-win64-cross ) || ( cd docker && $(DOCKER) build -t qbolt-win64-cross:latest -f win64-cross.Dockerfile . )
|
|
|
|
$(DOCKER) run --rm -v $(CURDIR):/qbolt -w /qbolt qbolt-win64-cross:latest /bin/sh -c "go build $(GOFLAGS) -o build/qbolt.exe"
|
|
|
|
upx 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
|
|
|
|
zip -0 -j build/dist/qbolt-${VERSION}-windows-x86_64.zip build/qbolt.exe
|