scorpiox-bot-plugin-docker
←Makefiletext
67 lines · 2 KBHEADBlameDownload
1# plugin_docker — SCORPIOX BOT open-source container dashboard plugin
2# Targets:
3# make native build -> ./plugin_docker
4# make musl static musl x86_64 -> ./plugin_docker (fully static)
5# make arm64 static aarch64 -> ./plugin_docker.arm64 (Pi 5 / ARM64 servers)
6# make win64 MinGW-w64 static -> ./plugin_docker.exe
7# make macos Apple clang -> ./plugin_docker (run on macOS)
8# make test build + run tests/run.sh
9# make clean
10
11CC ?= cc
12CFLAGS ?= -O2 -std=c99 -Wall -Wextra -pedantic -Wno-overlength-strings
13MUSL_CC ?= musl-gcc
14MUSL_CFLAGS := -O2 -std=c99 -Wall -Wextra -static
15ARM64_CC ?= $(shell command -v aarch64-linux-musl-gcc 2>/dev/null || \
16 command -v aarch64-linux-gnu-gcc 2>/dev/null || \
17 echo aarch64-linux-musl-gcc)
18ARM64_CFLAGS := -O2 -std=c99 -Wall -Wextra -static
19WIN_CC ?= x86_64-w64-mingw32-gcc
20WIN_CFLAGS := -O2 -std=c99 -Wall -Wextra -static
21SRC := src/plugin_docker.c
22BIN := plugin_docker
23EXE := plugin_docker.exe
24
25.PHONY: all native musl arm64 win64 macos test clean distclean help
26
27all: native
28
29native: $(BIN)
30
31$(BIN): $(SRC)
32 @echo "==> native build ($(CC))"
33 $(CC) $(CFLAGS) -o $(BIN) $(SRC)
34
35# Static musl build — the universal Linux artifact (Alpine, Debian, Arch, Omarchy)
36musl: $(SRC)
37 @echo "==> static musl build ($(MUSL_CC))"
38 $(MUSL_CC) $(MUSL_CFLAGS) -o $(BIN) $(SRC)
39
40# Static aarch64 build — Raspberry Pi 5 / ARM64 servers. Prefers the musl cross
41# toolchain; the Debian aarch64-linux-gnu-gcc static link also yields a
42# self-contained aarch64 ELF.
43arm64: $(SRC)
44 @echo "==> static arm64 build ($(ARM64_CC))"
45 $(ARM64_CC) $(ARM64_CFLAGS) -o $(BIN).arm64 $(SRC)
46
47# Native Win64 static PE — runs on any Windows 10/11 x64 node
48win64: $(SRC)
49 @echo "==> MinGW-w64 build ($(WIN_CC))"
50 $(WIN_CC) $(WIN_CFLAGS) -o $(EXE) $(SRC)
51
52# Apple clang build (run this on macOS)
53macos: $(SRC)
54 @echo "==> Apple clang build"
55 $(CC) $(CFLAGS) -o $(BIN) $(SRC)
56
57test: native
58 @sh tests/run.sh
59
60clean:
61 rm -f $(BIN) $(EXE) $(BIN).arm64 $(BIN).musl $(BIN).macos-arm64 $(BIN).macos-x86_64
62 rm -rf bin
63
64distclean: clean
65
66help:
67 @echo "make | make musl | make arm64 | make win64 | make macos | make test | make clean"