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 clean: rm qbolt || true rm -r build || true # Linux binaries resources.rcc resources.go: resources.qrc $(MIQT_RCC) resources.qrc mainwindow_ui.go: mainwindow.ui $(MIQT_UIC) -InFile mainwindow.ui -OutFile mainwindow_ui.go itemwindow_ui.go: itemwindow.ui $(MIQT_UIC) -InFile itemwindow.ui -OutFile itemwindow_ui.go build/qbolt: $(SOURCES) $(GENERATED_SOURCES) go build $(GOFLAGS) -o build/qbolt upx build/qbolt # Linux distribution 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 # Dockerized Windows build 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 build/qbolt-${VERSION}-windows-x86_64.zip: build/qbolt.exe zip -0 -j build/dist/qbolt-${VERSION}-windows-x86_64.zip build/qbolt.exe