forked from incident-io/nagios-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
32 lines (23 loc) · 970 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Makefile for the Nagios Incident.io Notification Plugin
# Name of the binary to generate (base name)
BINARY = notify_incident_io
# Version can be set manually or passed in from the GitHub Actions workflow
VERSION ?= development
# Go build flags with version information
BUILD_FLAGS = -ldflags "-s -w -X 'main.version=$(VERSION)'"
# Platforms to build for
PLATFORMS = linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64
.PHONY: all build clean release
# Default target: Build the binary for the current OS and architecture
all: build
# Build the binary for the current OS and architecture
build:
go build $(BUILD_FLAGS) -o $(BINARY) main.go
# Cross-compile binaries for all target platforms
release: clean
@for platform in $(PLATFORMS); do \
GOOS=$${platform%/*} GOARCH=$${platform#*/} go build $(BUILD_FLAGS) -o $(BINARY)-$${platform%/*}-$${platform#*/} main.go || exit 1; \
done
# Clean up build artifacts
clean:
rm -f $(BINARY) $(BINARY)-*