scorpiox-bot-plugin-tetris-3d
←Makefiletext
69 lines · 2 KBHEADBlameDownload
1# plugin_tetris_3d - SCORPIOX BOT open-source 3D block game
2#
3# Targets:
4# make native build -> ./plugin_tetris_3d
5# make musl static musl x86_64 -> ./plugin_tetris_3d.musl
6# make arm64 static aarch64 -> ./plugin_tetris_3d.arm64
7# make win64 MinGW-w64 static PE -> ./plugin_tetris_3d.exe
8# make macos Apple clang (run 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 -Wno-overlength-strings
16ARM_CC ?= aarch64-linux-gnu-gcc
17ARM_CFLAGS := -O2 -std=c99 -Wall -Wextra -static -Wno-overlength-strings
18WIN_CC ?= x86_64-w64-mingw32-gcc
19WIN_CFLAGS := -O2 -std=c99 -Wall -Wextra -static -Wno-overlength-strings
20SRC := src/plugin_tetris_3d.c
21BIN := plugin_tetris_3d
22EXE := plugin_tetris_3d.exe
23PREFIX ?= $(HOME)/.scorpiox/plugins
24
25.PHONY: all native musl arm64 win64 macos install test clean help
26
27all: native
28
29native: $(BIN)
30
31$(BIN): $(SRC) src/ui_html.h
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) src/ui_html.h
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) src/ui_html.h
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) src/ui_html.h
47 @echo "==> MinGW-w64 build ($(WIN_CC))"
48 $(WIN_CC) $(WIN_CFLAGS) -o $(EXE) $(SRC)
49
50# Apple clang build (run this on macOS)
51macos: $(SRC) src/ui_html.h
52 @echo "==> Apple clang build"
53 $(CC) -O2 -std=c99 -Wall -Wextra -Wno-overlength-strings -o $(BIN) $(SRC)
54
55install: native
56 @echo "==> install to $(PREFIX)"
57 mkdir -p "$(PREFIX)"
58 cp $(BIN) "$(PREFIX)/"
59 chmod +x "$(PREFIX)/$(BIN)"
60
61test: native
62 @sh tests/run.sh
63
64clean:
65 rm -f $(BIN) $(EXE) $(BIN).musl $(BIN).arm64 $(BIN).macos-arm64 $(BIN).macos-x86_64
66 rm -rf bin
67
68help:
69 @echo "make | make musl | make arm64 | make win64 | make macos | make install | make test | make clean"