diff options
author | Thomas Albers Raviola <thomas@thomaslabs.org> | 2025-02-13 01:48:01 +0100 |
---|---|---|
committer | Thomas Albers Raviola <thomas@thomaslabs.org> | 2025-02-13 01:48:01 +0100 |
commit | 70af8cae86d75b4b02e9f7bd7d3614262bc5eb16 (patch) | |
tree | 831401e72b02956863e31e6663aa9ab3b9b66eac /scripts/rules.mk | |
parent | 13c0217bf19a2ddfb24b673455f6d362a46ebf7b (diff) |
Diffstat (limited to 'scripts/rules.mk')
-rw-r--r-- | scripts/rules.mk | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/rules.mk b/scripts/rules.mk new file mode 100644 index 0000000..670cc98 --- /dev/null +++ b/scripts/rules.mk @@ -0,0 +1,26 @@ +INCLUDE = $(PROJECT_ROOT)/include + +DEPFLAGS = -MP -MMD -MF$(basename $@).d -MT$@ + +ASFLAGS = -g +ASCPPFLAGS = $(DEPFLAGS) -P -I$(INCLUDE) -DASSEMBLY +CFLAGS = -mz80 -I$(INCLUDE) --Werror $(patsubst %,-Wp%,$(DEPFLAGS)) +LDFLAGS = -mz80 --no-std-crt0 + +$(BUILD)/%.rel : %.asm + @echo ' (CPP)' $< + @$(CPP) $(ASCPPFLAGS) $< > $(basename $@).asm + @echo ' (AS)' $< + @$(AS) $(ASFLAGS) -o $@ $(basename $@).asm + +$(BUILD)/%.rel : %.c + @echo ' (CC)' $< + @$(CC) $(CFLAGS) -c -o $@ $< + +$(BUILD)/%.hex : $(BUILD)/%.ihx + @hex2bin.py $< $@ + +.SECONDARY : +$(BUILD)/%.ihx : + @echo ' (LD)' $@ ':' $(notdir $+) + @$(CC) $(LDFLAGS) $(EXTRA_LDFLAGS) -o $@ $+ |