@@ -43,7 +43,9 @@ SDL_LIB = ../external/sdl/build/lib/libSDL2-2.0.0.dylib
4343# Generated headers
4444LICENSE_HEADER = ../shared/license.h
4545BOOTROM_HEADER = ../shared/bootrom.h
46- BOOTROM_SOURCE = ../roms/Kiwi8_logo_2.ch8
46+
47+ # ROM Profiles database (source of truth)
48+ PROFILES_INI = ../shared/profiles.ini
4749
4850OBJS = audio.o \
4951 chip8.o \
@@ -60,11 +62,8 @@ OBJS = audio.o \
6062 imgui_impl_sdl.o \
6163 sha256.o
6264
63- DEPS = $(OBJS:.o=.d )
64-
65- PROFILES_INI = ../shared/profiles.ini
66-
6765# Include auto-generated dependency files (must be before targets)
66+ DEPS = $(OBJS:.o=.d )
6867-include $(DEPS )
6968
7069.DEFAULT_GOAL := all
@@ -81,14 +80,14 @@ $(SDL_LIB):
8180
8281# Generate license header from LICENSE file
8382$(LICENSE_HEADER ) : ../LICENSE
84- python3 ../tools/generate_license_header.py ../LICENSE $( LICENSE_HEADER )
83+ python3 ../tools/generate_license_header.py $< $@
8584
8685# Generate bootrom header from ROM file
87- $(BOOTROM_HEADER ) : $( BOOTROM_SOURCE )
88- python3 ../tools/generate_bootrom_header.py $( BOOTROM_SOURCE ) $( BOOTROM_HEADER )
86+ $(BOOTROM_HEADER ) : ../roms/Kiwi8_logo_2.ch8
87+ python3 ../tools/generate_bootrom_header.py $< $@
8988
9089# Generate Info.plist from template with version substitution
91- $(APP_MANIFEST ) : $( APP_MANIFEST ) .in
90+ $(APP_MANIFEST ) : src/Info.plist .in
9291 sed -e ' s/@APP_NAME@/$(APP_NAME)/g' -e ' s/@VERSION@/$(VERSION)/g' -e ' s/@SUB_VERSION@/$(SUB_VERSION)/g' $< > $@
9392
9493# Pattern rules for incremental compilation
@@ -110,13 +109,16 @@ $(APP_MANIFEST): $(APP_MANIFEST).in
110109% .o : ../shared/% .cc $(LICENSE_HEADER ) $(BOOTROM_HEADER )
111110 $(CXX ) $(CXXFLAGS ) $(CPPFLAGS ) $(INCLUDE_DIRS ) -c $< -o $@
112111
112+ % .i : % .c $(LICENSE_HEADER ) $(BOOTROM_HEADER )
113+ $(CC ) $(CFLAGS ) $(CPPFLAGS ) $(INCLUDE_DIRS ) -E $< -o $@
114+
113115debug/profiles.ini : $(PROFILES_INI )
114116 mkdir -p debug
115- cp $(PROFILES_INI ) debug/profiles.ini
117+ cp $(PROFILES_INI ) $@
116118
117119release/$(APP_BUNDLE ) /Contents/Resources/profiles.ini : $(PROFILES_INI )
118120 mkdir -p release/$(APP_BUNDLE ) /Contents/Resources
119- cp $(PROFILES_INI ) release/ $( APP_BUNDLE ) /Contents/Resources/profiles.ini
121+ cp $(PROFILES_INI ) $@
120122
121123# debug executable
122124debug/$(APP_EXE ) : $(SDL_LIB ) $(OBJS )
@@ -161,10 +163,10 @@ release/$(APP_BUNDLE)/Contents/Frameworks/libSDL2-2.0.0.dylib: $(SDL_LIB)
161163# .app bundle
162164release/$(APP_BUNDLE ) : release/$(APP_BUNDLE ) /Contents/MacOS/$(APP_EXE ) release/$(APP_BUNDLE ) /Contents/Info.plist release/$(APP_BUNDLE ) /Contents/Resources/Kiwi8.icns release/$(APP_BUNDLE ) /Contents/Frameworks/libSDL2-2.0.0.dylib
163165
164- run-debug : debug/$(APP_EXE )
166+ run-debug : debug/$(APP_EXE ) debug/profiles.ini
165167 ./debug/$(APP_EXE )
166168
167- run-release : release/$(APP_BUNDLE )
169+ run-release : release/$(APP_BUNDLE ) release/ $( APP_BUNDLE ) /Contents/Resources/profiles.ini
168170 open release/$(APP_BUNDLE )
169171
170172# Removes build artifacts (objects, app bundle) but keeps SDL
0 commit comments