git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

commit b63141b13ec230e834e49a0ba62eab699f2f71f8
parent 9a0f60342e1c412c589b3f0d01b189ae5ce2388b
Author: Toxa <untoxa@mail.ru>
Date:   Thu, 24 Jun 2021 19:51:59 +0300

fix broken banked examples Makefile(s)

Diffstat:
Mgbdk-lib/examples/gb/banks/Makefile2+-
Mgbdk-lib/examples/gb/banks_autobank/Makefile91+++++++++++++++++++++++++++++++++++++++++++-------------------------------------
2 files changed, 50 insertions(+), 43 deletions(-)

diff --git a/gbdk-lib/examples/gb/banks/Makefile b/gbdk-lib/examples/gb/banks/Makefile @@ -59,5 +59,5 @@ bank_3.o: bank_3.c # 4 RAM banks : -Wl-ya4 # banks.gb: banks.o bank_0.o bank_1.o bank_2.o bank_3.o - $(CC) -Wl-yt0x19 -Wl-yo4 -Wl-ya4 -o $@ banks.o bank_0.o bank_1.o bank_2.o bank_3.o + $(CC) -Wl-yt0x1A -Wl-yo4 -Wl-ya4 -o $@ banks.o bank_0.o bank_1.o bank_2.o bank_3.o diff --git a/gbdk-lib/examples/gb/banks_autobank/Makefile b/gbdk-lib/examples/gb/banks_autobank/Makefile @@ -1,6 +1,15 @@ -CC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j +LCC = ../../../bin/lcc -Wa-l -Wl-m +BANKPACK = ../../../bin/bankpack -BINS = banks.gb \ +# uncomment for lcc verbose output +# CFLAGS = -v + +BINS = autobanks.gb +CSOURCES := $(wildcard *.c) +ASMSOURCES := $(wildcard *.s) + +# Compiling will produce .o files +OBJS = $(CSOURCES:%.c=%.o) $(ASMSOURCES:%.c=%.o) all: $(BINS) @@ -9,55 +18,53 @@ make.bat: Makefile @make -sn | sed y/\\//\\\\/ | grep -v make >> make.bat %.o: %.c - $(CC) -c -o $@ $< - -%.s: %.c - $(CC) -S -o $@ $< + $(LCC) $(CFLAGS) -c -o $@ $< %.o: %.s - $(CC) -c -o $@ $< + $(LCC) $(CFLAGS) -c -o $@ $< -%.gb: %.o - $(CC) -o $@ $< +%.s: %.c + $(LCC) $(CFLAGS) -S -o $@ $< -clean: - rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi +# Process: .c and .s files -> .o -> (bankpack) -> .rel -> (linker) ... -> .gb +# +# -autobank : Tells lcc to call bankpack for the compiled object (.o) files before linking +# -Wb-ext=.rel : Set output extension for autobanked files to .rel +# -Wb-v : Prints out assigned autobank info (optional) +# -Wl-yoA : Have makebin automatically calculate required number of ROM banks (otherwise use -Wl-yo4 in this example) +# -Wl-ya4 : Use 4 RAM banks +# -Wl-yt0x1B : Use MBC5+RAM+BATTERY cartridge type +$(BINS): $(OBJS) + $(LCC) $(CFLAGS) -autobank -Wb-ext=.rel -Wb-v -Wl-yt0x1B -Wl-yoA -Wl-ya4 -o $(BINS) $(OBJS) -############################################################ -# Multiple bank example -# Compile bank 0 (no ROM) -# RAM bank 0 : -Wf-ba0 -# -bank_0.o: bank_0.c - $(CC) -Wf-ba0 -c -o $@ $< +# It's also possible to do all the compiling, autobanking and linking in a single call to lcc +# with none of the other makefile "targets" above. You can try this target out by using "make onepass". +# Notice that the input files are the .c and .asm sources instead of the compiled object files. +onepass: + $(LCC) $(CFLAGS) -autobank -Wb-ext=.rel -Wb-v -Wl-yt0x1B -Wl-yoA -Wl-ya4 -o $(BINS) $(CSOURCES) $(ASMSOURCES) -# Compile bank 1 (ROM+RAM) -# ROM bank 1 : -Wf-bo1 -# RAM bank 1 : -Wf-ba1 -# -bank_1.o: bank_1.c - $(CC) -Wf-bo1 -Wf-ba1 -c -o $@ $< -# Compile bank 2 (ROM+RAM) -# ROM bank 2 : -Wf-bo2 -# RAM bank 2 : -Wf-ba2 -# -bank_2.o: bank_2.c - $(CC) -Wf-bo2 -Wf-ba2 -c -o $@ $< +clean: + rm -f *.o *.lst *.map *.gb *.ihx *.sym *.cdb *.adb *.asm *.rel -# Compile bank 3 (ROM+RAM) -# ROM bank 3 : -Wf-bo3 -# RAM bank 3 : -Wf-ba3 -# -bank_3.o: bank_3.c - $(CC) -Wf-bo3 -Wf-ba3 -c -o $@ $< -# Link banks -# MBC5+ROM+RAM : -Wl-yt0x19 -# 4 ROM banks : -Wl-yo4 -# 4 RAM banks : -Wl-ya4 +# For lcc linker option: -Wl-ytN where N is one of the numbers below +# +# ROM Byte 0147: Cartridge type # -banks.gb: banks.o bank_0.o bank_1.o bank_2.o bank_3.o - $(CC) -Wm-yt0x1A -Wl-yo4 -Wl-ya4 -o $@ banks.o bank_0.o bank_1.o bank_2.o bank_3.o +# 0-ROM ONLY 12-ROM+MBC3+RAM +# 1-ROM+MBC1 13-ROM+MBC3+RAM+BATT +# 2-ROM+MBC1+RAM 19-ROM+MBC5 +# 3-ROM+MBC1+RAM+BATT 1A-ROM+MBC5+RAM +# 5-ROM+MBC2 1B-ROM+MBC5+RAM+BATT +# 6-ROM+MBC2+BATTERY 1C-ROM+MBC5+RUMBLE +# 8-ROM+RAM 1D-ROM+MBC5+RUMBLE+SRAM +# 9-ROM+RAM+BATTERY 1E-ROM+MBC5+RUMBLE+SRAM+BATT +# B-ROM+MMM01 1F-Pocket Camera +# C-ROM+MMM01+SRAM FD-Bandai TAMA5 +# D-ROM+MMM01+SRAM+BATT FE - Hudson HuC-3 +# F-ROM+MBC3+TIMER+BATT FF - Hudson HuC-1 +# 10-ROM+MBC3+TIMER+RAM+BATT +# 11-ROM+MBC3

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.