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