megadrive_test1

annotate Makefile @ 7:8253942b0a1a

in the middle of something
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 19 Feb 2017 14:00:26 +0200
parents e7138066c7ea
children
rev   line source
nuclear@6 1 csrc = $(wildcard src/*.c) $(wildcard src/libc/*.c)
nuclear@0 2 asrc = $(wildcard src/*.s)
nuclear@0 3 aSsrc = $(wildcard src/*.S)
nuclear@4 4 obj = $(asrc:.s=.o) $(aSsrc:.S=.o) $(csrc:.c=.o)
nuclear@0 5
nuclear@0 6 name = test1
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@6 12 def = -DGAMENAME=\"testgame\" -DVERSTR=\"01\" -D__NO_CTYPE
nuclear@6 13 inc = -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@6 22 CFLAGS = -m68000 -ffreestanding -fno-builtin $(warn) $(dbg) $(opt) $(def) $(inc)
nuclear@1 23 CPPFLAGS = $(def)
nuclear@0 24 ASFLAGS = -m68000
nuclear@6 25 LDFLAGS = -T megadrive.ldscript -print-gc-sections \
nuclear@6 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@6 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@1 37
nuclear@1 38 .PHONY: run
nuclear@1 39 run: $(bin)
nuclear@1 40 gens-sdl $<