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/sram_banks/Makefile

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