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/gb/mbc7_accelerometer/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 # gb pocket megaduck sms gg nes
     13 
     14 # Configure platform specific LCC flags here:
     15 LCCFLAGS_gb      = -Wl-yt0x22 # Set an MBC for banking (1B-ROM+MBC5+RAM+BATT)
     16 LCCFLAGS_pocket  = -Wl-yt0x22 # Usually the same as required for .gb
     17 LCCFLAGS_duck    =
     18 LCCFLAGS_gbc     = -Wl-yt0x22 -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 
     23 LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags
     24 
     25 LCCFLAGS += -Wl-j # -Wm-yS -Wm-yoA -Wm-ya4 -autobank -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags
     26 LCCFLAGS += -Wf-MMD -Wf-Wp-MP # Header file dependency output (-MMD) for Makefile use + per-header Phony rules (-MP)
     27 CFLAGS += -Wf-MMD -Wf-Wp-MP # Header file dependency output (-MMD) for Makefile use + per-header Phony rules (-MP)
     28 
     29 # GBDK_DEBUG = ON
     30 ifdef GBDK_DEBUG
     31 	LCCFLAGS += -debug -v
     32 endif
     33 
     34 # You can set the name of the ROM file here
     35 PROJECTNAME = mbc7_accelerometer
     36 
     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 
     48 ASMSOURCES  = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.s)))
     49 OBJS        = $(CSOURCES:%.c=$(OBJDIR)/%.o) $(ASMSOURCES:%.s=$(OBJDIR)/%.o)
     50 
     51 # Dependencies (using output from -Wf-MMD -Wf-Wp-MP)
     52 DEPS = $(OBJS:%.o=%.d)
     53 
     54 -include $(DEPS)
     55 
     56 # Builds all targets sequentially
     57 all: $(TARGETS)
     58 
     59 compile.bat: Makefile
     60 	@echo "REM Automatically generated from Makefile" > compile.bat
     61 	@make -sn | sed y/\\//\\\\/ | sed s/mkdir\ -p\/mkdir\/ | grep -v make >> compile.bat
     62 
     63 test:
     64 	echo $(CSOURCES)
     65 
     66 
     67 # Compile .c files in "src/" to .o object files
     68 $(OBJDIR)/%.o:	$(SRCDIR)/%.c
     69 	$(LCC) $(CFLAGS) -c -o $@ $<
     70 
     71 # Compile .c files in "res/" to .o object files
     72 $(OBJDIR)/%.o:	$(RESDIR)/%.c
     73 	$(LCC) $(CFLAGS) -c -o $@ $<
     74 
     75 # Compile .s assembly files in "src/" to .o object files
     76 $(OBJDIR)/%.o:	$(SRCDIR)/%.s
     77 	$(LCC) $(CFLAGS) -c -o $@ $<
     78 
     79 # If needed, compile .c files in "src/" to .s assembly files
     80 # (not required if .c is compiled directly to .o)
     81 $(OBJDIR)/%.s:	$(SRCDIR)/%.c
     82 	$(LCC) $(CFLAGS) -S -o $@ $<
     83 
     84 # Link the compiled object files into a .gb ROM file
     85 $(BINS):	$(OBJS)
     86 	$(LCC) $(LCCFLAGS) $(CFLAGS) -o $(BINDIR)/$(PROJECTNAME).$(EXT) $(OBJS)
     87 
     88 clean:
     89 	@echo Cleaning
     90 	@for target in $(TARGETS); do \
     91 		$(MAKE) $$target-clean; \
     92 	done
     93 
     94 # Include available build targets
     95 include Makefile.targets
     96 
     97 
     98 # create necessary directories after Makefile is parsed but before build
     99 # info prevents the command from being pasted into the makefile
    100 ifneq ($(strip $(EXT)),)           # Only make the directories if EXT has been set by a target
    101 $(info $(shell mkdir -p $(MKDIRS)))
    102 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.