megadrive_test2

diff Makefile @ 0:ce1b05082ac4

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 14 Mar 2017 05:59:33 +0200
parents
children 2560a8be8cb8
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Makefile	Tue Mar 14 05:59:33 2017 +0200
     1.3 @@ -0,0 +1,51 @@
     1.4 +csrc = $(wildcard src/*.c) $(wildcard src/libc/*.c)
     1.5 +asrc = $(wildcard src/*.s)
     1.6 +aSsrc = $(wildcard src/*.S)
     1.7 +obj = $(asrc:.s=.o) $(aSsrc:.S=.o) $(csrc:.c=.o)
     1.8 +
     1.9 +name = test2
    1.10 +elf = $(name).elf
    1.11 +bin = $(name).bin
    1.12 +
    1.13 +warn = -pedantic -Wall
    1.14 +dbg = -g
    1.15 +def = -DGAMENAME=\"testgame\" -DVERSTR=\"01\" -D__NO_CTYPE
    1.16 +inc = -Isrc/libc
    1.17 +
    1.18 +tool_prefix = m68k-linux-gnu-
    1.19 +
    1.20 +CC = $(tool_prefix)gcc
    1.21 +AS = $(tool_prefix)as
    1.22 +LD = $(tool_prefix)ld
    1.23 +OBJCOPY = $(tool_prefix)objcopy
    1.24 +
    1.25 +CFLAGS = -m68000 -ffreestanding -fno-builtin $(warn) $(dbg) $(opt) $(def) $(inc)
    1.26 +CPPFLAGS = $(def)
    1.27 +ASFLAGS = -m68000
    1.28 +LDFLAGS = -T megadrive.ldscript -print-gc-sections \
    1.29 +		  -L/usr/lib/gcc-cross/m68k-linux-gnu/6 -lgcc
    1.30 +
    1.31 +$(bin): $(elf)
    1.32 +	$(OBJCOPY) -O binary $< $@
    1.33 +
    1.34 +$(elf): $(obj)
    1.35 +	$(LD) -o $@ $(obj) -Map link.map $(LDFLAGS)
    1.36 +
    1.37 +.PHONY: clean
    1.38 +clean:
    1.39 +	rm -f $(obj) $(elf) $(bin)
    1.40 +
    1.41 +.PHONY: run
    1.42 +run: $(bin)
    1.43 +	gens-sdl $<
    1.44 +
    1.45 +.PHONY: copy
    1.46 +copy: $(bin)
    1.47 +	mount /media/usbmass && cp $(bin) /media/usbmass/$(bin)
    1.48 +	umount /media/usbmass
    1.49 +
    1.50 +.PHONY: install
    1.51 +install: $(bin)
    1.52 +	mount /media/usbmass
    1.53 +	[ -f /media/usbmass/MEGA/MEGA.RBF ] || cp $(bin) /media/usbmass/MEGA/MEGA.BIN
    1.54 +	umount /media/usbmass