Various bug fixes to assembler, added more data pointers.

This commit is contained in:
Anachronaut
2026-08-13 23:41:22 -04:00
parent b50210d127
commit c2440ae5fa
38 changed files with 1028 additions and 236 deletions
+20 -3
View File
@@ -7,6 +7,10 @@ CC ?= gcc
CFLAGS ?= -Wall -Os
PREFIX ?= /usr/local
# Have the compiler write out which headers each object depends on, so that
# editing a header rebuilds everything that includes it.
DEPFLAGS = -MMD -MP
# Directories
SRC_DIR_EMU = Source/Emulator
SRC_DIR_ASM = Source/Assembler
@@ -37,16 +41,29 @@ $(ASM_TARGET): $(ASM_OBJS)
# Compile emulator source files to object files
$(OBJ_DIR)/%.o: $(SRC_DIR_EMU)/%.c
mkdir -p $(OBJ_DIR)
$(CC) $(CFLAGS) -c $< -o $@
$(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
# Compile assembler source files to object files
$(OBJ_DIR)/%.o: $(SRC_DIR_ASM)/%.c
mkdir -p $(OBJ_DIR)
$(CC) $(CFLAGS) -c $< -o $@
$(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
# Pull in the header dependencies written out by the compiler above.
-include $(EMU_OBJS:.o=.d) $(ASM_OBJS:.o=.d)
# Run the test suite against the programs in Programs/
test: $(EMU_TARGET) $(ASM_TARGET)
@./Tests/run.sh
# Record the current output of every test as the expected result.
# Only do this when the current output is known to be correct.
bless: $(EMU_TARGET) $(ASM_TARGET)
@./Tests/run.sh --bless
# Clean up object and binary files
clean:
rm -rf $(OBJ_DIR)
rm -rf Tests/build
rm -f $(EMU_TARGET) $(ASM_TARGET)
# Install compiled binaries
@@ -55,4 +72,4 @@ install: $(EMU_TARGET) $(ASM_TARGET)
install -m 755 $^ "$(PREFIX)/bin/"
# Phony targets
.PHONY: all clean install
.PHONY: all clean install test bless