| 1 | # plugin_sysmon - SCORPIOX BOT open-source local system monitor plugin |
| 2 | # |
| 3 | # Targets: |
| 4 | # make native build -> ./plugin_sysmon |
| 5 | # make musl static musl x86_64 -> ./plugin_sysmon (fully static) |
| 6 | # make win64 MinGW-w64 static -> ./plugin_sysmon.exe |
| 7 | # make macos Apple clang -> ./plugin_sysmon (run on macOS) |
| 8 | # make test build + run tests/run.sh |
| 9 | # make clean |
| 10 | |
| 11 | CC ?= cc |
| 12 | CFLAGS ?= -O2 -std=c99 -Wall -Wextra -pedantic -Wno-overlength-strings |
| 13 | MUSL_CC ?= musl-gcc |
| 14 | MUSL_CFLAGS := -O2 -std=c99 -Wall -Wextra -static |
| 15 | WIN_CC ?= x86_64-w64-mingw32-gcc |
| 16 | WIN_CFLAGS := -O2 -std=c99 -Wall -Wextra -static |
| 17 | WIN_LIBS := -lpsapi |
| 18 | SRC := src/plugin_sysmon.c |
| 19 | BIN := plugin_sysmon |
| 20 | EXE := plugin_sysmon.exe |
| 21 | |
| 22 | .PHONY: all native musl win64 macos test clean help |
| 23 | |
| 24 | all: native |
| 25 | |
| 26 | native: $(BIN) |
| 27 | |
| 28 | $(BIN): $(SRC) |
| 29 | @echo "==> native build ($(CC))" |
| 30 | $(CC) $(CFLAGS) -o $(BIN) $(SRC) |
| 31 | |
| 32 | # Static musl build - the universal Linux artifact (Alpine, Debian, Arch, Omarchy) |
| 33 | musl: $(SRC) |
| 34 | @echo "==> static musl build ($(MUSL_CC))" |
| 35 | $(MUSL_CC) $(MUSL_CFLAGS) -o $(BIN) $(SRC) |
| 36 | |
| 37 | # Native Win64 static PE - runs on any Windows 10/11 x64 node |
| 38 | win64: $(SRC) |
| 39 | @echo "==> MinGW-w64 build ($(WIN_CC))" |
| 40 | $(WIN_CC) $(WIN_CFLAGS) -o $(EXE) $(SRC) $(WIN_LIBS) |
| 41 | |
| 42 | # Apple clang build (run this on macOS) |
| 43 | macos: $(SRC) |
| 44 | @echo "==> Apple clang build" |
| 45 | $(CC) $(CFLAGS) -o $(BIN) $(SRC) |
| 46 | |
| 47 | test: native |
| 48 | @sh tests/run.sh |
| 49 | |
| 50 | clean: |
| 51 | rm -f $(BIN) $(EXE) $(BIN).musl $(BIN).macos-arm64 $(BIN).macos-x86_64 |
| 52 | rm -rf bin |
| 53 | |
| 54 | help: |
| 55 | @echo "make | make musl | make win64 | make macos | make test | make clean" |