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_advanced_dialogue/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      = 
     17 LCCFLAGS_pocket  = 
     18 LCCFLAGS_duck    = 
     19 LCCFLAGS_gbc     =
     20 LCCFLAGS_sms     = 
     21 LCCFLAGS_gg      = 
     22 LCCFLAGS_nes     = 
     23 
     24 LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC 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 = text_advanced_dialogue
     34 
     35 SRCDIR      = src
     36 OBJDIR      = obj/$(EXT)
     37 RESDIR      = res
     38 DISTDIR      = dist
     39 BINDIR      = build/$(EXT)
     40 GENDIR      = gen/$(EXT)/src
     41 
     42 MKDIRS      = $(OBJDIR) $(BINDIR) $(GENDIR) # See bottom of Makefile for directory auto-creation
     43 GENSOURCES    = $(foreach dir,$(GENDIR), $(wildcard $(dir)/*.c))
     44 BINS	    = $(OBJDIR)/$(PROJECTNAME).$(EXT)
     45 CSOURCES    = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.c))) $(foreach dir,$(RESDIR),$(notdir $(wildcard $(dir)/*.c)))
     46 ASMSOURCES  = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.s)))
     47 OBJS       = $(CSOURCES:%.c=$(OBJDIR)/%.o) $(ASMSOURCES:%.s=$(OBJDIR)/%.o)
     48 
     49 
     50 # png2asset settings for backgrounds
     51 PNG2ASSET_BKG_SETTINGS_gg=-pack_mode sms -bpp 4
     52 PNG2ASSET_BKG_SETTINGS_sms=-pack_mode sms -bpp 4
     53 PNG2ASSET_BKG_SETTINGS_nes=-pack_mode nes -bpp 2
     54 PNG2ASSET_BKG_SETTINGS_gb=
     55 PNG2ASSET_BKG_SETTINGS_gbc=
     56 PNG2ASSET_BKG_SETTINGS_duck=
     57 PNG2ASSET_BKG_SETTINGS_pocket=
     58 
     59 
     60 # Builds all targets sequentially
     61 all: $(TARGETS)
     62 
     63 compile.bat: Makefile
     64 	@echo "REM Automatically generated from Makefile" > compile.bat
     65 	@make -sn | sed y/\\//\\\\/ | grep -v make >> compile.bat
     66 
     67 
     68 # Compile .c files in "src/" to .o object files
     69 $(OBJDIR)/%.o:	$(SRCDIR)/%.c
     70 	$(LCC) $(LCCFLAGS) $(CFLAGS) -I$(GENDIR) -c -o $@ $<
     71 
     72 # Compile .s assembly files in "src/" to .o object files
     73 $(OBJDIR)/%.o:	$(SRCDIR)/%.s
     74 	$(LCC) $(LCCFLAGS) $(CFLAGS) -I$(GENDIR) -c -o $@ $<
     75 
     76 # If needed, compile .c files in "src/" to .s assembly files
     77 # (not required if .c is compiled directly to .o)
     78 $(OBJDIR)/%.s:	$(SRCDIR)/%.c
     79 	$(LCC) $(LCCFLAGS) $(CFLAGS) -I$(GENDIR) -S -o $@ $<
     80 
     81 png2asset:
     82 	$(PNG2ASSET) $(RESDIR)/Font.png $(PNG2ASSET_BKG_SETTINGS_$(EXT)) -c $(GENDIR)/Font.c -map -keep_palette_order  -noflip
     83 	$(PNG2ASSET) $(RESDIR)/DialogueBox.png $(PNG2ASSET_BKG_SETTINGS_$(EXT)) -c $(GENDIR)/DialogueBox.c -map -keep_palette_order -noflip
     84 
     85 # Link the compiled object files into a .gb ROM file
     86 $(BINS):	$(OBJS)
     87 	$(LCC) $(LCCFLAGS) $(CFLAGS) -I$(GENDIR) -o $(BINDIR)/$(PROJECTNAME).$(EXT) $(OBJS) $(GENSOURCES)
     88 
     89 clean:
     90 	@echo Cleaning
     91 	@for target in $(TARGETS); do \
     92 		$(MAKE) $$target-clean; \
     93 	done
     94 
     95 # Include available build targets
     96 include Makefile.targets
     97 
     98 
     99 # create necessary directories after Makefile is parsed but before build
    100 # info prevents the command from being pasted into the makefile
    101 ifneq ($(strip $(EXT)),)           # Only make the directories if EXT has been set by a target
    102 $(info $(shell mkdir -p $(MKDIRS)))
    103 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.