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/logo/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 PNG2ASSETS = $(GBDK_HOME)/bin/png2asset
      9 
     10 # Set platforms to build here, spaced separated. (These are in the separate Makefile.targets)
     11 # They can also be built/cleaned individually: "make gg" and "make gg-clean"
     12 # Possible are: gb gbc pocket megaduck sms gg
     13 TARGETS=gb gbc pocket megaduck sms gg nes
     14 
     15 # You can set the name of the resulting ROM file here
     16 PROJECTNAME = logo
     17 
     18 # You can set the name of the ROM title embedded in the ROM header here
     19 TITLE = LOGO # must be all upper case, maximum 15 characters
     20 
     21 # Configure platform specific LCC flags here:
     22 LCCFLAGS_gb      = -Wl-yt0x1B -autobank # Set an MBC for banking (1B-ROM+MBC5+RAM+BATT)
     23 LCCFLAGS_pocket  = -Wl-yt0x1B -autobank # Usually the same as required for .gb
     24 LCCFLAGS_duck    = -Wl-yt0x1B -autobank # Usually the same as required for .gb
     25 LCCFLAGS_gbc     = -Wl-yt0x1B -Wm-yc -autobank # Same as .gb with: -Wm-yc (gb & gbc) or Wm-yC (gbc exclusive)
     26 LCCFLAGS_sms     =
     27 LCCFLAGS_gg      =
     28 LCCFLAGS_nes     =
     29 
     30 LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags
     31 
     32 LCCFLAGS += -Wl-j -Wm-yoA -Wm-ya4 -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags
     33 
     34 LCCFLAGS += -Wm-yn"$(TITLE)" # Add title to rom cartridge header
     35 
     36 # GBDK_DEBUG = ON
     37 ifdef GBDK_DEBUG
     38 	LCCFLAGS += -debug -v
     39 endif
     40 
     41 
     42 RESFLAGS += $(RESFLAGS_$(TYP))
     43 
     44 CFLAGS += -I$(OBJDIR) -DSYSTEM_$(TYP)
     45 
     46 # EXT?=gb # Only sets extension to default (game boy .gb) if not populated
     47 SRCDIR      = src
     48 OBJDIR      = obj/$(EXT)
     49 RESDIR      = res/$(TYP)
     50 BINDIR      = build/$(EXT)
     51 MKDIRS      = $(OBJDIR) $(BINDIR) # See bottom of Makefile for directory auto-creation
     52 
     53 BINS	    = $(OBJDIR)/$(PROJECTNAME).$(EXT)
     54 IMAGES      = $(foreach dir,$(RESDIR),$(notdir $(wildcard $(dir)/*.png)))
     55 CSOURCES    = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.c)))
     56 ASMSOURCES  = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.s)))
     57 OBJS        = $(IMAGES:%.png=$(OBJDIR)/%.o) $(CSOURCES:%.c=$(OBJDIR)/%.o) $(ASMSOURCES:%.s=$(OBJDIR)/%.o)
     58 
     59 # Builds all targets sequentially
     60 all: $(TARGETS)
     61 
     62 compile.bat: Makefile
     63 	@echo "REM Automatically generated from Makefile" > compile.bat
     64 	@make -sn | sed y/\\//\\\\/ | grep -v make >> compile.bat
     65 
     66 
     67 .SECONDEXPANSION:
     68 $(OBJDIR)/%.c: $(RESDIR)/%.png $$(wildcard $(RESDIR)/gfx/$(PLAT)/backgrounds/%.png.meta)
     69 	$(PNG2ASSETS) $< `cat <$<.meta 2>/dev/null` -c $@
     70 
     71 $(OBJDIR)/%.o:	$(OBJDIR)/%.c
     72 	$(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $<
     73 
     74 # Compile .c files in "src/" to .o object files
     75 $(OBJDIR)/%.o:	$(SRCDIR)/%.c
     76 	$(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $<
     77 
     78 # Compile .c files in "res/" to .o object files
     79 $(OBJDIR)/%.o:	$(RESDIR)/%.c
     80 	$(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $<
     81 
     82 # Compile .s assembly files in "src/" to .o object files
     83 $(OBJDIR)/%.o:	$(SRCDIR)/%.s
     84 	$(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $<
     85 
     86 # If needed, compile .c files in "src/" to .s assembly files
     87 # (not required if .c is compiled directly to .o)
     88 $(OBJDIR)/%.s:	$(SRCDIR)/%.c
     89 	$(LCC) $(LCCFLAGS) $(CFLAGS) -S -o $@ $<
     90 
     91 # Link the compiled object files into a .gb ROM file
     92 $(BINS):	$(OBJS)
     93 	$(LCC) $(LCCFLAGS) $(CFLAGS) -o $(BINDIR)/$(PROJECTNAME).$(EXT) $(OBJS)
     94 
     95 clean:
     96 	@echo Cleaning
     97 	@for target in $(TARGETS); do \
     98 		$(MAKE) $$target-clean; \
     99 	done
    100 
    101 # Include available build targets
    102 include Makefile.targets
    103 
    104 
    105 # create necessary directories after Makefile is parsed but before build
    106 # info prevents the command from being pasted into the makefile
    107 ifneq ($(strip $(EXT)),)           # Only make the directories if EXT has been set by a target
    108 $(info $(shell mkdir -p $(MKDIRS)))
    109 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.