-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
91 lines (63 loc) · 2.2 KB
/
Makefile
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
AS = ca65
CC = cl65
BINDIR = bin
OBJDIR = obj
RESOBJ = res
DEPDIR = dep
SRCDIR = src
IMGTYPE := d64
CFLAGS = -g -t geos-cbm -T --listing $(basename $@).lst --bin-include-dir $(RESOBJ) --create-dep $(DEPDIR)/$(notdir $@).dep
ASFLAGS = -g -t geos-cbm -I ./inc/ --bin-include-dir $(RESOBJ) --create-dep $(DEPDIR)/$(notdir $@).dep --listing $(basename $@).lst
LDFLAGS = -t geos-cbm -Ln $(basename $@).lbl --mapfile $(basename $@).map -Wl --dbgfile,$(basename $@).dbg
PRG = ultimateRTC
SRCS = header.grc ultimateRTC.s ucommand.s
BITMAPS =
ICONS = ultimateRTC.xcf
ifneq ($(MOCK),)
CFLAGS += -DMOCK
ASFLAGS += -DMOCK
endif
RESBITMAPS = $(foreach b,$(BITMAPS),$(RESOBJ)/$(basename $b).bitmap.bin)
RESICONS = $(foreach i,$(ICONS),$(RESOBJ)/$(basename $i).icon.bin)
_SRCS = $(foreach s,$(SRCS),$(SRCDIR)/$s)
RES = $(RESBITMAPS) $(RESICONS)
OBJS = $(foreach s,$(_SRCS),$(OBJDIR)/$(basename $(notdir $s)).o)
all: $(RES) $(PRG) $(PRG).$(IMGTYPE)
bootdisks: boot64.$(IMGTYPE) boot128.$(IMGTYPE)
$(PRG): $(PRG).cvt
clean:
rm -rf $(OBJDIR) $(PRG).{d64,d71,d81,cvt,dbg,lbl,map}
zap: clean
rm -rf $(DEPDIR)
$(PRG).$(IMGTYPE): $(PRG).cvt
c1541 -format $(PRG),11 $(IMGTYPE) $@
c1541 -attach $@ $(foreach f,$^,-geoswrite $f)
boot64.d64: $(PRG).cvt | GEOS64.D64
cp GEOS64.D64 $@
c1541 -attach $@ $(foreach f,$^,-geoswrite $f)
boot128.d64: $(PRG).cvt | GEOS128.D64
cp GEOS128.D64 $@
c1541 -attach $@ $(foreach f,$^,-geoswrite $f)
.PHONY: all bootdisks clean zap $(PRG)
.INTERMEDIATE: $(addprefix res/,$(addsuffix .pcx,$(basename $(filter-out .pcx,$(BITMAPS) $(ICONS)))))
$(PRG).cvt: $(OBJS)
%.cvt:
$(CC) $(LDFLAGS) -o $@ $+
$(OBJDIR)/%.s: $(SRCDIR)/%.grc | $(OBJDIR) $(DEPDIR)
grc65 -s $@ $<
$(OBJDIR)/%.o: $(SRCDIR)/%.s | $(OBJDIR) $(DEPDIR)
$(AS) $(ASFLAGS) -o $@ $<
$(OBJDIR)/%.o: $(SRCDIR)/%.c | $(OBJDIR) $(DEPDIR)
$(CC) $(CFLAGS) -c -o $@ $<
%.png: %.xcf
convert -flatten $< $@
# sp65 only understands .PCX images; use imagmagick to convert from .PNG
%.pcx: %.png
convert $< $@
$(RESBITMAPS): $(RESOBJ)/%.bitmap.bin: res/%.pcx | $(RESOBJ)
sp65 -r $< -c geos-bitmap -w $@
$(RESICONS): $(RESOBJ)/%.icon.bin: res/%.pcx | $(RESOBJ)
sp65 -r $< -c geos-icon -w $@
$(OBJDIR) $(RESOBJ) $(DEPDIR):
mkdir -p $@
-include dep/*.dep