1 csrc = $(wildcard src/*.c) $(wildcard src/libc/*.c)
2 asrc = $(wildcard src/*.s)
3 aSsrc = $(wildcard src/*.S)
4 obj = $(asrc:.s=-asm.o) $(aSsrc:.S=-asm.o) $(csrc:.c=.o)
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
28 CFLAGS = -m68000 -ffreestanding -fno-builtin -fcommon $(warn) $(dbg) $(opt) $(def) $(inc) -MMD
30 ASFLAGS = -m68000 $(inc)
31 LDFLAGS = -T megadrive.ld -print-gc-sections \
32 -L/usr/lib/gcc-cross/m68k-linux-gnu/11 -lgcc
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)
49 src/data.o: src/data.s data/font8x8.img
50 src/z80prog-asm.o: src/z80prog.s $(z80bin)
55 $(AS) -o $@ $(ASFLAGS) $<
58 $(CC) -o $@ $(ASFLAGS) -c $<
61 $(Z80AS) -o $@ $(Z80ASFLAGS) $< >/dev/null
65 rm -f $(obj) $(elf) $(bin)
66 rm -f $(z80obj) $(z80bin)
78 mount /media/usbmass && cp $(bin) /media/usbmass/$(bin)
84 [ -f /media/usbmass/MEGA/MEGA.RBF ] || cp $(bin) /media/usbmass/MEGA/MEGA.BIN
88 PNGDUMP = tools/pngdump/pngdump
90 $(PNGDUMP): tools/pngdump/main.c tools/pngdump/image.c tools/pngdump/quant.c
91 $(MAKE) -C tools/pngdump
93 %.img: %.png $(PNGDUMP)
94 $(PNGDUMP) -o $@ -oc $(@:.img=.cmap) -T 8x8 $<