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/emu_debug/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=gg gbc
     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 
     22 LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags
     23 
     24 LCCFLAGS += -Wl-j -Wm-yoA -Wm-ya4 -autobank -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags
     25 
     26 # GBDK_DEBUG = ON
     27 ifdef GBDK_DEBUG
     28 	LCCFLAGS += -debug -v
     29 endif
     30 
     31 
     32 # You can set the name of the ROM file here
     33 PROJECTNAME = emu_debug
     34 
     35 # EXT?=gb # Only sets extension to default (game boy .gb) if not populated
     36 SRCDIR      = src
     37 OBJDIR      = obj/$(EXT)
     38 RESDIR      = res
     39 BINDIR      = build/$(EXT)
     40 MKDIRS      = $(OBJDIR) $(BINDIR) # See bottom of Makefile for directory auto-creation
     41 
     42 BINS	    = $(OBJDIR)/$(PROJECTNAME).$(EXT)
     43 CSOURCES    = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.c))) $(foreach dir,$(RESDIR),$(notdir $(wildcard $(dir)/*.c)))
     44 ASMSOURCES  = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.s)))
     45 OBJS       = $(CSOURCES:%.c=$(OBJDIR)/%.o) $(ASMSOURCES:%.s=$(OBJDIR)/%.o)
     46 
     47 # Builds all targets sequentially
     48 all: $(TARGETS)
     49 
     50 compile.bat: Makefile
     51 	@echo "REM Automatically generated from Makefile" > compile.bat
     52 	@make -sn | sed y/\\//\\\\/ | grep -v make >> compile.bat
     53 
     54 
     55 # Compile .c files in "src/" to .o object files
     56 $(OBJDIR)/%.o:	$(SRCDIR)/%.c
     57 	$(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $<
     58 
     59 # Compile .c files in "res/" to .o object files
     60 $(OBJDIR)/%.o:	$(RESDIR)/%.c
     61 	$(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $<
     62 
     63 # Compile .s assembly files in "src/" to .o object files
     64 $(OBJDIR)/%.o:	$(SRCDIR)/%.s
     65 	$(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $<
     66 
     67 # If needed, compile .c files in "src/" to .s assembly files
     68 # (not required if .c is compiled directly to .o)
     69 $(OBJDIR)/%.s:	$(SRCDIR)/%.c
     70 	$(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $<
     71 
     72 # Link the compiled object files into a .gb ROM file
     73 $(BINS):	$(OBJS)
     74 	$(LCC) $(LCCFLAGS) $(CFLAGS) -o $(BINDIR)/$(PROJECTNAME).$(EXT) $(OBJS)
     75 
     76 clean:
     77 	@echo Cleaning
     78 	@for target in $(TARGETS); do \
     79 		$(MAKE) $$target-clean; \
     80 	done
     81 
     82 # Include available build targets
     83 include Makefile.targets
     84 
     85 
     86 # create necessary directories after Makefile is parsed but before build
     87 # info prevents the command from being pasted into the makefile
     88 ifneq ($(strip $(EXT)),)           # Only make the directories if EXT has been set by a target
     89 $(info $(shell mkdir -p $(MKDIRS)))
     90 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.