Monorepo for Aesthetic.Computer
aesthetic.computer
1#!/usr/bin/env fish
2
3# Compile all GBDK examples - auto-detect if GBC features are needed
4set GBDK_BIN /workspaces/aesthetic-computer/kidlisp-gameboy/gbdk/bin/lcc
5set EXAMPLES_DIR /workspaces/aesthetic-computer/kidlisp-gameboy/gbdk/examples/gb
6set OUTPUT_DIR /workspaces/aesthetic-computer/system/public/assets/gameboy/gbdk
7
8echo "🎮 Compiling GBDK examples (auto-detecting GB/GBC)..."
9
10# Find all standalone .c files in examples
11set examples galaxy/galaxy filltest/filltest colorbar/colorbar sound/sound \
12 rand/rand dscan/dscan template_minimal/main
13
14for example in $examples
15 set dir (dirname $example)
16 set file (basename $example)
17 set name (basename $example .c)
18 set source_file $EXAMPLES_DIR/$dir/$file.c
19
20 # Auto-detect if GBC features are used
21 set is_gbc false
22 set extension gb
23 set flags ""
24
25 # Check for GBC indicators: cgb.h include or CGB-specific functions
26 if grep -q "gb/cgb.h\|set_bkg_palette\|set_sprite_palette\|CGBPal" $source_file
27 set is_gbc true
28 set extension gbc
29 set flags "-Wm-yc"
30 echo " Compiling $dir/$file.c -> $name.gbc (GBC)"
31 else
32 echo " Compiling $dir/$file.c -> $name.gb (GB)"
33 end
34
35 cd $EXAMPLES_DIR/$dir
36 $GBDK_BIN $flags -o $name.$extension $file.c 2>&1 | grep -v "^$file.c:"
37
38 if test -f $name.$extension
39 cp $name.$extension $OUTPUT_DIR/
40 echo " ✓ $name.$extension"
41 else
42 echo " ✗ Failed: $name.$extension"
43 end
44end
45
46cd $OUTPUT_DIR
47echo ""
48echo "✅ Compiled examples:"
49ls -1 *.gb *.gbc 2>/dev/null
50echo ""
51echo "Total: "(ls -1 *.gb *.gbc 2>/dev/null | wc -l)" ROMs"