-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgbdk.mk
40 lines (31 loc) · 787 Bytes
/
gbdk.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
LCC = $(GBDK_HOME)/bin/lcc
CFLAGS = -v
CFLAGS_GB = -msm83:gb
CFLAGS_POCKET = -msm83:ap
CFLAGS_NES = -mmos6502:nes
CFLAGS_GG = -mz80:gg
CFLAGS_SMS = -mz80:sms
CFLAGS += $(CFLAGS_$(PLAT))
LFLAGS = -Wl-j -Wm-yS -Wm-yoA -Wm-ya4 -autobank -Wb-ext=.rel -Wb-v
LFLAGS_GB = -Wl-yt0x1B
LFLAGS_POCKET = -Wl-yt0x1B
LFLAGS_NES =
LFLAGS_GG =
LFLAGS_SMS =
LFLAGS += $(LFLAGS_$(PLAT))
SRCDIR = src
CSRC = $(foreach dir,$(SRCDIR),$(notdir $(wildcard $(dir)/*.c)))
OUTDIR = bin/$(PLAT)
OBJDIR = obj/$(PLAT)
OBJS = $(CSRC:%.c=$(OBJDIR)/%.o)
OUTPUT = $(PROJ).${PLAT}
all: $(OUTPUT)
$(OBJDIR)/%.o : $(SRCDIR)/%.c
$(LCC) $(CFLAGS) -c -o $@ $<
$(OUTPUT) : $(OBJS)
$(LCC) $(LFLAGS) $(CFLAGS) -o $(OUTDIR)/$@ $^
# TODO should $^ be $<
clean:
rm $(OBJDIR)
rm $(OUTDIR)
# TODO rm needs extra work