megadrive_test2

annotate Makefile @ 3:b22bc95f0cc0

added vim modelines
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 14 Mar 2017 09:11:18 +0200
parents ce1b05082ac4
children ea70f3da150f
rev   line source
nuclear@0 1 csrc = $(wildcard src/*.c) $(wildcard src/libc/*.c)
nuclear@0 2 asrc = $(wildcard src/*.s)
nuclear@0 3 aSsrc = $(wildcard src/*.S)
nuclear@0 4 obj = $(asrc:.s=.o) $(aSsrc:.S=.o) $(csrc:.c=.o)
nuclear@0 5
nuclear@0 6 name = test2
nuclear@0 7 elf = $(name).elf
nuclear@0 8 bin = $(name).bin
nuclear@0 9
nuclear@0 10 warn = -pedantic -Wall
nuclear@0 11 dbg = -g
nuclear@0 12 def = -DGAMENAME=\"testgame\" -DVERSTR=\"01\" -D__NO_CTYPE
nuclear@1 13 inc = -Isrc -Isrc/libc
nuclear@0 14
nuclear@0 15 tool_prefix = m68k-linux-gnu-
nuclear@0 16
nuclear@0 17 CC = $(tool_prefix)gcc
nuclear@0 18 AS = $(tool_prefix)as
nuclear@0 19 LD = $(tool_prefix)ld
nuclear@0 20 OBJCOPY = $(tool_prefix)objcopy
nuclear@0 21
nuclear@0 22 CFLAGS = -m68000 -ffreestanding -fno-builtin $(warn) $(dbg) $(opt) $(def) $(inc)
nuclear@0 23 CPPFLAGS = $(def)
nuclear@1 24 ASFLAGS = -m68000 $(inc)
nuclear@0 25 LDFLAGS = -T megadrive.ldscript -print-gc-sections \
nuclear@0 26 -L/usr/lib/gcc-cross/m68k-linux-gnu/6 -lgcc
nuclear@0 27
nuclear@0 28 $(bin): $(elf)
nuclear@0 29 $(OBJCOPY) -O binary $< $@
nuclear@0 30
nuclear@0 31 $(elf): $(obj)
nuclear@0 32 $(LD) -o $@ $(obj) -Map link.map $(LDFLAGS)
nuclear@0 33
nuclear@0 34 .PHONY: clean
nuclear@0 35 clean:
nuclear@0 36 rm -f $(obj) $(elf) $(bin)
nuclear@0 37
nuclear@0 38 .PHONY: run
nuclear@0 39 run: $(bin)
nuclear@0 40 gens-sdl $<
nuclear@0 41
nuclear@0 42 .PHONY: copy
nuclear@0 43 copy: $(bin)
nuclear@0 44 mount /media/usbmass && cp $(bin) /media/usbmass/$(bin)
nuclear@0 45 umount /media/usbmass
nuclear@0 46
nuclear@0 47 .PHONY: install
nuclear@0 48 install: $(bin)
nuclear@0 49 mount /media/usbmass
nuclear@0 50 [ -f /media/usbmass/MEGA/MEGA.RBF ] || cp $(bin) /media/usbmass/MEGA/MEGA.BIN
nuclear@0 51 umount /media/usbmass