megadrive_test2

annotate 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
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@5 12 opt = -O2
nuclear@0 13 def = -DGAMENAME=\"testgame\" -DVERSTR=\"01\" -D__NO_CTYPE
nuclear@5 14 inc = -I. -Isrc -Isrc/libc
nuclear@0 15
nuclear@0 16 tool_prefix = m68k-linux-gnu-
nuclear@0 17
nuclear@0 18 CC = $(tool_prefix)gcc
nuclear@0 19 AS = $(tool_prefix)as
nuclear@0 20 LD = $(tool_prefix)ld
nuclear@0 21 OBJCOPY = $(tool_prefix)objcopy
nuclear@0 22
nuclear@0 23 CFLAGS = -m68000 -ffreestanding -fno-builtin $(warn) $(dbg) $(opt) $(def) $(inc)
nuclear@0 24 CPPFLAGS = $(def)
nuclear@1 25 ASFLAGS = -m68000 $(inc)
nuclear@0 26 LDFLAGS = -T megadrive.ldscript -print-gc-sections \
nuclear@0 27 -L/usr/lib/gcc-cross/m68k-linux-gnu/6 -lgcc
nuclear@0 28
nuclear@0 29 $(bin): $(elf)
nuclear@0 30 $(OBJCOPY) -O binary $< $@
nuclear@0 31
nuclear@5 32 $(elf): tun_data.h $(obj)
nuclear@0 33 $(LD) -o $@ $(obj) -Map link.map $(LDFLAGS)
nuclear@0 34
nuclear@5 35 tun_data.h: tunnel.ppm
nuclear@5 36 cat $< | tools/ppm2md tun_ >$@
nuclear@5 37
nuclear@5 38 tunnel.ppm:
nuclear@5 39 tools/tunnel >$@
nuclear@5 40
nuclear@0 41 .PHONY: clean
nuclear@0 42 clean:
nuclear@5 43 rm -f $(obj) $(elf) $(bin) tun_data.h tunnel.ppm
nuclear@0 44
nuclear@0 45 .PHONY: run
nuclear@0 46 run: $(bin)
nuclear@0 47 gens-sdl $<
nuclear@0 48
nuclear@0 49 .PHONY: copy
nuclear@0 50 copy: $(bin)
nuclear@0 51 mount /media/usbmass && cp $(bin) /media/usbmass/$(bin)
nuclear@0 52 umount /media/usbmass
nuclear@0 53
nuclear@0 54 .PHONY: install
nuclear@0 55 install: $(bin)
nuclear@0 56 mount /media/usbmass
nuclear@0 57 [ -f /media/usbmass/MEGA/MEGA.RBF ] || cp $(bin) /media/usbmass/MEGA/MEGA.BIN
nuclear@0 58 umount /media/usbmass