megadrive_test2

view Makefile @ 4:72ab63f262bf

tiles
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 19 Jun 2017 08:02:51 +0300
parents ce1b05082ac4
children ea70f3da150f
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 def = -DGAMENAME=\"testgame\" -DVERSTR=\"01\" -D__NO_CTYPE
13 inc = -Isrc -Isrc/libc
15 tool_prefix = m68k-linux-gnu-
17 CC = $(tool_prefix)gcc
18 AS = $(tool_prefix)as
19 LD = $(tool_prefix)ld
20 OBJCOPY = $(tool_prefix)objcopy
22 CFLAGS = -m68000 -ffreestanding -fno-builtin $(warn) $(dbg) $(opt) $(def) $(inc)
23 CPPFLAGS = $(def)
24 ASFLAGS = -m68000 $(inc)
25 LDFLAGS = -T megadrive.ldscript -print-gc-sections \
26 -L/usr/lib/gcc-cross/m68k-linux-gnu/6 -lgcc
28 $(bin): $(elf)
29 $(OBJCOPY) -O binary $< $@
31 $(elf): $(obj)
32 $(LD) -o $@ $(obj) -Map link.map $(LDFLAGS)
34 .PHONY: clean
35 clean:
36 rm -f $(obj) $(elf) $(bin)
38 .PHONY: run
39 run: $(bin)
40 gens-sdl $<
42 .PHONY: copy
43 copy: $(bin)
44 mount /media/usbmass && cp $(bin) /media/usbmass/$(bin)
45 umount /media/usbmass
47 .PHONY: install
48 install: $(bin)
49 mount /media/usbmass
50 [ -f /media/usbmass/MEGA/MEGA.RBF ] || cp $(bin) /media/usbmass/MEGA/MEGA.BIN
51 umount /media/usbmass