First commit

This commit is contained in:
2021-01-08 04:13:16 +01:00
commit 64af61ba12
8 changed files with 2952 additions and 0 deletions

44
Makefile Normal file
View File

@@ -0,0 +1,44 @@
AS = sdasz80
CC = sdcc
AR = sdar
LD = sdldz80
OBJCOPY = sdobjcopy
BUILD = .build
TARGET = tetris
OPT = s
CFLAGS = -mz80 -D__SDCC__ -Iinclude -I../crt/include
ASFLAGS = -plosff
SRC = \
src/main.c \
OBJ_1 = $(notdir $(SRC:.c=.rel))
OBJ_2 = $(notdir $(OBJ_1:.s=.rel))
OBJ = $(addprefix $(BUILD)/, $(OBJ_2))
vpath %.c $(sort $(dir $(SRC)))
vpath %.s $(sort $(dir $(SRC)))
.PHONY: all clean
all: $(BUILD) $(BUILD)/$(TARGET).com
$(BUILD)/%.rel: %.c Makefile | $(BUILD)
$(CC) -c $(CFLAGS) $< -o $@
$(BUILD)/%.rel: %.s Makefile | $(BUILD)
$(AS) $(ASFLAGS) $@ $<
$(BUILD)/$(TARGET).ihx: ../crt/.build/crt.a $(OBJ)
$(LD) -i $@ ../crt/.build/crt.a $(OBJ)
%.com: %.ihx
$(OBJCOPY) -I ihex -O binary $< $@
$(BUILD):
mkdir $@
clean:
rm -fr $(BUILD)