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