| 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 | |
| 12 | CC ?= cc |
| 13 | CFLAGS ?= -O2 -std=c99 -Wall -Wextra -pedantic -Wno-overlength-strings |
| 14 | MUSL_CC ?= musl-gcc |
| 15 | MUSL_CFLAGS := -O2 -std=c99 -Wall -Wextra -static |
| 16 | ARM64_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) |
| 19 | ARM64_CFLAGS := -O2 -std=c99 -Wall -Wextra -static |
| 20 | WIN_CC ?= x86_64-w64-mingw32-gcc |
| 21 | WIN_CFLAGS := -O2 -std=c99 -Wall -Wextra -static |
| 22 | SRC := src/plugin_hello.c |
| 23 | BIN := plugin_hello |
| 24 | EXE := plugin_hello.exe |
| 25 | |
| 26 | .PHONY: all native musl arm64 win64 macos test clean distclean help |
| 27 | |
| 28 | all: native |
| 29 | |
| 30 | native: $(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) |
| 37 | musl: $(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. |
| 44 | arm64: $(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 |
| 49 | win64: $(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) |
| 54 | macos: $(SRC) |
| 55 | @echo "==> Apple clang build" |
| 56 | $(CC) $(CFLAGS) -o $(BIN) $(SRC) |
| 57 | |
| 58 | test: native |
| 59 | @sh tests/run.sh |
| 60 | |
| 61 | clean: |
| 62 | rm -f $(BIN) $(EXE) $(BIN).arm64 $(BIN).musl $(BIN).macos-arm64 $(BIN).macos-x86_64 |
| 63 | rm -rf bin |
| 64 | |
| 65 | distclean: clean |
| 66 | |
| 67 | help: |
| 68 | @echo "make | make musl | make arm64 | make win64 | make macos | make test | make clean" |