gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit 028f638eb0f1f2605029c6d964befe3d19223258 parent f766f7ab77042a3a33601311c31a82d1498270e3 Author: bbbbbr <bbbbbr@users.noreply.github.com> Date: Thu, 18 Jan 2024 19:54:49 -0800 Merge pull request #614 from bbbbbr/debug_improvements Debug improvements: more flags for lcc -debug, GBDK_DEBUG env var enable for examples Diffstat:
53 files changed, 497 insertions(+), 257 deletions(-)
diff --git a/gbdk-lib/examples/cross-platform/banks/Makefile b/gbdk-lib/examples/cross-platform/banks/Makefile @@ -22,8 +22,12 @@ LCCFLAGS_nes = LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags LCCFLAGS += -Wl-j -Wm-yoA -Wm-ya4 -autobank -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags -# LCCFLAGS += -debug # Uncomment to enable debug output -# LCCFLAGS += -v # Uncomment for lcc verbose output + +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + # You can set the name of the ROM file here PROJECTNAME = banks @@ -50,20 +54,20 @@ $(OBJDIR)/%.o: $(SRCDIR)/%.c ifneq ($(strip $(PLAT)),nes) $(eval BAFLAG = $(shell echo "$<" | sed -n 's/.*\.ba\([0-9]\+\).*/\-Wf-ba\1/p')) endif - $(LCC) -v $(CFLAGS) $(BOFLAG) $(BAFLAG) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) $(BOFLAG) $(BAFLAG) -c -o $@ $< # Compile .c files in "res/" to .o object files $(OBJDIR)/%.o: $(RESDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .s assembly files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.s - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # If needed, compile .c files in "src/" to .s assembly files # (not required if .c is compiled directly to .o) $(OBJDIR)/%.s: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -S -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $< # Link the compiled object files into a .gb ROM file $(BINS): $(OBJS) diff --git a/gbdk-lib/examples/cross-platform/banks_autobank/Makefile b/gbdk-lib/examples/cross-platform/banks_autobank/Makefile @@ -22,8 +22,12 @@ LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Fla # If -autobank is specified then lcc will automatically add -Wm-yoA if no -yo* entry is present LCCFLAGS += -Wl-j -Wm-ya4 -autobank -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags -# LCCFLAGS += -debug # Uncomment to enable debug output -# LCCFLAGS += -v # Uncomment for lcc verbose output + +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + CFLAGS = -Iinclude @@ -47,20 +51,20 @@ all: $(TARGETS) # Compile .c files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "res/" to .o object files $(OBJDIR)/%.o: $(RESDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .s assembly files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.s - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # If needed, compile .c files in "src/" to .s assembly files # (not required if .c is compiled directly to .o) $(OBJDIR)/%.s: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -S -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $< # Link the compiled object files into a .gb ROM file $(BINS): $(OBJS) diff --git a/gbdk-lib/examples/cross-platform/banks_farptr/Makefile b/gbdk-lib/examples/cross-platform/banks_farptr/Makefile @@ -20,8 +20,12 @@ LCCFLAGS_nes = LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags LCCFLAGS += -Wl-j -Wm-yoA -Wm-ya4 -autobank -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags -# LCCFLAGS += -debug # Uncomment to enable debug output -# LCCFLAGS += -v # Uncomment for lcc verbose output + +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + # You can set the name of the ROM file here PROJECTNAME = banks_farptr @@ -43,20 +47,20 @@ all: $(TARGETS) # Compile .c files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "res/" to .o object files $(OBJDIR)/%.o: $(RESDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .s assembly files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.s - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # If needed, compile .c files in "src/" to .s assembly files # (not required if .c is compiled directly to .o) $(OBJDIR)/%.s: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -S -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $< # Link the compiled object files into a .gb ROM file $(BINS): $(OBJS) diff --git a/gbdk-lib/examples/cross-platform/banks_nonintrinsic/Makefile b/gbdk-lib/examples/cross-platform/banks_nonintrinsic/Makefile @@ -20,8 +20,12 @@ LCCFLAGS_nes = LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags LCCFLAGS += -Wl-j -Wm-yoA -Wm-ya4 -autobank -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags -# LCCFLAGS += -debug # Uncomment to enable debug output -# LCCFLAGS += -v # Uncomment for lcc verbose output + +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + # You can set the name of the ROM file here PROJECTNAME = banks_nonintrinsic @@ -43,20 +47,20 @@ all: $(TARGETS) # Compile .c files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "res/" to .o object files $(OBJDIR)/%.o: $(RESDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .s assembly files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.s - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # If needed, compile .c files in "src/" to .s assembly files # (not required if .c is compiled directly to .o) $(OBJDIR)/%.s: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -S -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $< # Link the compiled object files into a .gb ROM file $(BINS): $(OBJS) diff --git a/gbdk-lib/examples/cross-platform/emu_debug/Makefile b/gbdk-lib/examples/cross-platform/emu_debug/Makefile @@ -19,8 +19,12 @@ LCCFLAGS_gg = LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags LCCFLAGS += -Wl-j -Wm-yoA -Wm-ya4 -autobank -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags -LCCFLAGS += -debug # Uncomment to enable debug output -# LCCFLAGS += -v # Uncomment for lcc verbose output + +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + # You can set the name of the ROM file here PROJECTNAME = emu_debug @@ -42,20 +46,20 @@ all: $(TARGETS) # Compile .c files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "res/" to .o object files $(OBJDIR)/%.o: $(RESDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .s assembly files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.s - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # If needed, compile .c files in "src/" to .s assembly files # (not required if .c is compiled directly to .o) $(OBJDIR)/%.s: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -S -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $< # Link the compiled object files into a .gb ROM file $(BINS): $(OBJS) diff --git a/gbdk-lib/examples/cross-platform/fonts/Makefile b/gbdk-lib/examples/cross-platform/fonts/Makefile @@ -20,8 +20,12 @@ LCCFLAGS_nes = LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags LCCFLAGS += -Wl-j -Wm-yoA -Wm-ya4 -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags -# LCCFLAGS += -debug # Uncomment to enable debug output -# LCCFLAGS += -v # Uncomment for lcc verbose output + +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + # You can set the name of the ROM file here PROJECTNAME = fonts @@ -43,20 +47,20 @@ all: $(TARGETS) # Compile .c files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "res/" to .o object files $(OBJDIR)/%.o: $(RESDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .s assembly files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.s - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # If needed, compile .c files in "src/" to .s assembly files # (not required if .c is compiled directly to .o) $(OBJDIR)/%.s: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -S -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $< # Link the compiled object files into a .gb ROM file $(BINS): $(OBJS) diff --git a/gbdk-lib/examples/cross-platform/gbdecompress/Makefile b/gbdk-lib/examples/cross-platform/gbdecompress/Makefile @@ -20,8 +20,12 @@ LCCFLAGS_gg = LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags LCCFLAGS += -Wl-j -Wm-yoA -Wm-ya4 -autobank -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags -# LCCFLAGS += -debug # Uncomment to enable debug output -# LCCFLAGS += -v # Uncomment for lcc verbose output + +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + # Add directory where platform specific meta tile sprites get converted into (obj/<platform ext>/src) # So they can be included with "#include <res/somefile.h>" @@ -62,24 +66,24 @@ $(RESOBJSRC)/%.c: $(RESDIR)/%.png # Compile the Metasprite pngs that were converted to .c files # .c files in obj/<platform ext>/src/ -> .o files in obj/ $(OBJDIR)/%.o: $(RESOBJSRC)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "res/" to .o object files $(OBJDIR)/%.o: $(RESDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .s assembly files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.s - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # If needed, compile .c files in "src/" to .s assembly files # (not required if .c is compiled directly to .o) $(OBJDIR)/%.s: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -S -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $< # Convert and build MetaSprites first so they're available when compiling the main sources $(OBJS): $(METAOBJS) diff --git a/gbdk-lib/examples/cross-platform/incbin/Makefile b/gbdk-lib/examples/cross-platform/incbin/Makefile @@ -20,8 +20,12 @@ LCCFLAGS_nes = LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags LCCFLAGS += -Wl-j -Wm-yoA -Wm-ya4 -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags -# LCCFLAGS += -debug # Uncomment to enable debug output -# LCCFLAGS += -v # Uncomment for lcc verbose output + +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + # You can set the name of the ROM file here PROJECTNAME = incbin @@ -43,20 +47,20 @@ all: $(TARGETS) # Compile .c files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "res/" to .o object files $(OBJDIR)/%.o: $(RESDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .s assembly files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.s - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # If needed, compile .c files in "src/" to .s assembly files # (not required if .c is compiled directly to .o) $(OBJDIR)/%.s: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -S -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $< # Link the compiled object files into a .gb ROM file $(BINS): $(OBJS) diff --git a/gbdk-lib/examples/cross-platform/large_map/Makefile b/gbdk-lib/examples/cross-platform/large_map/Makefile @@ -21,8 +21,6 @@ LCCFLAGS_nes = -autobank LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags LCCFLAGS += -Wl-j -Wm-yoA -Wm-ya4 -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags -#LCCFLAGS += -debug # Uncomment to enable debug output -#LCCFLAGS += -v # Uncomment for lcc verbose output P2AFLAGS_gb = -map -bpp 2 -max_palettes 4 -pack_mode gb -noflip P2AFLAGS_gbc = -map -use_map_attributes -bpp 2 -max_palettes 8 -pack_mode gb @@ -34,6 +32,12 @@ P2AFLAGS_nes = -map -bpp 2 -max_palettes 4 -pack_mode nes -noflip -use_nes_at P2AFLAGS = $(P2AFLAGS_$(EXT)) +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + # You can set the name of the ROM file here PROJECTNAME = large-map @@ -73,7 +77,7 @@ $(RESOBJSRC)/%.c: $(RESDIR)/%.png # Compile the map pngs that were converted to .c files # .c files in obj/<platform ext>/src/ -> .o files in obj/ $(OBJDIR)/%.o: $(RESOBJSRC)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Dependencies (using output from -Wf-MMD -Wf-Wp-MP) DEPS = $(OBJS:%.o=%.d) @@ -82,20 +86,20 @@ DEPS = $(OBJS:%.o=%.d) # Compile .c files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "res/" to .o object files $(OBJDIR)/%.o: $(RESDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .s assembly files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.s - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # If needed, compile .c files in "src/" to .s assembly files # (not required if .c is compiled directly to .o) $(OBJDIR)/%.s: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -S -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $< # Convert and build maps first so they're available when compiling the main sources $(OBJS): $(MAPOBJS) diff --git a/gbdk-lib/examples/cross-platform/libc_memcpy/Makefile b/gbdk-lib/examples/cross-platform/libc_memcpy/Makefile @@ -20,8 +20,12 @@ LCCFLAGS_nes = LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags LCCFLAGS += -Wl-j -Wm-yoA -Wm-ya4 -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags -# LCCFLAGS += -debug # Uncomment to enable debug output -# LCCFLAGS += -v # Uncomment for lcc verbose output + +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + # You can set the name of the ROM file here PROJECTNAME = libc_memcpy @@ -43,20 +47,20 @@ all: $(TARGETS) # Compile .c files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "res/" to .o object files $(OBJDIR)/%.o: $(RESDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .s assembly files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.s - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # If needed, compile .c files in "src/" to .s assembly files # (not required if .c is compiled directly to .o) $(OBJDIR)/%.s: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -S -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $< # Link the compiled object files into a .gb ROM file $(BINS): $(OBJS) diff --git a/gbdk-lib/examples/cross-platform/libc_string/Makefile b/gbdk-lib/examples/cross-platform/libc_string/Makefile @@ -20,8 +20,12 @@ LCCFLAGS_nes = LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags LCCFLAGS += -Wl-j -Wm-yoA -Wm-ya4 -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags -# LCCFLAGS += -debug # Uncomment to enable debug output -# LCCFLAGS += -v # Uncomment for lcc verbose output + +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + # You can set the name of the ROM file here PROJECTNAME = libc_string @@ -43,20 +47,20 @@ all: $(TARGETS) # Compile .c files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "res/" to .o object files $(OBJDIR)/%.o: $(RESDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .s assembly files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.s - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # If needed, compile .c files in "src/" to .s assembly files # (not required if .c is compiled directly to .o) $(OBJDIR)/%.s: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -S -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $< # Link the compiled object files into a .gb ROM file $(BINS): $(OBJS) diff --git a/gbdk-lib/examples/cross-platform/logo/Makefile b/gbdk-lib/examples/cross-platform/logo/Makefile @@ -21,8 +21,12 @@ LCCFLAGS_nes = LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags LCCFLAGS += -Wl-j -Wm-yoA -Wm-ya4 -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags -# LCCFLAGS += -debug # Uncomment to enable debug output -# LCCFLAGS += -v # Uncomment for lcc verbose output + +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + RESFLAGS += $(RESFLAGS_$(TYP)) @@ -52,24 +56,24 @@ $(OBJDIR)/%.c: $(RESDIR)/%.png $$(wildcard $(RESDIR)/gfx/$(PLAT)/backgrounds/%.p $(PNG2ASSETS) $< `cat <$<.meta 2>/dev/null` -c $@ $(OBJDIR)/%.o: $(OBJDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "res/" to .o object files $(OBJDIR)/%.o: $(RESDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .s assembly files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.s - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # If needed, compile .c files in "src/" to .s assembly files # (not required if .c is compiled directly to .o) $(OBJDIR)/%.s: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -S -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $< # Link the compiled object files into a .gb ROM file $(BINS): $(OBJS) diff --git a/gbdk-lib/examples/cross-platform/metasprites/Makefile b/gbdk-lib/examples/cross-platform/metasprites/Makefile @@ -21,8 +21,12 @@ LCCFLAGS_nes = LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags LCCFLAGS += -Wl-j -Wm-yoA -Wm-ya4 -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags -# LCCFLAGS += -debug # Uncomment to enable debug output -# LCCFLAGS += -v # Uncomment for lcc verbose output + +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + # Add directory where platform specific meta tile sprites get converted into (obj/<platform ext>/src) # So they can be included with "#include <res/somefile.h>" @@ -63,24 +67,24 @@ $(RESOBJSRC)/%.c: $(RESDIR)/%.png # Compile the Metasprite pngs that were converted to .c files # .c files in obj/<platform ext>/src/ -> .o files in obj/ $(OBJDIR)/%.o: $(RESOBJSRC)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "res/" to .o object files $(OBJDIR)/%.o: $(RESDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .s assembly files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.s - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # If needed, compile .c files in "src/" to .s assembly files # (not required if .c is compiled directly to .o) $(OBJDIR)/%.s: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -S -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $< # Convert and build MetaSprites first so they're available when compiling the main sources $(OBJS): $(METAOBJS) diff --git a/gbdk-lib/examples/cross-platform/multiplayer/Makefile b/gbdk-lib/examples/cross-platform/multiplayer/Makefile @@ -20,8 +20,12 @@ LCCFLAGS_nes = LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags LCCFLAGS += -Wl-j -Wm-yoA -Wm-ya4 -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags -# LCCFLAGS += -debug # Uncomment to enable debug output -# LCCFLAGS += -v # Uncomment for lcc verbose output + +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + # You can set the name of the ROM file here PROJECTNAME = multiplayer @@ -42,20 +46,20 @@ all: $(TARGETS) # Compile .c files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "res/" to .o object files $(OBJDIR)/%.o: $(RESDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .s assembly files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.s - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # If needed, compile .c files in "src/" to .s assembly files # (not required if .c is compiled directly to .o) $(OBJDIR)/%.s: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -S -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $< # Link the compiled object files into a .gb ROM file $(BINS): $(OBJS) diff --git a/gbdk-lib/examples/cross-platform/pong/Makefile b/gbdk-lib/examples/cross-platform/pong/Makefile @@ -20,8 +20,12 @@ LCCFLAGS_nes = LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags LCCFLAGS += -Wl-j -Wm-yoA -Wm-ya4 -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags -# LCCFLAGS += -debug # Uncomment to enable debug output -# LCCFLAGS += -v # Uncomment for lcc verbose output + +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + # You can set the name of the ROM file here PROJECTNAME = pong @@ -43,20 +47,20 @@ all: $(TARGETS) # Compile .c files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "res/" to .o object files $(OBJDIR)/%.o: $(RESDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .s assembly files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.s - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # If needed, compile .c files in "src/" to .s assembly files # (not required if .c is compiled directly to .o) $(OBJDIR)/%.s: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -S -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $< # Link the compiled object files into a .gb ROM file $(BINS): $(OBJS) diff --git a/gbdk-lib/examples/cross-platform/randtest/Makefile b/gbdk-lib/examples/cross-platform/randtest/Makefile @@ -20,8 +20,12 @@ LCCFLAGS_nes = LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags LCCFLAGS += -Wl-j -Wm-yoA -Wm-ya4 -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags -# LCCFLAGS += -debug # Uncomment to enable debug output -# LCCFLAGS += -v # Uncomment for lcc verbose output + +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + # You can set the name of the ROM file here PROJECTNAME = testrand @@ -43,20 +47,20 @@ all: $(TARGETS) # Compile .c files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "res/" to .o object files $(OBJDIR)/%.o: $(RESDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .s assembly files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.s - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # If needed, compile .c files in "src/" to .s assembly files # (not required if .c is compiled directly to .o) $(OBJDIR)/%.s: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -S -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $< # Link the compiled object files into a .gb ROM file $(BINS): $(OBJS) diff --git a/gbdk-lib/examples/cross-platform/rle_map/Makefile b/gbdk-lib/examples/cross-platform/rle_map/Makefile @@ -22,9 +22,12 @@ LCCFLAGS_nes = LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags # LCCFLAGS += -Wl-j -Wm-yoA -Wm-ya4 -autobank -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags -LCCFLAGS += -Wl-u -Wl-j -# LCCFLAGS += -debug # Uncomment to enable debug output -# LCCFLAGS += -v # Uncomment for lcc verbose output + +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + CFLAGS = -Wf-Iinclude @@ -49,28 +52,28 @@ all: $(TARGETS) # Compile .c files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "src/<target>/" to .o object files $(OBJDIR)/%.o: $(SRCPLAT)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "res/" to .o object files $(OBJDIR)/%.o: $(RESDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .s assembly files in "src/<target>/" to .o object files $(OBJDIR)/%.o: $(SRCPLAT)/%.s - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .s assembly files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.s - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # If needed, compile .c files in "src/" to .s assembly files # (not required if .c is compiled directly to .o) $(OBJDIR)/%.s: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -S -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $< # Link the compiled object files into a .gb ROM file $(BINS): $(OBJS) diff --git a/gbdk-lib/examples/cross-platform/scroller/Makefile b/gbdk-lib/examples/cross-platform/scroller/Makefile @@ -20,8 +20,12 @@ LCCFLAGS_nes = LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags LCCFLAGS += -Wl-j -Wm-yS -Wm-yoA -Wm-ya4 -autobank -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags -# LCCFLAGS += -debug # Uncomment to enable debug output -# LCCFLAGS += -v # Uncomment for lcc verbose output + +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + # You can set the name of the ROM file here PROJECTNAME = scroller @@ -43,20 +47,20 @@ all: $(TARGETS) # Compile .c files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "res/" to .o object files $(OBJDIR)/%.o: $(RESDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .s assembly files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.s - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # If needed, compile .c files in "src/" to .s assembly files # (not required if .c is compiled directly to .o) $(OBJDIR)/%.s: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -S -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $< # Link the compiled object files into a .gb ROM file $(BINS): $(OBJS) diff --git a/gbdk-lib/examples/cross-platform/simple_physics/Makefile b/gbdk-lib/examples/cross-platform/simple_physics/Makefile @@ -21,8 +21,12 @@ LCCFLAGS_nes = LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags LCCFLAGS += -Wl-j -Wm-yoA -Wm-ya4 -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags -# LCCFLAGS += -debug # Uncomment to enable debug output -# LCCFLAGS += -v # Uncomment for lcc verbose output + +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + # Add directory where platform specific meta tile sprites get converted into (obj/<platform ext>/src) # So they can be included with "#include <res/somefile.h>" @@ -63,24 +67,24 @@ $(RESOBJSRC)/%.c: $(RESDIR)/%.png # Compile the Metasprite pngs that were converted to .c files # .c files in obj/<platform ext>/src/ -> .o files in obj/ $(OBJDIR)/%.o: $(RESOBJSRC)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "res/" to .o object files $(OBJDIR)/%.o: $(RESDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .s assembly files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.s - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # If needed, compile .c files in "src/" to .s assembly files # (not required if .c is compiled directly to .o) $(OBJDIR)/%.s: $(SRCDIR)/%.c - $(LCC) $(CFLAGS) -S -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $< # Convert and build MetaSprites first so they're available when compiling the main sources $(OBJS): $(METAOBJS) diff --git a/gbdk-lib/examples/gb/apa_image/Makefile b/gbdk-lib/examples/gb/apa_image/Makefile @@ -10,9 +10,11 @@ GBDK_HOME = ../../../ LCC = $(GBDK_HOME)bin/lcc PNG2ASSET = $(GBDK_HOME)bin/png2asset -# You can set flags for LCC here -# For example, you can uncomment the line below to turn on debug output -# LCCFLAGS += -debug +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + # Add directory where image gets converted into (obj/) # So they can be included with "#include <res/somefile.h>" @@ -60,7 +62,7 @@ $(RESOBJSRC)/%.c: $(RESDIR)/%.png # Compile the pngs that were converted to .c files # .c files in obj/res/ -> .o files in obj/ $(OBJDIR)/%.o: $(RESOBJSRC)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .c files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.c @@ -68,7 +70,7 @@ $(OBJDIR)/%.o: $(SRCDIR)/%.c # Compile .c files in "res/" to .o object files $(OBJDIR)/%.o: $(RESDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Compile .s assembly files in "src/" to .o object files $(OBJDIR)/%.o: $(SRCDIR)/%.s diff --git a/gbdk-lib/examples/gb/bcd/Makefile b/gbdk-lib/examples/gb/bcd/Makefile @@ -1,7 +1,13 @@ -CC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j +LCC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j BINS = bcd.gb +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + all: $(BINS) compile.bat: Makefile @@ -10,8 +16,8 @@ compile.bat: Makefile # Compile and link single file in one pass %.gb: %.c - $(CC) -o $@ $< + $(LCC) $(LCCFLAGS) -o $@ $< clean: - rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi + rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi *.rst diff --git a/gbdk-lib/examples/gb/colorbar/Makefile b/gbdk-lib/examples/gb/colorbar/Makefile @@ -1,4 +1,9 @@ -CC = ../../../bin/lcc -Wa-l -Wl-m +LCC = ../../../bin/lcc -Wa-l -Wl-m + +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif # CFLAGS = @@ -11,20 +16,20 @@ compile.bat: Makefile @make -sn | sed y/\\//\\\\/ | sed s/mkdir\ -p\/mkdir\/ | grep -v make >> compile.bat %.o: %.c - $(CC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< %.o: %.s - $(CC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< %.s: %.c - $(CC) $(CFLAGS) -S -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $< %.gb: %.o - $(CC) -o $@ $< + $(LCC) $(LCCFLAGS) -o $@ $< clean: - rm -f *.o *.lst *.map *.gb *.ihx *.sym *.cdb *.adb *.asm + rm -f *.o *.lst *.map *.gb *.ihx *.sym *.cdb *.adb *.asm *.noi *.rst # Link file, and write 0x80 at position 0x143 in header colorbar.gb: colorbar.o - $(CC) $(CFLAGS) -Wm-yC -o colorbar.gb colorbar.o + $(LCC) $(LCCFLAGS) $(CFLAGS) -Wm-yC -o colorbar.gb colorbar.o diff --git a/gbdk-lib/examples/gb/comm/Makefile b/gbdk-lib/examples/gb/comm/Makefile @@ -1,7 +1,13 @@ -CC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j +LCC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j BINS = comm.gb +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + all: $(BINS) compile.bat: Makefile @@ -10,8 +16,8 @@ compile.bat: Makefile # Compile and link single file in one pass %.gb: %.c - $(CC) -o $@ $< + $(LCC) $(LCCFLAGS) -o $@ $< clean: - rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi + rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi *.rst diff --git a/gbdk-lib/examples/gb/crash/Makefile b/gbdk-lib/examples/gb/crash/Makefile @@ -1,7 +1,13 @@ -CC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j +LCC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j BINS = crash.gb +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + all: $(BINS) compile.bat: Makefile @@ -10,8 +16,8 @@ compile.bat: Makefile # Compile and link single file in one pass %.gb: %.c - $(CC) -o $@ $< + $(LCC) $(LCCFLAGS) -o $@ $< clean: - rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi + rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi *.rst diff --git a/gbdk-lib/examples/gb/dscan/Makefile b/gbdk-lib/examples/gb/dscan/Makefile @@ -1,7 +1,13 @@ -CC = ../../../bin/lcc -Wm-yc +LCC = ../../../bin/lcc -Wm-yc BINS = dscan.gb +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + all: $(BINS) compile.bat: Makefile @@ -9,16 +15,16 @@ compile.bat: Makefile @make -sn | sed y/\\//\\\\/ | sed s/mkdir\ -p\/mkdir\/ | grep -v make >> compile.bat %.o: %.c - $(CC) -c -o $@ $< + $(LCC) $(LCCFLAGS) -c -o $@ $< %.s: %.c - $(CC) -S -o $@ $< + $(LCC) $(LCCFLAGS) -S -o $@ $< %.o: %.s - $(CC) -c -o $@ $< + $(LCC) $(LCCFLAGS) -c -o $@ $< %.gb: %.o - $(CC) -o $@ $< + $(LCC) $(LCCFLAGS) -o $@ $< clean: - rm -f *.o *.lst *.map *.gb *.ihx *.sym *.cdb *.adb *.asm + rm -f *.o *.lst *.map *.gb *.ihx *.sym *.cdb *.adb *.asm *.noi *.rst diff --git a/gbdk-lib/examples/gb/filltest/Makefile b/gbdk-lib/examples/gb/filltest/Makefile @@ -1,7 +1,13 @@ -CC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j +LCC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j BINS = filltest.gb +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + all: $(BINS) compile.bat: Makefile @@ -10,8 +16,8 @@ compile.bat: Makefile # Compile and link single file in one pass %.gb: %.c - $(CC) -o $@ $< + $(LCC) $(LCCFLAGS) -o $@ $< clean: - rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi + rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi *.rst diff --git a/gbdk-lib/examples/gb/galaxy/Makefile b/gbdk-lib/examples/gb/galaxy/Makefile @@ -1,7 +1,13 @@ -CC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j +LCC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j BINS = galaxy.gb +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + all: $(BINS) compile.bat: Makefile @@ -10,8 +16,8 @@ compile.bat: Makefile # Compile and link single file in one pass %.gb: %.c - $(CC) -o $@ $< + $(LCC) $(LCCFLAGS) -o $@ $< clean: - rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi + rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi *.rst diff --git a/gbdk-lib/examples/gb/gb-dtmf/Makefile b/gbdk-lib/examples/gb/gb-dtmf/Makefile @@ -1,4 +1,4 @@ -CC = ../../../bin/lcc -Wa-l -Wl-m +LCC = ../../../bin/lcc -Wa-l -Wl-m BINS = gb-dtmf.gb @@ -9,16 +9,16 @@ compile.bat: Makefile @make -sn | sed y/\\//\\\\/ | sed s/mkdir\ -p\/mkdir\/ | grep -v make >> compile.bat %.s: %.c - $(CC) -S -o $@ $< + $(LCC) $(LCCFLAGS) -S -o $@ $< %.o: %.c - $(CC) -c -o $@ $< + $(LCC) $(LCCFLAGS) -c -o $@ $< %.o: %.s - $(CC) -c -o $@ $< + $(LCC) $(LCCFLAGS) -c -o $@ $< %.gb: %.o - $(CC) -o $@ $< + $(LCC) $(LCCFLAGS) -o $@ $< clean: - rm -f *.o *.lst *.map *.gb *.ihx *.sym *.cdb *.adb *.asm + rm -f *.o *.lst *.map *.gb *.ihx *.sym *.cdb *.adb *.asm *.noi *.rst diff --git a/gbdk-lib/examples/gb/gbtype/Makefile b/gbdk-lib/examples/gb/gbtype/Makefile @@ -11,9 +11,11 @@ LCC = $(GBDK_HOME)bin/lcc # Flag to enable optional Super Game Boy support in the ROM Cartridge header LCCFLAGS = -Wm-ys -# You can uncomment the line below to turn on debug output -# LCCFLAGS += -debug # Uncomment to enable debug output -# LCCFLAGS += -v # Uncomment for lcc verbose output +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + # You can set the name of the .gb ROM file here PROJECTNAME = gbtype @@ -33,5 +35,5 @@ $(BINS): $(CSOURCES) $(ASMSOURCES) $(LCC) $(LCCFLAGS) -o $@ $(CSOURCES) $(ASMSOURCES) clean: - rm -f *.o *.lst *.map *.gb *.ihx *.sym *.cdb *.adb *.asm + rm -f *.o *.lst *.map *.gb *.ihx *.sym *.cdb *.adb *.asm *.noi *.rst *.rst diff --git a/gbdk-lib/examples/gb/hblank_copy/Makefile b/gbdk-lib/examples/gb/hblank_copy/Makefile @@ -10,11 +10,14 @@ GBDK_HOME = ../../../ LCC = $(GBDK_HOME)bin/lcc PNG2ASSET = $(GBDK_HOME)bin/png2asset -# You can set flags for LCC here -# For example, you can uncomment the line below to turn on debug output -# LCCFLAGS += -debug LCCFLAGS += -Wm-yt0x19 -Wm-yoA -autobank -I$(OBJDIR) +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + # You can set the name of the .gb ROM file here PROJECTNAME = hblank_copy @@ -52,7 +55,7 @@ $(OBJDIR)/%.s: $(SRCDIR)/%.c # rule for the autogenerated files $(OBJDIR)/%.o: $(OBJDIR)/%.c - $(LCC) $(CFLAGS) -c -o $@ $< + $(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $< # Link the compiled object files into a .gb ROM file diff --git a/gbdk-lib/examples/gb/hicolor/Makefile b/gbdk-lib/examples/gb/hicolor/Makefile @@ -7,8 +7,6 @@ endif LCC = $(GBDK_HOME)bin/lcc # You can set flags for LCC here -LCCFLAGS += -debug # Uncomment to enable debug output -# LCCFLAGS += -v # Uncomment for lcc verbose output LCCFLAGS += -Wm-yC # GB Color required for Hi Color LCCFLAGS += -Wf-MMD -Wf-Wp-MP # Header file dependency output (-MMD) for Makefile use + per-header Phoney rules (-MP) LCCFLAGS += -Wl-yt0x19 # MBC5 @@ -27,6 +25,12 @@ HICOLOR_FLAGS = --type=1 -L=1 -R=1 --csource --bank=255 LCCFLAGS += -I$(OBJDIR) -I$(SRCDIR) +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + # You can set the name of the .gb ROM file here PROJECTNAME = hicolor_pic diff --git a/gbdk-lib/examples/gb/irq/Makefile b/gbdk-lib/examples/gb/irq/Makefile @@ -1,7 +1,13 @@ -CC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j +LCC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j BINS = irq.gb +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + all: $(BINS) compile.bat: Makefile @@ -10,8 +16,8 @@ compile.bat: Makefile # Compile and link single file in one pass %.gb: %.c - $(CC) -o $@ $< + $(LCC) $(LCCFLAGS) -o $@ $< clean: - rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi + rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi *.rst diff --git a/gbdk-lib/examples/gb/isr_vector/Makefile b/gbdk-lib/examples/gb/isr_vector/Makefile @@ -1,7 +1,13 @@ -CC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j -Wm-yS +LCC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j -Wm-yS BINS = lcd_isr_wobble.gb +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + all: $(BINS) compile.bat: Makefile @@ -10,7 +16,7 @@ compile.bat: Makefile # Compile and link single file in one pass %.gb: %.c - $(CC) -o $@ $< + $(LCC) $(LCCFLAGS) -o $@ $< clean: rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi diff --git a/gbdk-lib/examples/gb/lcd_isr_wobble/Makefile b/gbdk-lib/examples/gb/lcd_isr_wobble/Makefile @@ -1,7 +1,13 @@ -CC = ../../../bin/lcc -Wl-j -Wm-yS +LCC = ../../../bin/lcc -Wl-j -Wm-yS BINS = lcd_isr_wobble.gb +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + all: $(BINS) compile.bat: Makefile @@ -10,8 +16,8 @@ compile.bat: Makefile # Compile and link single file in one pass %.gb: %.c - $(CC) -o $@ $< + $(LCC) $(LCCFLAGS) -o $@ $< clean: - rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi + rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi *.rst diff --git a/gbdk-lib/examples/gb/linkerfile/Makefile b/gbdk-lib/examples/gb/linkerfile/Makefile @@ -9,10 +9,11 @@ GBDK_HOME = ../../../ LCC = $(GBDK_HOME)bin/lcc -# You can set flags for LCC here -# For example, you can uncomment the line below to turn on debug output -# LCCFLAGS = -debug -# LCCFLAGS = -v +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + # You can set the name of the .gb ROM file here PROJECTNAME = Example diff --git a/gbdk-lib/examples/gb/paint/Makefile b/gbdk-lib/examples/gb/paint/Makefile @@ -1,7 +1,13 @@ -CC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j +LCC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j BINS = paint.gb +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + all: $(BINS) compile.bat: Makefile @@ -10,8 +16,8 @@ compile.bat: Makefile # Compile and link single file in one pass %.gb: %.c - $(CC) -o $@ $< + $(LCC) $(LCCFLAGS) -o $@ $< clean: - rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi + rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi *.rst diff --git a/gbdk-lib/examples/gb/ram_function/Makefile b/gbdk-lib/examples/gb/ram_function/Makefile @@ -1,7 +1,13 @@ -CC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j +LCC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j BINS = ram_fn.gb +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + all: $(BINS) compile.bat: Makefile @@ -9,24 +15,24 @@ compile.bat: Makefile @make -sn | sed y/\\//\\\\/ | sed s/mkdir\ -p\/mkdir\/ | grep -v make >> compile.bat %.o: %.c - $(CC) -c -o $@ $< + $(LCC) $(LCCFLAGS) -c -o $@ $< %.s: %.c - $(CC) -S -o $@ $< + $(LCC) $(LCCFLAGS) -S -o $@ $< %.o: %.s - $(CC) -c -o $@ $< + $(LCC) $(LCCFLAGS) -c -o $@ $< %.gb: %.o - $(CC) -o $@ $< + $(LCC) $(LCCFLAGS) -o $@ $< clean: - rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi + rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.adb *.ihx *.lnk *.sym *.asm *.noi *.rst ram_fn.o: ram_fn.c - $(CC) -D_inc_ram=0xD000 -D_inc_hiram=0xFFA0 -c -o $@ $< + $(LCC) $(LCCFLAGS) -D_inc_ram=0xD000 -D_inc_hiram=0xFFA0 -c -o $@ $< ram_fn.gb: ram_fn.o - $(CC) -Wl-g_inc_ram=0xD000 -Wl-g_inc_hiram=0xFFA0 -o $@ ram_fn.o + $(LCC) $(LCCFLAGS) -Wl-g_inc_ram=0xD000 -Wl-g_inc_hiram=0xFFA0 -o $@ ram_fn.o diff --git a/gbdk-lib/examples/gb/rpn/Makefile b/gbdk-lib/examples/gb/rpn/Makefile @@ -1,7 +1,13 @@ -CC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j +LCC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j BINS = rpn.gb +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + all: $(BINS) compile.bat: Makefile @@ -10,8 +16,8 @@ compile.bat: Makefile # Compile and link single file in one pass %.gb: %.c - $(CC) -o $@ $< + $(LCC) $(LCCFLAGS) -o $@ $< clean: - rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi + rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi *.rst diff --git a/gbdk-lib/examples/gb/sgb_border/Makefile b/gbdk-lib/examples/gb/sgb_border/Makefile @@ -1,13 +1,20 @@ -CC = ../../../bin/lcc +LCC = ../../../bin/lcc PNG2ASSET = ../../../bin/png2asset +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + all: $(PNG2ASSET) gb_border.png -map -bpp 4 -max_palettes 4 -pack_mode sgb -use_map_attributes -c border_data.c - $(CC) -Wm-ys -o border.gb border.c sgb_border.c border_data.c + $(LCC) $(LCCFLAGS) -Wm-ys -o border.gb border.c sgb_border.c border_data.c compile.bat: Makefile @echo "REM Automatically generated from Makefile" > compile.bat @make -sn | sed y/\\//\\\\/ | sed s/mkdir\ -p\/mkdir\/ | grep -v make >> compile.bat clean: - rm -f *.o *.lst *.map *.gb *.ihx *.sym *.cdb *.adb *.asm + rm -f border_data.c border_data.h + rm -f *.o *.lst *.map *.gb *.ihx *.sym *.cdb *.adb *.asm *.noi *.rst diff --git a/gbdk-lib/examples/gb/sgb_pong/Makefile b/gbdk-lib/examples/gb/sgb_pong/Makefile @@ -1,7 +1,13 @@ -CC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j -Wm-ys +LCC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j -Wm-ys BINS = sgb_pong.gb +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + all: $(BINS) compile.bat: Makefile @@ -10,8 +16,8 @@ compile.bat: Makefile # Compile and link single file in one pass %.gb: %.c - $(CC) -o $@ $< + $(LCC) $(LCCFLAGS) -o $@ $< clean: - rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi + rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi *.rst diff --git a/gbdk-lib/examples/gb/sgb_sfx/Makefile b/gbdk-lib/examples/gb/sgb_sfx/Makefile @@ -1,11 +1,17 @@ -CC = ../../../bin/lcc +LCC = ../../../bin/lcc + +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + all: - $(CC) -Wm-ys -o sgb_sfx.gb main.c sgb_sfx_names.c + $(LCC) $(LCCFLAGS) -Wm-ys -o sgb_sfx.gb main.c sgb_sfx_names.c compile.bat: Makefile @echo "REM Automatically generated from Makefile" > compile.bat @make -sn | sed y/\\//\\\\/ | sed s/mkdir\ -p\/mkdir\/ | grep -v make >> compile.bat clean: - rm -f *.o *.lst *.map *.gb *.ihx *.sym *.cdb *.adb *.asm + rm -f *.o *.lst *.map *.gb *.ihx *.sym *.cdb *.adb *.asm *.noi *.rst diff --git a/gbdk-lib/examples/gb/sound/Makefile b/gbdk-lib/examples/gb/sound/Makefile @@ -1,8 +1,14 @@ -CC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j +LCC = ../../../bin/lcc -Wa-l -Wl-m -Wl-j BINS = sound.gb sound.duck # BINS = sound.gb sound.duck sound.pocket +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + all: $(BINS) compile.bat: Makefile @@ -11,16 +17,16 @@ compile.bat: Makefile # Compile and link single file in one pass %.gb: %.c - $(CC) -msm83:gb -o $@ $< + $(LCC) $(LCCFLAGS) -msm83:gb -o $@ $< # Build megaduck version with -m port:plat flag %.duck: %.c - $(CC) -msm83:duck -o $@ $< + $(LCC) $(LCCFLAGS) -msm83:duck -o $@ $< # Build analogue pocket version with -m port:plat flag %.pocket: %.c - $(CC) -msm83:ap -o $@ $< + $(LCC) $(LCCFLAGS) -msm83:ap -o $@ $< clean: - rm -f *.o *.lst *.map *.duck *.pocket *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi + rm -f *.o *.lst *.map *.duck *.pocket *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi *.rst diff --git a/gbdk-lib/examples/gb/space/Makefile b/gbdk-lib/examples/gb/space/Makefile @@ -1,8 +1,14 @@ GBDK = ../../.. -CC = $(GBDK)/bin/lcc -Wl-m -Wl-w -Wl-j -Wm-yS +LCC = $(GBDK)/bin/lcc -Wl-m -Wl-w -Wl-j -Wm-yS BINS = space.gb +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + all: $(BINS) compile.bat: Makefile @@ -11,8 +17,8 @@ compile.bat: Makefile # Compile and link single file in one pass %.gb: %.s - $(CC) -o $@ $< + $(LCC) $(LCCFLAGS) -o $@ $< clean: - rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi + rm -f *.o *.lst *.map *.gb *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi *.rst diff --git a/gbdk-lib/examples/gb/template_minimal/Makefile b/gbdk-lib/examples/gb/template_minimal/Makefile @@ -8,9 +8,11 @@ GBDK_HOME = ../../../ LCC = $(GBDK_HOME)bin/lcc -# You can uncomment the line below to turn on debug output -# LCCFLAGS += -debug # Uncomment to enable debug output -# LCCFLAGS += -v # Uncomment for lcc verbose output +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + # You can set the name of the .gb ROM file here PROJECTNAME = Example @@ -30,5 +32,5 @@ $(BINS): $(CSOURCES) $(ASMSOURCES) $(LCC) $(LCCFLAGS) -o $@ $(CSOURCES) $(ASMSOURCES) clean: - rm -f *.o *.lst *.map *.gb *.ihx *.sym *.cdb *.adb *.asm + rm -f *.o *.lst *.map *.gb *.ihx *.sym *.cdb *.adb *.asm *.noi *.rst diff --git a/gbdk-lib/examples/gb/template_subfolders/Makefile b/gbdk-lib/examples/gb/template_subfolders/Makefile @@ -9,10 +9,10 @@ GBDK_HOME = ../../../ LCC = $(GBDK_HOME)bin/lcc -# You can set flags for LCC here -# For example, you can uncomment the line below to turn on debug output -# LCCFLAGS += -debug # Uncomment to enable debug output -# LCCFLAGS += -v # Uncomment for lcc verbose output +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif # You can set the name of the .gb ROM file here diff --git a/gbdk-lib/examples/gb/wav_sample/Makefile b/gbdk-lib/examples/gb/wav_sample/Makefile @@ -9,11 +9,14 @@ GBDK_HOME = ../../../ LCC = $(GBDK_HOME)bin/lcc -# You can set flags for LCC here -# For example, you can uncomment the line below to turn on debug output -# LCCFLAGS += -debug LCCFLAGS += -Wl-yt1 -Wl-yo4 +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + # You can set the name of the .gb ROM file here PROJECTNAME = wav_sample diff --git a/gbdk-lib/examples/msxdos/hello/Makefile b/gbdk-lib/examples/msxdos/hello/Makefile @@ -1,7 +1,13 @@ -CC = ../../../bin/lcc -v -mz80:msxdos -Wm-yoA -Wl-j +LCC = ../../../bin/lcc -v -mz80:msxdos -Wm-yoA -Wl-j BINS = test.com +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + all: $(BINS) ASRC = $(wildcard *.s) @@ -16,15 +22,15 @@ compile.bat: Makefile # Compile and link single file in one pass %.o: %.c - $(CC) -c -o $@ $< + $(LCC) $(LCCFLAGS) -c -o $@ $< %.o: %.s - $(CC) -c -o $@ $< + $(LCC) $(LCCFLAGS) -c -o $@ $< $(BINS): $(OBJS) - $(CC) -Wm-yS -o $@ $^ + $(LCC) $(LCCFLAGS) -Wm-yS -o $@ $^ rm -f *.map *.noi *.ihx *.lst clean: - rm -f *.o *.lst *.map *.com *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi + rm -f *.o *.lst *.map *.com *~ *.rel *.cdb *.adb *.ihx *.lnk *.sym *.asm *.noi *.rst diff --git a/gbdk-lib/examples/msxdos/smoke/Makefile b/gbdk-lib/examples/msxdos/smoke/Makefile @@ -1,7 +1,13 @@ -CC = ../../../bin/lcc -mz80:msxdos -Wm-yoA -Wl-j +LCC = ../../../bin/lcc -mz80:msxdos -Wm-yoA -Wl-j BINS = smoketest.com +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + all: $(BINS) ASRC = $(wildcard *.s) @@ -16,15 +22,15 @@ compile.bat: Makefile # Compile and link single file in one pass %.o: %.c - $(CC) -c -o $@ $< + $(LCC) $(LCCFLAGS) -c -o $@ $< %.o: %.s - $(CC) -c -o $@ $< + $(LCC) $(LCCFLAGS) -c -o $@ $< $(BINS): $(OBJS) - $(CC) -Wm-yS -o $@ $^ - rm -f *.map *.noi *.ihx *.lst + $(LCC) $(LCCFLAGS) -Wm-yS -o $@ $^ + rm -f *.map *.noi *.ihx *.lst *.rst clean: - rm -f *.o *.lst *.map *.com *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi *.0?? *.rom + rm -f *.o *.lst *.map *.com *~ *.rel *.cdb *.adb *.ihx *.lnk *.sym *.asm *.noi *.0?? *.rom *.rst diff --git a/gbdk-lib/examples/msxdos/test/Makefile b/gbdk-lib/examples/msxdos/test/Makefile @@ -1,7 +1,13 @@ -CC = ../../../bin/lcc -mz80:msxdos -Wm-yoA -Wl-j +LCC = ../../../bin/lcc -mz80:msxdos -Wm-yoA -Wl-j BINS = test.com +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + all: $(BINS) ASRC = $(wildcard *.s) @@ -16,15 +22,15 @@ compile.bat: Makefile # Compile and link single file in one pass %.o: %.c - $(CC) -c -o $@ $< + $(LCC) $(LCCFLAGS) -c -o $@ $< %.o: %.s - $(CC) -c -o $@ $< + $(LCC) $(LCCFLAGS) -c -o $@ $< $(BINS): $(OBJS) - $(CC) -Wm-yS -o $@ $^ + $(LCC) $(LCCFLAGS) -Wm-yS -o $@ $^ rm -f *.map *.noi *.ihx *.lst clean: - rm -f *.o *.lst *.map *.com *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi + rm -f *.o *.lst *.map *.com *~ *.rel *.cdb *.adb *.ihx *.lnk *.sym *.asm *.noi *.rst *.rom diff --git a/gbdk-lib/examples/nes/smoke/Makefile b/gbdk-lib/examples/nes/smoke/Makefile @@ -1,7 +1,13 @@ -CC = ../../../bin/lcc -mmos6502:nes -Wm-yoA -Wl-j +LCC = ../../../bin/lcc -mmos6502:nes -Wm-yoA -Wl-j BINS = smoketest.nes +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + all: $(BINS) ASRC = $(wildcard *.s) @@ -16,15 +22,15 @@ compile.bat: Makefile # Compile and link single file in one pass %.o: %.c - $(CC) -c -o $@ $< + $(LCC) $(LCCFLAGS) -c -o $@ $< %.o: %.s - $(CC) -c -o $@ $< + $(LCC) $(LCCFLAGS) -c -o $@ $< $(BINS): $(OBJS) - $(CC) -Wm-yS -o $@ $^ - rm -f *.map *.noi *.ihx *.lst + $(LCC) $(LCCFLAGS) -Wm-yS -o $@ $^ + rm -f *.map *.noi *.ihx *.lst *.rst clean: - rm -f *.o *.lst *.map *.nes *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi + rm -f *.o *.lst *.map *.nes *~ *.rel *.cdb *.adb *.ihx *.lnk *.sym *.asm *.noi *.rst diff --git a/gbdk-lib/examples/nes/snes_joypads/Makefile b/gbdk-lib/examples/nes/snes_joypads/Makefile @@ -1,7 +1,13 @@ -CC = ../../../bin/lcc -mmos6502:nes -Wm-yoA -Wl-j +LCC = ../../../bin/lcc -mmos6502:nes -Wm-yoA -Wl-j BINS = snes_joypads.nes +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + + all: $(BINS) ASRC = $(wildcard *.s) @@ -16,15 +22,15 @@ compile.bat: Makefile # Compile and link single file in one pass %.o: %.c - $(CC) -c -o $@ $< + $(LCC) $(LCCFLAGS) -c -o $@ $< %.o: %.s - $(CC) -c -o $@ $< + $(LCC) $(LCCFLAGS) -c -o $@ $< $(BINS): $(OBJS) - $(CC) -Wm-yS -o $@ $^ - rm -f *.map *.noi *.ihx *.lst + $(LCC) $(LCCFLAGS) -Wm-yS -o $@ $^ + rm -f *.map *.noi *.ihx *.lst *.rst clean: - rm -f *.o *.lst *.map *.nes *~ *.rel *.cdb *.ihx *.lnk *.sym *.asm *.noi + rm -f *.o *.lst *.map *.nes *~ *.rel *.cdb *.adb *.ihx *.lnk *.sym *.asm *.noi *.rst diff --git a/gbdk-lib/examples/sms/wav_sample/Makefile b/gbdk-lib/examples/sms/wav_sample/Makefile @@ -9,9 +9,14 @@ GBDK_HOME = ../../../ LCC = $(GBDK_HOME)bin/lcc + +# GBDK_DEBUG = ON +ifdef GBDK_DEBUG + LCCFLAGS += -debug -v +endif + # You can set flags for LCC here # For example, you can uncomment the line below to turn on debug output -# LCCFLAGS += -debug LCCFLAGS += -mz80:sms -autobank # You can set the name of the .gb ROM file here diff --git a/gbdk-support/lcc/lcc.c b/gbdk-support/lcc/lcc.c @@ -779,7 +779,8 @@ static void help(void) { "-Bdir/ use the compiler named `dir/rcc'\n", "-c compile only\n", "-dn set switch statement density to `n'\n", -"-debug Turns on --debug for compiler, -y (.cdb) and -j (.noi) for linker\n", +"-debug Turns on --debug for compiler, -y (.cdb), -j (.noi), -w (wide .map format) for linker\n", +" -Wa-l (assembler .lst), -Wl-u (.lst -> .rst address update)", "-Dname -Dname=def define the preprocessor symbol `name'\n", "-E only run preprocessor on named .c and .h files files -> stdout\n", "--save-preproc Use with -E for output to *.i files instead of stdout\n", @@ -970,8 +971,12 @@ static void opt(char *arg) { if (strcmp(arg, "-debug") == 0) { // Load default debug options clist = append("--debug", clist); // Debug for sdcc compiler - llist[L_ARGS] = append("-y", llist[L_ARGS]); // Enable .cdb output for sdldgb linker - llist[L_ARGS] = append("-j", llist[L_ARGS]); // Enable .noi output + llist[L_ARGS] = append("-y", llist[L_ARGS]); // linker: .cdb output for sdldgb + llist[L_ARGS] = append("-j", llist[L_ARGS]); // linker: .noi output + + alist = append("-l", alist); // assembler: .lst output + llist[L_ARGS] = append("-u", llist[L_ARGS]); // linker: .lst -> .rst address update + llist[L_ARGS] = append("-w", llist[L_ARGS]); // linker: wide listing in .map file return; }
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.