scorpiox-bot-plugin-ports
←Makefiletext
63 lines · 1 KBHEADBlameDownload
1# plugin_ports - SCORPIOX BOT open-source local listening socket inspector
2#
3# Targets:
4# make native build -> ./plugin_ports
5# make musl static musl x86_64 -> ./plugin_ports.musl
6# make arm64 static arm64 musl (aarch64 cross) -> ./plugin_ports.arm64
7# make win64 MinGW-w64 static -> ./plugin_ports.exe
8# make macos Apple clang -> ./plugin_ports (run this 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
16ARM_CC ?= aarch64-linux-gnu-gcc
17ARM_CFLAGS := -O2 -std=c99 -Wall -Wextra -static
18WIN_CC ?= x86_64-w64-mingw32-gcc
19WIN_CFLAGS := -O2 -std=c99 -Wall -Wextra -static
20WIN_LIBS := -liphlpapi -lws2_32
21SRC := src/plugin_ports.c
22BIN := plugin_ports
23EXE := plugin_ports.exe
24
25.PHONY: all native musl arm64 win64 macos test clean 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).musl $(SRC)
39
40# Static aarch64 build - Raspberry Pi 5 / ARM64 servers
41arm64: $(SRC)
42 @echo "==> static arm64 build ($(ARM_CC))"
43 $(ARM_CC) $(ARM_CFLAGS) -o $(BIN).arm64 $(SRC)
44
45# Native Win64 static PE - runs on any Windows 10/11 x64 node
46win64: $(SRC)
47 @echo "==> MinGW-w64 build ($(WIN_CC))"
48 $(WIN_CC) $(WIN_CFLAGS) -o $(EXE) $(SRC) $(WIN_LIBS)
49
50# Apple clang build (run this on macOS)
51macos: $(SRC)
52 @echo "==> Apple clang build"
53 $(CC) $(CFLAGS) -o $(BIN) $(SRC)
54
55test: native
56 @sh tests/run.sh
57
58clean:
59 rm -f $(BIN) $(EXE) $(BIN).musl $(BIN).arm64 $(BIN).macos-arm64 $(BIN).macos-x86_64
60 rm -rf bin
61
62help:
63 @echo "make | make musl | make arm64 | make win64 | make macos | make test | make clean"