gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
gbdk-lib/examples/megaduck/laptop_speech/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
9 # Set platforms to build here, spaced separated. (These are in the separate Makefile.targets)
10 # They can also be built/cleaned individually: "make gg" and "make gg-clean"
11 # Possible are: gb gbc pocket megaduck sms gg
12 TARGETS= megaduck # gb pocket megaduck sms gg nes
13
14 # Configure platform specific LCC flags here:
15 LCCFLAGS_gb = # -Wl-yt0x1B # Set an MBC for banking (1B-ROM+MBC5+RAM+BATT)
16 LCCFLAGS_pocket = # -Wl-yt0x1B # Usually the same as required for .gb
17 LCCFLAGS_duck =
18 LCCFLAGS_gbc = # -Wl-yt0x1B -Wm-yc # Same as .gb with: -Wm-yc (gb & gbc) or Wm-yC (gbc exclusive)
19 LCCFLAGS_sms =
20 LCCFLAGS_gg =
21 LCCFLAGS_nes =
22
23 LCCFLAGS += $(LCCFLAGS_$(EXT)) # This adds the current platform specific LCC Flags
24
25 LCCFLAGS += -Wl-j # -Wm-yS -Wm-yoA -Wm-ya4 -autobank -Wb-ext=.rel -Wb-v # MBC + Autobanking related flags
26
27 LCCFLAGS += -Wf-MMD -Wf-Wp-MP # Header file dependency output (-MMD) for Makefile use + per-header Phony rules (-MP)
28 CFLAGS += -Wf-MMD -Wf-Wp-MP # Header file dependency output (-MMD) for Makefile use + per-header Phony rules (-MP)
29
30 # GBDK_DEBUG = ON
31 ifdef GBDK_DEBUG
32 LCCFLAGS += -debug -v
33 endif
34
35
36 # You can set the name of the ROM file here
37 PROJECTNAME = megaduck_speech
38
39 # EXT?=gb # Only sets extension to default (game boy .gb) if not populated
40 SRCDIR = src
41 OBJDIR = obj/$(EXT)
42 RESDIR = res
43 BINDIR = build/$(EXT)
44 MKDIRS = $(OBJDIR) $(BINDIR) # See bottom of Makefile for directory auto-creation
45
46 BINS = $(OBJDIR)/$(PROJECTNAME).$(EXT)
47 CSOURCES = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.c))) $(foreach dir,$(RESDIR),$(notdir $(wildcard $(dir)/*.c)))
48
49 ASMSOURCES = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.s)))
50 OBJS = $(CSOURCES:%.c=$(OBJDIR)/%.o) $(ASMSOURCES:%.s=$(OBJDIR)/%.o)
51
52 # Dependencies (using output from -Wf-MMD -Wf-Wp-MP)
53 DEPS = $(OBJS:%.o=%.d)
54
55 -include $(DEPS)
56
57 # Builds all targets sequentially
58 all: $(TARGETS)
59
60 test:
61 echo $(CSOURCES)
62
63 compile.bat: Makefile
64 @echo "REM Automatically generated from Makefile" > compile.bat
65 @make -sn | sed y/\\//\\\\/ | sed s/mkdir\ -p\/mkdir\/ | grep -v make >> compile.bat
66
67
68 # Compile .c files in "src/" to .o object files
69 $(OBJDIR)/%.o: $(SRCDIR)/%.c
70 $(LCC) $(CFLAGS) -c -o $@ $<
71
72 # Compile .c files in "res/" to .o object files
73 $(OBJDIR)/%.o: $(RESDIR)/%.c
74 $(LCC) $(CFLAGS) -c -o $@ $<
75
76 # Compile .s assembly files in "src/" to .o object files
77 $(OBJDIR)/%.o: $(SRCDIR)/%.s
78 $(LCC) $(CFLAGS) -c -o $@ $<
79
80 # If needed, compile .c files in "src/" to .s assembly files
81 # (not required if .c is compiled directly to .o)
82 $(OBJDIR)/%.s: $(SRCDIR)/%.c
83 $(LCC) $(CFLAGS) -S -o $@ $<
84
85 # Link the compiled object files into a .gb ROM file
86 $(BINS): $(OBJS)
87 $(LCC) $(LCCFLAGS) $(CFLAGS) -o $(BINDIR)/$(PROJECTNAME).$(EXT) $(OBJS)
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.