First commit
This commit is contained in:
44
Makefile
Normal file
44
Makefile
Normal 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)
|
||||
Reference in New Issue
Block a user