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/hblank_copy/Makefile

      1 #
      2 # A Makefile that compiles all .c and .s files in "src" and "res" 
      3 # subdirectories and places the output in a "obj" subdirectory
      4 #
      5 
      6 # If you move this project you can change the directory 
      7 # to match your GBDK root directory (ex: GBDK_HOME = "C:/GBDK/"
      8 ifndef GBDK_HOME
      9 	GBDK_HOME = ../../../
     10 endif
     11 
     12 LCC = $(GBDK_HOME)/bin/lcc 
     13 PNG2ASSET = $(GBDK_HOME)/bin/png2asset
     14 
     15 LCCFLAGS += -Wm-yt0x19 -Wm-yoA -autobank -I$(OBJDIR)
     16 
     17 # GBDK_DEBUG = ON
     18 ifdef GBDK_DEBUG
     19 	LCCFLAGS += -debug -v
     20 endif
     21 
     22 
     23 # You can set the name of the .gb ROM file here
     24 PROJECTNAME    = hblank_copy
     25 
     26 SRCDIR      = src
     27 OBJDIR      = obj
     28 RESDIR      = res
     29 BINS	    = $(OBJDIR)/$(PROJECTNAME).gb
     30 RESOURCES   = $(foreach dir,$(RESDIR),$(notdir $(wildcard $(dir)/*.png)))
     31 CSOURCES    = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.c)))
     32 ASMSOURCES  = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.s)))
     33 OBJS        = $(RESOURCES:%.png=$(OBJDIR)/%.o) $(CSOURCES:%.c=$(OBJDIR)/%.o) $(ASMSOURCES:%.s=$(OBJDIR)/%.o)
     34 
     35 all:	prepare $(BINS)
     36 
     37 compile.bat: Makefile
     38 	@echo "REM Automatically generated from Makefile" > compile.bat
     39 	@make -sn | sed y/\\//\\\\/ | sed s/mkdir\ -p\/mkdir\/ | grep -v make >> compile.bat
     40 
     41 # Compile .c files in "src/" to .o object files
     42 $(OBJDIR)/%.o:	$(SRCDIR)/%.c
     43 	$(LCC) $(LCCFLAGS) -c -o $@ $<
     44 
     45 # Compile .c files in "res/" to .o object files
     46 $(OBJDIR)/%.c:	$(RESDIR)/%.png
     47 	$(PNG2ASSET) $< -c $@ -map -noflip -tiles_only -keep_duplicate_tiles -b 255
     48 
     49 # Compile .s assembly files in "src/" to .o object files
     50 $(OBJDIR)/%.o:	$(SRCDIR)/%.s
     51 	$(LCC) $(LCCFLAGS) -c -o $@ $<
     52 
     53 # If needed, compile .c files in "src/" to .s assembly files
     54 # (not required if .c is compiled directly to .o)
     55 $(OBJDIR)/%.s:	$(SRCDIR)/%.c
     56 	$(LCC) $(LCCFLAGS) -S -o $@ $<
     57 
     58 # rule for the autogenerated files
     59 $(OBJDIR)/%.o:	$(OBJDIR)/%.c
     60 	$(LCC) $(LCCFLAGS) $(CFLAGS) -c -o $@ $<
     61 
     62 
     63 # Link the compiled object files into a .gb ROM file
     64 $(BINS):	$(OBJS)
     65 	$(LCC) $(LCCFLAGS) -o $(BINS) $(OBJS)
     66 
     67 prepare:
     68 	mkdir -p $(OBJDIR) $(RESDIR)
     69 
     70 clean:
     71 #	rm -f  *.gb *.ihx *.cdb *.adb *.noi *.map
     72 	rm -f  $(OBJDIR)/*.*
     73 

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.