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
27 OBJCOPY = $(TC)objcopy
28 OBJDUMP = $(TC)objdump
30 CFLAGS = -m68000 -ffreestanding -fno-builtin -fcommon $(warn) $(dbg) $(opt) $(def) $(inc) -MMD
32 ASFLAGS = -m68000 $(inc)
33 LDFLAGS = -T megadrive.ld -Wl,-print-gc-sections -nostdlib -lgcc
35 Z80AS = vasmz80_oldstyle
38 Z80LDFLAGS = -T z80.ld -b rawbin1
42 $(OBJCOPY) -O binary $< $@
45 $(CC) -o $@ $(obj) -Wl,-Map,link.map $(LDFLAGS)
48 $(Z80LD) -o $@ $(Z80LDFLAGS) $(z80obj)
53 src/data-asm.o: src/data.s data/font8x8.img data/cellspr.img
54 src/z80prog-asm.o: src/z80prog.s $(z80bin)
56 data/cellspr.img: data/cellspr.png
61 $(AS) -o $@ $(ASFLAGS) $<
64 $(CC) -o $@ $(ASFLAGS) -DASM -MMD -c $<
67 $(Z80AS) -o $@ $(Z80ASFLAGS) $< >/dev/null
71 rm -f $(obj) $(elf) $(bin)
72 rm -f $(z80obj) $(z80bin)
84 mount /media/usbmass && cp $(bin) /media/usbmass/$(bin)
90 [ -f /media/usbmass/MEGA/MEGA.RBF ] || cp $(bin) /media/usbmass/MEGA/MEGA.BIN
94 PNGDUMP = tools/pngdump/pngdump
96 $(PNGDUMP): tools/pngdump/main.c tools/pngdump/image.c tools/pngdump/quant.c
97 $(MAKE) -C tools/pngdump
99 %.img: %.png $(PNGDUMP)
100 $(PNGDUMP) -o $@ -oc $(@:.img=.cmap) -T 8x8 $<