From c04301562e53169edbd0d1063cc6866bb652bf7f Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Sun, 15 Feb 2026 17:21:47 +0000 Subject: [PATCH] add macos target to Taskfile/makefile --- Taskfile.yml | 10 ++++++++++ makefile | 9 +++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 68535c3..03bb5dc 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -7,6 +7,7 @@ vars: WINDOWS: '{{.BIN_DIR}}/{{.PROGRAM}}_windows_amd64.exe' LINUX: '{{.BIN_DIR}}/{{.PROGRAM}}_linux_amd64' + MACOS: '{{.BIN_DIR}}/{{.PROGRAM}}_darwin_amd64' GIT_COMMIT: sh: git log -n 1 --format=%h @@ -22,6 +23,7 @@ tasks: cmds: - task: build-windows - task: build-linux + - task: build-macos vet: desc: Vet the code @@ -38,11 +40,19 @@ tasks: desc: Build the q3rcon project for Windows cmds: - GOOS=windows GOARCH=amd64 go build -o {{.WINDOWS}} -ldflags="-X main.Version={{.GIT_COMMIT}}" ./cmd/{{.PROGRAM}}/ + internal: true build-linux: desc: Build the q3rcon project for Linux cmds: - GOOS=linux GOARCH=amd64 go build -o {{.LINUX}} -ldflags="-X main.Version={{.GIT_COMMIT}}" ./cmd/{{.PROGRAM}}/ + internal: true + + build-macos: + desc: Build the q3rcon project for macOS + cmds: + - GOOS=darwin GOARCH=amd64 go build -o {{.MACOS}} -ldflags="-X main.Version={{.GIT_COMMIT}}" ./cmd/{{.PROGRAM}}/ + internal: true test: desc: Run tests diff --git a/makefile b/makefile index f279d9e..3eec03f 100644 --- a/makefile +++ b/makefile @@ -5,24 +5,26 @@ BIN_DIR := bin WINDOWS=$(BIN_DIR)/$(PROGRAM)_windows_amd64.exe LINUX=$(BIN_DIR)/$(PROGRAM)_linux_amd64 +MACOS=$(BIN_DIR)/$(PROGRAM)_darwin_amd64 VERSION=$(shell git log -n 1 --format=%h) .DEFAULT_GOAL := build -.PHONY: fmt vet build windows linux test clean +.PHONY: fmt vet build windows linux macos test clean fmt: $(GO) fmt ./... vet: fmt $(GO) vet ./... -build: vet windows linux | $(BIN_DIR) +build: vet windows linux macos | $(BIN_DIR) @echo version: $(VERSION) windows: $(WINDOWS) linux: $(LINUX) +macos: $(MACOS) $(WINDOWS): env GOOS=windows GOARCH=amd64 go build -v -o $(WINDOWS) -ldflags="-s -w -X main.version=$(VERSION)" ./cmd/$(PROGRAM)/ @@ -30,6 +32,9 @@ $(WINDOWS): $(LINUX): env GOOS=linux GOARCH=amd64 go build -v -o $(LINUX) -ldflags="-s -w -X main.version=$(VERSION)" ./cmd/$(PROGRAM)/ +$(MACOS): + env GOOS=darwin GOARCH=amd64 go build -v -o $(MACOS) -ldflags="-s -w -X main.version=$(VERSION)" ./cmd/$(PROGRAM)/ + test: $(GO) test ./...