git.y1.nz

gbdk-2020

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

gbdk-lib/examples/cross-platform/banks_autobank/Makefile

      1 # If you move this project you can change the directory
      2 # to match your GBDK root directory (ex: GBDK_HOME = "C:/GBDK/"
      3 ifndef GBDK_HOME
      4 	GBDK_HOME = ../../../
      5 endif
      6 
      7 LCC = $(GBDK_HOME)/bin/lcc
      8 
      9 # Set platforms to build here, spaced separated. (These are in the separate Makefile.targets)
     10 # They can also be built/cleaned individually: "make gg" and "make gg-clean"
     11 # Possible are: gb gbc pocket megaduck sms gg
     12 TARGETS = gb pocket megaduck sms gg msxdos nes
     13 
     14 # Configure platform specific LCC flags here:
     15 LCCFLAGS_gb      = -Wl-yt0x1B # Set an MBC for banking (1B-ROM+MBC5+RAM+BATT)
     16 LCCFLAGS_pocket  = -Wl-yt0x1B # Usually the same as required for .gb
     17 LCCFLAGS_duck    = -Wl-yt0x1B # Usually the same as required for .gb
     18 LCCFLAGS_gbc     = -Wl-yt0x1B -Wm-yc # Same as .gb with: -Wm-yc (gb & gbc) or Wm-yC (gbc exclusive)
     19 LCCFLAGS_sms     =
     20 LCCFLAGS_gg      =
     21 LCCFLAGS_nes     =
     22 LCCFLAGS_msxdos  =
     23 
     24 LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags
     25 
     26 # If -autobank is specified then lcc will automatically add -Wm-yoA if no -yo* entry is present
     27 LCCFLAGS += -Wl-j -Wm-ya4 -autobank -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags
     28 
     29 # GBDK_DEBUG = ON
     30 ifdef GBDK_DEBUG
     31 	LCCFLAGS += -debug -v
     32 endif
     33 
     34 
     35 CFLAGS      = -Iinclude
     36 
     37 # You can set the name of the ROM file here
     38 PROJECTNAME = test
     39 
     40 # EXT?=gb # Only sets extension to default (game boy .gb) if not populated
     41 SRCDIR      = src
     42 OBJDIR      = obj/$(EXT)
     43 RESDIR      = res
     44 BINDIR      = build/$(EXT)
     45 MKDIRS      = $(OBJDIR) $(BINDIR) # See bottom of Makefile for directory auto-creation
     46 
     47 BINS	    = $(OBJDIR)/$(PROJECTNAME).$(EXT)
     48 CSOURCES    = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.c))) $(foreach dir,$(RESDIR),$(notdir $(wildcard $(dir)/*.c)))
     49 ASMSOURCES  = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.s)))
     50 OBJS        = $(CSOURCES:%.c=$(OBJDIR)/%.o) $(ASMSOURCES:%.s=$(OBJDIR)/%.o)
     51 
     52 # Builds all targets sequentially
     53 all: $(TARGETS)
     54 
     55 compile.bat: Makefile
     56 	@echo "REM Automatically generated from Makefile" > compile.bat
     57 	@make -sn | sed y/\\//\\\\/ | grep -v make >> compile.bat
     58 
     59 
     60 # Compile .c files in "src/" to .o object files
     61 $(OBJDIR)/%.o:	$(SRCDIR)/%.c
     62 	$(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $<
     63 
     64 # Compile .c files in "res/" to .o object files
     65 $(OBJDIR)/%.o:	$(RESDIR)/%.c
     66 	$(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $<
     67 
     68 # Compile .s assembly files in "src/" to .o object files
     69 $(OBJDIR)/%.o:	$(SRCDIR)/%.s
     70 	$(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $<
     71 
     72 # If needed, compile .c files in "src/" to .s assembly files
     73 # (not required if .c is compiled directly to .o)
     74 $(OBJDIR)/%.s:	$(SRCDIR)/%.c
     75 	$(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $<
     76 
     77 # Link the compiled object files into a .gb ROM file
     78 $(BINS):	$(OBJS)
     79 	$(LCC) $(LCCFLAGS) $(CFLAGS) -o $(BINDIR)/$(PROJECTNAME).$(EXT) $(OBJS)
     80 	rm -f $(BINDIR)/*.map $(BINDIR)/*.ihx $(BINDIR)/*.bin
     81 
     82 clean:
     83 	@echo Cleaning
     84 	@for target in $(TARGETS); do \
     85 		$(MAKE) $$target-clean; \
     86 	done
     87 
     88 # Include available build targets
     89 include Makefile.targets
     90 
     91 
     92 # create necessary directories after Makefile is parsed but before build
     93 # info prevents the command from being pasted into the makefile
     94 ifneq ($(strip $(EXT)),)           # Only make the directories if EXT has been set by a target
     95 $(info $(shell mkdir -p $(MKDIRS)))
     96 endif

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