SDK STARTER

Makefile

native / musl / win64 / macos / test targets for the starter.

make1721 bytesAll starter files
# plugin_starter — the SCORPIOX BOT single-binary plugin SDK Makefile.
#
# Targets:
#   make            native build        -> ./plugin_starter
#   make musl       static musl x86_64  -> ./plugin_starter (universal Linux)
#   make win64      MinGW-w64 static    -> ./plugin_starter.exe
#   make macos      Apple clang         -> ./plugin_starter (run on macOS)
#   make test       build + smoke test
#   make clean
#
# No dependency beyond a C99 compiler. The output is one file named plugin_<x>;
# installing it is `cp` into a plugin directory. Nothing else is involved.

CC          ?= cc
CFLAGS      ?= -O2 -std=c99 -Wall -Wextra -pedantic -Wno-overlength-strings
MUSL_CC     ?= musl-gcc
MUSL_CFLAGS := -O2 -std=c99 -Wall -Wextra -Wno-overlength-strings -static
WIN_CC      ?= x86_64-w64-mingw32-gcc
WIN_CFLAGS  := -O2 -std=c99 -Wall -Wextra -Wno-overlength-strings -static
SRC         := plugin_starter.c
BIN         := plugin_starter
EXE         := plugin_starter.exe

.PHONY: all native musl win64 macos test clean help

all: native

native: $(BIN)

$(BIN): $(SRC)
	@echo "==> native build ($(CC))"
	$(CC) $(CFLAGS) -o $(BIN) $(SRC)

musl: $(SRC)
	@echo "==> static musl build ($(MUSL_CC))"
	$(MUSL_CC) $(MUSL_CFLAGS) -o $(BIN) $(SRC)

win64: $(SRC)
	@echo "==> MinGW-w64 build ($(WIN_CC))"
	$(WIN_CC) $(WIN_CFLAGS) -o $(EXE) $(SRC)

macos: $(SRC)
	@echo "==> Apple clang build"
	$(CC) $(CFLAGS) -o $(BIN) $(SRC)

test: native
	@echo "==> metadata"
	@./$(BIN) --meta
	@printf '==> json\n'
	@QUERY_STRING='action=info' ./$(BIN) | tail -n 1
	@printf '==> html\n'
	@QUERY_STRING='' ./$(BIN) | head -n 1

clean:
	rm -f $(BIN) $(EXE)

help:
	@echo "make | make musl | make win64 | make macos | make test | make clean"