1 csrc = $(wildcard src/*.c) $(wildcard src/libc/*.c)
2 asrc = $(wildcard src/*.s) $(wildcard src/libc/*.s)
3 aSsrc = $(wildcard src/*.S) $(wildcard src/libc/*.S)
4 obj = $(asrc:.s=-asm.o) $(aSsrc:.S=-asm.o) $(csrc:.c=.o)
5 dep = $(csrc:.c=.d) $(aSsrc:.S=-asm.d)
7 z80src = $(wildcard src/z80/*.asm)
8 z80obj = $(z80src:.asm=.z80)
15 warn = -pedantic -Wall
19 inc = -I. -Isrc -Isrc/libc
26 OBJCOPY = $(TC)objcopy
27 OBJDUMP = $(TC)objdump
29 CFLAGS = -m68000 -ffreestanding -fno-builtin -fcommon $(warn) $(dbg) $(opt) $(def) $(inc) -MMD
31 ASFLAGS = -m68000 $(inc)
32 LDFLAGS = -T megadrive.ld -print-gc-sections
34 Z80AS = vasmz80_oldstyle
37 Z80LDFLAGS = -T z80.ld -b rawbin1
41 $(OBJCOPY) -O binary $< $@
44 $(LD) -o $@ $(obj) -Map link.map $(LDFLAGS)
47 $(Z80LD) -o $@ $(Z80LDFLAGS) $(z80obj)
52 src/data-asm.o: src/data.s data/font8x8.img data/cellspr.img
53 src/z80prog-asm.o: src/z80prog.s $(z80bin)
55 data/cellspr.img: data/cellspr.png
60 $(AS) -o $@ $(ASFLAGS) $<
63 $(CC) -o $@ $(ASFLAGS) -DASM -MMD -c $<
66 $(Z80AS) -o $@ $(Z80ASFLAGS) $< >/dev/null
70 rm -f $(obj) $(elf) $(bin)
71 rm -f $(z80obj) $(z80bin)
83 mount /media/usbmass && cp $(bin) /media/usbmass/$(bin)
89 [ -f /media/usbmass/MEGA/MEGA.RBF ] || cp $(bin) /media/usbmass/MEGA/MEGA.BIN
93 PNGDUMP = tools/pngdump/pngdump
95 $(PNGDUMP): tools/pngdump/main.c tools/pngdump/image.c tools/pngdump/quant.c
96 $(MAKE) -C tools/pngdump
98 %.img: %.png $(PNGDUMP)
99 $(PNGDUMP) -o $@ -oc $(@:.img=.cmap) -T 8x8 $<