megadrive_test2

view Makefile @ 6:df2c6b3c6f2e

added NTSC/PAL detection
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 21 Jun 2017 06:32:10 +0300
parents 2560a8be8cb8
children 6ecf2f3ff05a
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)
6 name = test2
7 elf = $(name).elf
8 bin = $(name).bin
10 warn = -pedantic -Wall
11 dbg = -g
12 opt = -O2
13 def = -DGAMENAME=\"testgame\" -DVERSTR=\"01\" -D__NO_CTYPE
14 inc = -I. -Isrc -Isrc/libc
16 tool_prefix = m68k-linux-gnu-
18 CC = $(tool_prefix)gcc
19 AS = $(tool_prefix)as
20 LD = $(tool_prefix)ld
21 OBJCOPY = $(tool_prefix)objcopy
23 CFLAGS = -m68000 -ffreestanding -fno-builtin $(warn) $(dbg) $(opt) $(def) $(inc)
24 CPPFLAGS = $(def)
25 ASFLAGS = -m68000 $(inc)
26 LDFLAGS = -T megadrive.ldscript -print-gc-sections \
27 -L/usr/lib/gcc-cross/m68k-linux-gnu/6 -lgcc
29 $(bin): $(elf)
30 $(OBJCOPY) -O binary $< $@
32 $(elf): tun_data.h $(obj)
33 $(LD) -o $@ $(obj) -Map link.map $(LDFLAGS)
35 tun_data.h: tunnel.ppm
36 cat $< | tools/ppm2md tun_ >$@
38 tunnel.ppm:
39 tools/tunnel >$@
41 .PHONY: clean
42 clean:
43 rm -f $(obj) $(elf) $(bin) tun_data.h tunnel.ppm
45 .PHONY: run
46 run: $(bin)
47 gens-sdl $<
49 .PHONY: copy
50 copy: $(bin)
51 mount /media/usbmass && cp $(bin) /media/usbmass/$(bin)
52 umount /media/usbmass
54 .PHONY: install
55 install: $(bin)
56 mount /media/usbmass
57 [ -f /media/usbmass/MEGA/MEGA.RBF ] || cp $(bin) /media/usbmass/MEGA/MEGA.BIN
58 umount /media/usbmass