megadrive_test2

view Makefile @ 11:302bcd73edc4

added 6button support
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 24 Jun 2017 03:47:37 +0300
parents ea70f3da150f
children
line source
1 csrc = $(wildcard src/*.c) $(wildcard src/libc/*.c)
2 asrc = $(wildcard src/*.s)
3 aSsrc = $(wildcard src/*.S)
4 obj = $(asrc:.s=.o) $(aSsrc:.S=.o) $(csrc:.c=.o)
5 dep = $(csrc:.c=.d)
7 name = test2
8 elf = $(name).elf
9 bin = $(name).bin
11 warn = -pedantic -Wall
12 dbg = -g
13 opt = -O2
14 def = -DGAMENAME=\"testgame\" -DVERSTR=\"01\" -D__NO_CTYPE
15 inc = -I. -Isrc -Isrc/libc
17 tool_prefix = m68k-linux-gnu-
19 CC = $(tool_prefix)gcc
20 AS = $(tool_prefix)as
21 LD = $(tool_prefix)ld
22 OBJCOPY = $(tool_prefix)objcopy
24 CFLAGS = -m68000 -ffreestanding -fno-builtin $(warn) $(dbg) $(opt) $(def) $(inc)
25 CPPFLAGS = $(def)
26 ASFLAGS = -m68000 $(inc)
27 LDFLAGS = -T megadrive.ldscript -print-gc-sections \
28 -L/usr/lib/gcc-cross/m68k-linux-gnu/6 -lgcc
30 $(bin): $(elf)
31 $(OBJCOPY) -O binary $< $@
33 $(elf): tun_data.h $(obj)
34 $(LD) -o $@ $(obj) -Map link.map $(LDFLAGS)
36 tun_data.h: tunnel.ppm
37 cat $< | tools/ppm2md tun_ >$@
39 tunnel.ppm:
40 tools/tunnel >$@
42 -include $(dep)
44 %.d: %.c
45 @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
47 .PHONY: clean
48 clean:
49 rm -f $(obj) $(elf) $(bin) tun_data.h tunnel.ppm
51 .PHONY: cleandep
52 cleandep:
53 rm -f $(dep)
55 .PHONY: run
56 run: $(bin)
57 gens-sdl $<
59 .PHONY: copy
60 copy: $(bin)
61 mount /media/usbmass && cp $(bin) /media/usbmass/$(bin)
62 umount /media/usbmass
64 .PHONY: install
65 install: $(bin)
66 mount /media/usbmass
67 [ -f /media/usbmass/MEGA/MEGA.RBF ] || cp $(bin) /media/usbmass/MEGA/MEGA.BIN
68 umount /media/usbmass