Skip to content

Free games for graphing calculators: NumWorks, TI-Nspire CX, Casio fx-CG50 and soon TI-84 Plus CE. Balatro, Celeste, Hollow Knight, Minecraft and more.

Update Makefile

Lily Pitiot948361b8b241
diff --git a/Makefile b/Makefile
index f4383b01..41267f1b 100644
--- a/Makefile
+++ b/Makefile
@@ -16,6 +16,10 @@ ARM_OBJCOPY = arm-none-eabi-objcopy
PY ?= python3
CARGO ?= cargo
B = build/data
+# Conventional game Makefiles honor BUILD_DIR or OUT; unusual games remain local.
+GAMES_REDIRECT = balatro blockblast breakout buckshot celeste championisland chess connectfour cookieclicker dinorun doom finalearth2 flappybird fnaf g2048 hillclimb hollowknight invaders isaac leveldevil minesweeper numblocks numpowder numvisuals pacman portal pvz snake sokoban solitaire sonic subway sudoku twoplayer undertale uttt
+GAMES_OUT = dinorun
+GAME_REDIRECT_ARG = $(if $(filter $(1),$(GAMES_OUT)),OUT=../../$(B)/games/$(1),BUILD_DIR=../../$(B)/games/$(1))
# the RAM the oldest calculator software that runs apps gives them (23.2: 148928 bytes; 25.2 gives 153676).
# NumPlay itself takes less: a game goes on past it into the RAM the software has left (see
# tools/gen_games.py), so it installs with less too, custom builds of the software say, where a game that
@@ -76,10 +80,10 @@ $(B):
MOD_numdash = games/numdash/build/module.o
MOD_crossyroad = games/crossyroad/output/module.o
MOD_numdrive = games/numdrive/output/device/module.o
-MOD_balatro = games/balatro/output/module.o
-MOD_buckshot = games/buckshot/output/module.o
-MOD_portal = games/portal/output/module.o
-MOD_chess = games/chess/output/module.o
+MOD_balatro = $(B)/games/balatro/module.o
+MOD_buckshot = $(B)/games/buckshot/module.o
+MOD_portal = $(B)/games/portal/module.o
+MOD_chess = $(B)/games/chess/module.o
MOD_tetris = $(B)/tetris/raw.o
ENTRY = main
ENTRY_tetris = np_tetris_main
@@ -91,7 +95,7 @@ $(B)/tetris/raw.o: FORCE | $(B)
games/tetris/tetris/target/thumbv7em-none-eabihf/release/libtetris.a -o $@
$(B)/modules/%.o: FORCE | $(B)
- @if [ "$*" != tetris ]; then $(MAKE) --no-print-directory -C games/$* module NWLINK="$(NWLINK)"; \
+ @if [ "$*" != tetris ]; then $(MAKE) --no-print-directory -C games/$* module NWLINK="$(NWLINK)" $(if $(filter $*,$(GAMES_REDIRECT)),$(call GAME_REDIRECT_ARG,$*),); \
else $(MAKE) --no-print-directory $(MOD_tetris); fi
$(ARM_LD) -r -d -T tools/module.ld $(MOD_$*) -o $(B)/modules/$*.1.o
$(ARM_OBJCOPY) --keep-global-symbol=$(or $(ENTRY_$*),$(ENTRY)) \
@@ -102,7 +106,7 @@ $(B)/modules/%.o: FORCE | $(B)
--entry $(or $(ENTRY_$*),$(ENTRY)) --json $(B)/modules/$*.json
# games in the standard layout (see tools/games_mk.py)
-$(foreach g,$(STD_GAMES),$(eval MOD_$(g) = games/$(g)/output/module.o)$(eval SIM_$(g) = games/$(g)/output/sim-module.o))
+$(foreach g,$(STD_GAMES),$(eval MOD_$(g) = $(B)/games/$(g)/module.o)$(eval SIM_$(g) = $(B)/games/$(g)/sim-module.o))
MODULES = $(foreach g,$(GAMES),$(B)/modules/$(g).o)
@@ -194,53 +198,53 @@ $(foreach l,$(LANGS),$(B)/NumPlay-$(LANG_$(l)).nwa): $(B)/NumPlay-%.nwa: FORCE |
APP_numdash = games/numdash/build/numdash.nwa:NumDash.nwa
APP_crossyroad = games/crossyroad/output/crossyroad.nwa:CrossyRoad.nwa
APP_numdrive = games/numdrive/output/device/numdrive.nwa:NumDrive.nwa
-APP_balatro = games/balatro/output/balatro.nwa:Balatro.nwa
-APP_buckshot = games/buckshot/output/buckshot.nwa:BuckshotRoulette.nwa
-APP_portal = games/portal/output/portal.nwa:PortalReturns.nwa
-APP_chess = games/chess/output/chess.nwa:NumChess.nwa
+APP_balatro = $(B)/games/balatro/balatro.nwa:Balatro.nwa
+APP_buckshot = $(B)/games/buckshot/buckshot.nwa:BuckshotRoulette.nwa
+APP_portal = $(B)/games/portal/portal.nwa:PortalReturns.nwa
+APP_chess = $(B)/games/chess/chess.nwa:NumChess.nwa
APP_tetris = games/tetris/tetris/target/thumbv7em-none-eabihf/release/tetris:Tetris.nwa
-APP_numvisuals = games/numvisuals/output/numvisuals.nwa:NumVisuals.nwa
+APP_numvisuals = $(B)/games/numvisuals/numvisuals.nwa:NumVisuals.nwa
# too big to share the calculator's app space with NumPlay: only on their own
-APP_celeste = games/celeste/output/celeste.nwa:Celeste.nwa
-APP_championisland = games/championisland/output/championisland.nwa:ChampionIsland.nwa
-APP_hollowknight = games/hollowknight/output/hollowknight.nwa:HollowKnight.nwa
-APP_undertale = games/undertale/output/undertale.nwa:Undertale.nwa
-APP_subway = games/subway/output/subway.nwa:SubwaySurfers.nwa
-APP_fnaf = games/fnaf/output/fnaf.nwa:FiveNightsAtFreddys.nwa
-APP_hillclimb = games/hillclimb/output/hillclimb.nwa:HillClimbRacing.nwa
-APP_finalearth2 = games/finalearth2/output/finalearth2.nwa:FinalEarth2.nwa
-APP_numpowder = games/numpowder/output/numpowder.nwa:NumPowder.nwa
-APP_doom = games/doom/output/doom.nwa:Doom.nwa
-APP_isaac = games/isaac/output/isaac.nwa:BindingOfIsaac.nwa
-APP_pvz = games/pvz/output/pvz.nwa:PlantsVsZombies.nwa
-APP_sonic = games/sonic/output/sonic.nwa:SonicTheHedgehog.nwa
-APP_cookieclicker = games/cookieclicker/output/cookieclicker.nwa:CookieClicker.nwa
-APP_leveldevil = games/leveldevil/output/leveldevil.nwa:LevelDevil.nwa
+APP_celeste = $(B)/games/celeste/celeste.nwa:Celeste.nwa
+APP_championisland = $(B)/games/championisland/championisland.nwa:ChampionIsland.nwa
+APP_hollowknight = $(B)/games/hollowknight/hollowknight.nwa:HollowKnight.nwa
+APP_undertale = $(B)/games/undertale/undertale.nwa:Undertale.nwa
+APP_subway = $(B)/games/subway/subway.nwa:SubwaySurfers.nwa
+APP_fnaf = $(B)/games/fnaf/fnaf.nwa:FiveNightsAtFreddys.nwa
+APP_hillclimb = $(B)/games/hillclimb/hillclimb.nwa:HillClimbRacing.nwa
+APP_finalearth2 = $(B)/games/finalearth2/finalearth2.nwa:FinalEarth2.nwa
+APP_numpowder = $(B)/games/numpowder/numpowder.nwa:NumPowder.nwa
+APP_doom = $(B)/games/doom/doom.nwa:Doom.nwa
+APP_isaac = $(B)/games/isaac/isaac.nwa:BindingOfIsaac.nwa
+APP_pvz = $(B)/games/pvz/pvz.nwa:PlantsVsZombies.nwa
+APP_sonic = $(B)/games/sonic/sonic.nwa:SonicTheHedgehog.nwa
+APP_cookieclicker = $(B)/games/cookieclicker/cookieclicker.nwa:CookieClicker.nwa
+APP_leveldevil = $(B)/games/leveldevil/leveldevil.nwa:LevelDevil.nwa
apps: | $(B)
$(MAKE) -C games/numdash build NWLINK="node node_modules/nwlink/bin/nwlink"
$(MAKE) -C games/crossyroad NWLINK="$(NWLINK)"
$(MAKE) -C games/numdrive NWLINK="$(NWLINK)"
- $(MAKE) -C games/balatro build NWLINK="$(NWLINK)"
- $(MAKE) -C games/buckshot build NWLINK="$(NWLINK)"
- $(MAKE) -C games/portal build NWLINK="$(NWLINK)"
- $(MAKE) -C games/chess build NWLINK="$(NWLINK)"
- $(MAKE) -C games/numvisuals build NWLINK="$(NWLINK)"
- $(MAKE) -C games/celeste build NWLINK="$(NWLINK)"
- $(MAKE) -C games/championisland build NWLINK="$(NWLINK)"
- $(MAKE) -C games/hollowknight build NWLINK="$(NWLINK)"
- $(MAKE) -C games/undertale build NWLINK="$(NWLINK)"
- $(MAKE) -C games/subway build NWLINK="$(NWLINK)"
- $(MAKE) -C games/fnaf build NWLINK="$(NWLINK)"
- $(MAKE) -C games/hillclimb build NWLINK="$(NWLINK)"
- $(MAKE) -C games/finalearth2 build NWLINK="$(NWLINK)"
- $(MAKE) -C games/numpowder build NWLINK="$(NWLINK)"
- $(MAKE) -C games/doom build NWLINK="$(NWLINK)"
- $(MAKE) -C games/isaac build NWLINK="$(NWLINK)"
- $(MAKE) -C games/pvz build NWLINK="$(NWLINK)"
- $(MAKE) -C games/sonic build NWLINK="$(NWLINK)"
- $(MAKE) -C games/cookieclicker build NWLINK="$(NWLINK)"
- $(MAKE) -C games/leveldevil build NWLINK="$(NWLINK)"
+ $(MAKE) -C games/balatro build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/balatro
+ $(MAKE) -C games/buckshot build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/buckshot
+ $(MAKE) -C games/portal build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/portal
+ $(MAKE) -C games/chess build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/chess
+ $(MAKE) -C games/numvisuals build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/numvisuals
+ $(MAKE) -C games/celeste build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/celeste
+ $(MAKE) -C games/championisland build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/championisland
+ $(MAKE) -C games/hollowknight build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/hollowknight
+ $(MAKE) -C games/undertale build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/undertale
+ $(MAKE) -C games/subway build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/subway
+ $(MAKE) -C games/fnaf build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/fnaf
+ $(MAKE) -C games/hillclimb build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/hillclimb
+ $(MAKE) -C games/finalearth2 build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/finalearth2
+ $(MAKE) -C games/numpowder build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/numpowder
+ $(MAKE) -C games/doom build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/doom
+ $(MAKE) -C games/isaac build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/isaac
+ $(MAKE) -C games/pvz build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/pvz
+ $(MAKE) -C games/sonic build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/sonic
+ $(MAKE) -C games/cookieclicker build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/cookieclicker
+ $(MAKE) -C games/leveldevil build NWLINK="$(NWLINK)" BUILD_DIR=../../$(B)/games/leveldevil
cd games/tetris/tetris && NWLINK="$(NWLINK)" $(CARGO) build --release --quiet
cp $(word 1,$(subst :, ,$(APP_numdash))) $(B)/apps/$(word 2,$(subst :, ,$(APP_numdash)))
cp $(word 1,$(subst :, ,$(APP_crossyroad))) $(B)/apps/$(word 2,$(subst :, ,$(APP_crossyroad)))
@@ -271,17 +275,17 @@ apps: | $(B)
STD_APPS = $(foreach g,$(STD_GAMES),$(B)/apps/$(NWA_$(g)))
apps: $(STD_APPS)
$(STD_APPS): $(B)/apps/%.nwa: FORCE | $(B)
- $(MAKE) --no-print-directory -C games/$(APPID_$*) build NWLINK="$(NWLINK)"
- cp games/$(APPID_$*)/output/$(APPID_$*).nwa $@
+ $(MAKE) --no-print-directory -C games/$(APPID_$*) build NWLINK="$(NWLINK)" $(call GAME_REDIRECT_ARG,$(APPID_$*))
+ cp $(B)/games/$(APPID_$*)/$(APPID_$*).nwa $@
# ------------------------------------------------------------------ simulator
SIM_numdash = games/numdash/build/sim-module.o
SIM_crossyroad = games/crossyroad/output/sim-module.o
SIM_numdrive = games/numdrive/output/sim-module.o
-SIM_balatro = games/balatro/output/sim-module.o
-SIM_buckshot = games/buckshot/output/sim-module.o
-SIM_portal = games/portal/output/sim-module.o
-SIM_chess = games/chess/output/sim-module.o
+SIM_balatro = $(B)/games/balatro/sim-module.o
+SIM_buckshot = $(B)/games/buckshot/sim-module.o
+SIM_portal = $(B)/games/portal/sim-module.o
+SIM_chess = $(B)/games/chess/sim-module.o
SIM_tetris = $(B)/sim/tetris.o
SIM_CFLAGS = -std=gnu11 -O2 -fPIC -DNP_SIMULATOR=1 -DNP_VERSION='"$(VERSION)"' $(EADK_SIM_CFLAGS) -Ilauncher/src -Wall -Wno-unused-parameter
@@ -291,7 +295,7 @@ $(B)/sim/tetris.o: FORCE | $(B)
games/tetris/tetris/target/aarch64-apple-darwin/release/libtetris.a -o $@
$(B)/sim/%.mod: FORCE | $(B)
- @if [ "$*" != tetris ]; then $(MAKE) --no-print-directory -C games/$* sim-module NWLINK="$(NWLINK)"; \
+ @if [ "$*" != tetris ]; then $(MAKE) --no-print-directory -C games/$* sim-module NWLINK="$(NWLINK)" $(if $(filter $*,$(GAMES_REDIRECT)),$(call GAME_REDIRECT_ARG,$*),); \
else $(MAKE) --no-print-directory $(SIM_tetris); fi
$(B)/sim/gen/gametable.c: games/games.json tools/gen_games.py $(MODULES)