gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
gbdk-lib/examples/gb/wav_sample/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 LCCFLAGS += -Wl-yt1 -Wl-yo4
15
16 # GBDK_DEBUG = ON
17 ifdef GBDK_DEBUG
18 LCCFLAGS += -debug -v
19 endif
20
21
22 # You can set the name of the .gb ROM file here
23 PROJECTNAME = wav_sample
24
25 SRCDIR = src
26 OBJDIR = obj
27 RESDIR = res
28 BINS = $(OBJDIR)/$(PROJECTNAME).gb
29 CSOURCES = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.c))) $(foreach dir,$(RESDIR),$(notdir $(wildcard $(dir)/*.c)))
30 ASMSOURCES = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.s)))
31 OBJS = $(CSOURCES:%.c=$(OBJDIR)/%.o) $(ASMSOURCES:%.s=$(OBJDIR)/%.o)
32
33 all: prepare $(BINS)
34
35 compile.bat: Makefile
36 @echo "REM Automatically generated from Makefile" > compile.bat
37 @make -sn | sed y/\\//\\\\/ | sed s/mkdir\ -p\/mkdir\/ | grep -v make >> compile.bat
38
39 # Compile .c files in "src/" to .o object files
40 $(OBJDIR)/%.o: $(SRCDIR)/%.c
41 $(LCC) $(LCCFLAGS) -c -o $@ $<
42
43 # Compile .c files in "res/" to .o object files
44 $(OBJDIR)/%.o: $(RESDIR)/%.c
45 $(LCC) $(LCCFLAGS) -c -o $@ $<
46
47 # Compile .s assembly files in "src/" to .o object files
48 $(OBJDIR)/%.o: $(SRCDIR)/%.s
49 $(LCC) $(LCCFLAGS) -c -o $@ $<
50
51 # If needed, compile .c files in "src/" to .s assembly files
52 # (not required if .c is compiled directly to .o)
53 $(OBJDIR)/%.s: $(SRCDIR)/%.c
54 $(LCC) $(LCCFLAGS) -S -o $@ $<
55
56 # Link the compiled object files into a .gb ROM file
57 $(BINS): $(OBJS)
58 $(LCC) $(LCCFLAGS) -o $(BINS) $(OBJS)
59
60 prepare:
61 mkdir -p $(OBJDIR) $(RESDIR)
62
63 clean:
64 # rm -f *.gb *.ihx *.cdb *.adb *.noi *.map
65 rm -f $(OBJDIR)/*.*
66
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.