| 1 | # plugin_google_quota - SCORPIOX BOT open-source Google Antigravity quota monitor |
| 2 | # |
| 3 | # Targets: |
| 4 | # make native build -> ./plugin_google_quota |
| 5 | # make musl static musl x86_64 -> ./plugin_google_quota.musl |
| 6 | # make arm64 static arm64 musl (aarch64 cross) -> ./plugin_google_quota.arm64 |
| 7 | # make win64 MinGW-w64 static -> ./plugin_google_quota.exe |
| 8 | # make macos Apple clang -> ./plugin_google_quota (run this on macOS) |
| 9 | # make ui regenerate src/ui_html.h from src/ui.html |
| 10 | # make install copy the binary into this node's plugin directory |
| 11 | # make test build + run tests/run.sh |
| 12 | # make clean |
| 13 | |
| 14 | CC ?= cc |
| 15 | CFLAGS ?= -O2 -std=c99 -Wall -Wextra -pedantic -Wno-overlength-strings -Wno-format-truncation -I src |
| 16 | MUSL_CC ?= musl-gcc |
| 17 | MUSL_CFLAGS := -O2 -std=c99 -Wall -Wextra -Wno-overlength-strings -Wno-format-truncation -I src -static |
| 18 | ARM_CC ?= aarch64-linux-gnu-gcc |
| 19 | ARM_CFLAGS := -O2 -std=c99 -Wall -Wextra -Wno-overlength-strings -Wno-format-truncation -I src -static |
| 20 | WIN_CC ?= x86_64-w64-mingw32-gcc |
| 21 | WIN_CFLAGS := -O2 -std=c99 -Wall -Wextra -Wno-overlength-strings -Wno-format-truncation -I src -static |
| 22 | SRC := src/plugin_google_quota.c |
| 23 | UI_SRC := src/ui.html |
| 24 | UI_HDR := src/ui_html.h |
| 25 | BIN := plugin_google_quota |
| 26 | EXE := plugin_google_quota.exe |
| 27 | |
| 28 | .PHONY: all native musl arm64 win64 macos ui install test clean help |
| 29 | |
| 30 | all: native |
| 31 | |
| 32 | $(UI_HDR): $(UI_SRC) tools/gen_ui.py |
| 33 | @echo "==> regenerating $(UI_HDR)" |
| 34 | python3 tools/gen_ui.py |
| 35 | |
| 36 | ui: $(UI_HDR) |
| 37 | |
| 38 | native: $(BIN) |
| 39 | |
| 40 | $(BIN): $(SRC) $(UI_HDR) |
| 41 | @echo "==> native build ($(CC))" |
| 42 | $(CC) $(CFLAGS) -o $(BIN) $(SRC) |
| 43 | |
| 44 | # Static musl build - the universal Linux artifact (Alpine, Debian, Arch, Omarchy) |
| 45 | musl: $(SRC) $(UI_HDR) |
| 46 | @echo "==> static musl build ($(MUSL_CC))" |
| 47 | $(MUSL_CC) $(MUSL_CFLAGS) -o $(BIN).musl $(SRC) |
| 48 | |
| 49 | # Static aarch64 build - Raspberry Pi 5 / ARM64 servers |
| 50 | arm64: $(SRC) $(UI_HDR) |
| 51 | @echo "==> static arm64 build ($(ARM_CC))" |
| 52 | $(ARM_CC) $(ARM_CFLAGS) -o $(BIN).arm64 $(SRC) |
| 53 | |
| 54 | # Native Win64 static PE - runs on any Windows 10/11 x64 node |
| 55 | win64: $(SRC) $(UI_HDR) |
| 56 | @echo "==> MinGW-w64 build ($(WIN_CC))" |
| 57 | $(WIN_CC) $(WIN_CFLAGS) -o $(EXE) $(SRC) |
| 58 | |
| 59 | # Apple clang build (run this on macOS) |
| 60 | macos: $(SRC) $(UI_HDR) |
| 61 | @echo "==> Apple clang build" |
| 62 | clang -O2 -std=c99 -Wall -Wextra -Wno-overlength-strings -I src -o $(BIN) $(SRC) |
| 63 | |
| 64 | install: $(BIN) |
| 65 | @dest="$${HOME}/.scorpiox/plugins"; [ -d /workspace ] && dest="/workspace/.scorpiox/plugins"; \ |
| 66 | mkdir -p "$$dest" && cp $(BIN) "$$dest/$(BIN)" && chmod 0755 "$$dest/$(BIN)" && \ |
| 67 | echo "==> installed $$dest/$(BIN)" |
| 68 | |
| 69 | test: $(BIN) |
| 70 | sh tests/run.sh |
| 71 | |
| 72 | clean: |
| 73 | rm -f $(BIN) $(EXE) $(BIN).musl $(BIN).arm64 \ |
| 74 | $(BIN).macos-arm64 $(BIN).macos-x86_64 |
| 75 | rm -rf bin tests/__pycache__ |
| 76 | |
| 77 | help: |
| 78 | @sed -n '2,14p' $(MAKEFILE_LIST) |