Skip to content

Commit 6ca2425

Browse files
committed
Make minimal build more robust with file existence checking and debugging
- Check which source files actually exist before including them in build - Dynamic object file list based on available sources - Added comprehensive debugging output to diagnose build failures - Better error handling to prevent script crashes from missing files This should resolve ExternalProject build failures by only compiling files that exist and providing detailed diagnostic information.
1 parent 56be964 commit 6ca2425

File tree

1 file changed

+33
-45
lines changed

1 file changed

+33
-45
lines changed

scripts/create-minimal-makefile.sh

Lines changed: 33 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33

44
set -e
55

6+
echo "=== Creating minimal build system for libatari800 ==="
7+
echo "PWD: $(pwd)"
8+
echo "Available files in src/:"
9+
ls -la src/ 2>/dev/null | head -10 || echo "Cannot list src/ directory"
10+
611
ATARI800_SRC_PATH="$1"
712

813
if [ -z "$ATARI800_SRC_PATH" ]; then
@@ -33,9 +38,34 @@ else
3338
fi
3439

3540
# Include real source files for full Windows functionality
41+
echo "Checking which source files exist..."
42+
43+
# List of source files we want to include (without .o extension)
44+
DESIRED_SOURCES="
45+
afile antic atari cartridge cpu esc gtia memory monitor pbi pia pokey pokeysnd
46+
sio sound statesav pbi_mio pbi_bb pbi_xld mzpokeysnd votraxsnd votrax pbi_scsi
47+
rtime cassette compfile cfg log util colours screen input binload devices
48+
img_tape remez lib
49+
"
50+
51+
# Check which files actually exist and build the object list
52+
EXISTING_OBJS=""
53+
for src in $DESIRED_SOURCES; do
54+
if [ -f "src/${src}.c" ]; then
55+
echo "Found: src/${src}.c"
56+
EXISTING_OBJS="$EXISTING_OBJS src/${src}.o"
57+
else
58+
echo "Missing: src/${src}.c - skipping"
59+
fi
60+
done
61+
62+
# Always include libatari800 API files
63+
EXISTING_OBJS="$EXISTING_OBJS src/libatari800/api.o src/libatari800/main.o src/libatari800/init.o src/libatari800/input.o src/libatari800/statesav.o"
64+
65+
echo "Will compile these object files: $EXISTING_OBJS"
3666

3767
# Create a basic Makefile that compiles the essential files for libatari800
38-
cat > Makefile << 'EOF'
68+
cat > Makefile << EOF
3969
# Minimal Makefile for libatari800
4070
# Generated when autotools are not available
4171
@@ -44,49 +74,7 @@ AR = ar
4474
CFLAGS = -O2 -DHAVE_CONFIG_H -I. -Isrc -DTARGET_LIBATARI800
4575
ARFLAGS = rcs
4676
47-
LIBATARI800_OBJS = \
48-
src/afile.o \
49-
src/antic.o \
50-
src/atari.o \
51-
src/cartridge.o \
52-
src/cpu.o \
53-
src/esc.o \
54-
src/gtia.o \
55-
src/memory.o \
56-
src/monitor.o \
57-
src/pbi.o \
58-
src/pia.o \
59-
src/pokey.o \
60-
src/pokeysnd.o \
61-
src/sio.o \
62-
src/sound.o \
63-
src/statesav.o \
64-
src/pbi_mio.o \
65-
src/pbi_bb.o \
66-
src/pbi_xld.o \
67-
src/mzpokeysnd.o \
68-
src/votraxsnd.o \
69-
src/votrax.o \
70-
src/pbi_scsi.o \
71-
src/rtime.o \
72-
src/cassette.o \
73-
src/compfile.o \
74-
src/cfg.o \
75-
src/log.o \
76-
src/util.o \
77-
src/colours.o \
78-
src/screen.o \
79-
src/input.o \
80-
src/binload.o \
81-
src/libatari800/api.o \
82-
src/libatari800/main.o \
83-
src/libatari800/init.o \
84-
src/libatari800/input.o \
85-
src/libatari800/statesav.o \
86-
src/devices.o \
87-
src/img_tape.o \
88-
src/remez.o \
89-
src/lib.o
77+
LIBATARI800_OBJS = $EXISTING_OBJS
9078
9179
all: src/libatari800.a
9280
@@ -101,7 +89,7 @@ src/libatari800.a: $(LIBATARI800_OBJS)
10189
$(CC) $(CFLAGS) -c $< -o $@
10290
10391
clean:
104-
rm -f $(LIBATARI800_OBJS) src/libatari800.a
92+
rm -f \$(LIBATARI800_OBJS) src/libatari800.a
10593
10694
.PHONY: all clean
10795
EOF

0 commit comments

Comments
 (0)