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/sms/pause_button/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 
     14 
     15 # GBDK_DEBUG = ON
     16 ifdef GBDK_DEBUG
     17 	LCCFLAGS += -debug -v
     18 endif
     19 
     20 # You can set flags for LCC here
     21 # For example, you can uncomment the line below to turn on debug output
     22 LCCFLAGS += -mz80:sms -autobank
     23 
     24 # You can set the name of the .gb ROM file here
     25 PROJECTNAME = pause
     26 
     27 SRCDIR      = src
     28 OBJDIR      = obj
     29 RESDIR      = res
     30 BINS	    = $(OBJDIR)/$(PROJECTNAME).sms
     31 CSOURCES    = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.c))) $(foreach dir,$(RESDIR),$(notdir $(wildcard $(dir)/*.c)))
     32 ASMSOURCES  = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.s)))
     33 OBJS        = $(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)/%.o:	$(RESDIR)/%.c
     47 	$(LCC) $(LCCFLAGS) -c -o $@ $<
     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 # Link the compiled object files into a .gb ROM file
     59 $(BINS):	$(OBJS)
     60 	$(LCC) $(LCCFLAGS) -o $(BINS) $(OBJS)
     61 
     62 prepare:
     63 	mkdir -p $(OBJDIR) $(RESDIR)
     64 
     65 clean:
     66 #	rm -f  *.gb *.ihx *.cdb *.adb *.noi *.map
     67 	rm -f  $(OBJDIR)/*.*
     68 

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