-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.amiga
74 lines (54 loc) · 1.49 KB
/
Makefile.amiga
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
src = $(wildcard src/*.c) \
$(wildcard src/amiga/*.c) \
$(wildcard src/amiga/libc/*.c)
asrc = $(wildcard src/*.s) \
$(wildcard src/amiga/*.s) \
$(wildcard src/amiga/libc/*.s)
obj = $(src:.c=.o) $(asrc:.s=.o)
dep = $(src:.c=.d)
data = data/titlescreen.bpl data/titlescreen.pal
name = lugburz
elf = $(name).elf
bin = $(name).bin
adf = $(name).adf
bootblock = boot.bin
tool_prefix = m68k-elf-
CC = $(tool_prefix)gcc
AS = $(tool_prefix)as
LD = $(tool_prefix)gcc
OBJCOPY = $(tool_prefix)objcopy
inc = -Isrc -Isrc/amiga -Isrc/amiga/libc
ASFLAGS = -m68000 $(inc)
CFLAGS = -m68000 -ffreestanding -nostdinc -fno-builtin -pedantic -Wall -Os $(inc)
LDFLAGS = -m68000 -T amiga.ld -Wl,-print-gc-sections -Wl,-Map,link.map -ffreestanding \
-nostdlib -lgcc
$(adf): $(bin) $(bootblock)
tools/mk_adf.py $(bootblock) $(bin) $@
$(bin): $(elf)
$(OBJCOPY) -O binary $< $@
$(elf): $(obj)
$(LD) -o $@ $(obj) $(LDFLAGS)
$(bootblock): src/amiga/boot/boot.o
$(OBJCOPY) -O binary $< $@
src/amiga/data.o: src/amiga/data.s $(data)
-include $(dep)
%.d: %.c
@$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
.PHONY: clean
clean:
rm -f $(obj) src/amiga/boot/boot.o $(bin) $(elf)
.PHONY: cleandep
cleandep:
rm -f $(dep)
.PHONY: run
run:
fs-uae
disasm: $(elf)
$(tool_prefix)objdump -d $< >$@
tools/png2bpl/png2bpl: tools/png2bpl/main.c
$(MAKE) -C tools/png2bpl
# datafiles rules
%.bpl: %.png tools/png2bpl/png2bpl
tools/png2bpl/png2bpl $< >$@
%.pal: %.png tools/png2bpl/png2bpl
tools/png2bpl/png2bpl -c $< >$@