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