SMS-GCI-Loader/gecko/Makefile
sup39 23e5c658ad Add script to build gecko code of GCI Loader
- GCI Loader: gecko-gosub + 06 bin + 04 bl to onReadOptionBlock
- place GCI Loader code at 817FE800 since [817FEEA0, 81800000) is used
  by system
- place buffer at 817F1800 (instead of 817F1000+4) since there seems to
  be some alignment issue
- Assume file size == 0x2000*6 since fileInfo->length seems to be 0
2023-02-11 19:36:44 +09:00

40 lines
897 B
Makefile

AS := powerpc-eabi-as
ASFLAGS := -mregnames -mgekko
LD := powerpc-eabi-ld
LDFLAGS := --unresolved-symbols=ignore-in-object-files --enable-non-contiguous-regions -EB --nmagic
OBJCOPY := powerpc-eabi-objcopy
OBJCOPYFLAGS = -O binary
PY := python3
BIN2GCT := $(PY) bin2gct.py
LD_DIR := ../ldscript
LD_FILES := $(LD_DIR)/sms.ld
SRC_DIR := code
OUT_DIR := out
SRC_FILES := $(wildcard $(SRC_DIR)/*.s)
OBJ_FILES := $(SRC_FILES:.s=.o)
LDO_FILES := $(OBJ_FILES:.o=.ld.o)
OUT_TXT := $(patsubst $(SRC_DIR)/%.s,$(OUT_DIR)/%.txt,$(SRC_FILES))
all: $(OUT_TXT)
%.o: %.s
$(AS) $(ASFLAGS) -o $@ -c $^
%.ld.o: %.o
$(LD) $(LDFLAGS) -o $@ -T $(LD_FILES) $^
$(OUT_DIR)/%.bin: $(SRC_DIR)/%.ld.o | $(OUT_DIR)
$(OBJCOPY) $(OBJCOPYFLAGS) $< $@
$(OUT_DIR)/%.txt: $(OUT_DIR)/%.bin | $(OUT_DIR)
$(BIN2GCT) C0:$^ > $@
$(OUT_DIR):
mkdir -p $@
.PHONY: clean
clean:
$(RM) -rv $(OUT_DIR) $(OBJ_FILES) $(LDO_FILES)