From 9171ed8e943fc09311f44018e9fa2b7d11c20072 Mon Sep 17 00:00:00 2001 From: Tormod Volden Date: Tue, 14 Apr 2015 23:23:14 +0200 Subject: [PATCH] 6809 util: Link utilities with libgcc For example a number of math functions are needed. Signed-off-by: Tormod Volden --- Applications/util/Makefile.6809 | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Applications/util/Makefile.6809 b/Applications/util/Makefile.6809 index 628c4198..a40e360b 100644 --- a/Applications/util/Makefile.6809 +++ b/Applications/util/Makefile.6809 @@ -1,13 +1,16 @@ +PLATFORM = 6809 CC = m6809-unknown-gcc +# These are wrappers for lwasm and lwar ASM = m6809-unknown-as AR = m6809-unknown-ar -LINKER = m6809-unknown-ld +LINKER = lwlink CFLAGS = -Os -I../../Library/include -I../../Library/include/6502 -LDFLAGS = -L../../Library/libs -lc6809 -PLATFORM = 6809 - +LINKER_OPT = --format=raw -L../../Library/libs -lc6809 +LIBGCCDIR = $(dir $(shell $(CC) -print-libgcc-file-name)) +LINKER_OPT += -L$(LIBGCCDIR) -lgcc +LINKER_OPT += --script=$(TARGET).link ASM_OPT = -o -LINKER_OPT = --nostdlib --no-std-crt0 --script=$(TARGET).link +CRT0 = ../../Library/libs/crt0_6809.o .SUFFIXES: .c .o @@ -98,11 +101,10 @@ all: $(APPS) $(OBJS): $(SRCS) -#.c.o: -# $(CC) -c $< +$(APPS): $(CRT0) %: %.o - $(LINKER) -o $@ $(LDFLAGS) $< + $(LINKER) -o $@ $(LINKER_OPT) $(CRT0) $< clean: rm -f $(OBJS) $(APPS) $(SRCS:.c=) core *~ *.asm *.lst *.sym *.map *.noi *.lk *.ihx *.tmp *.bin -- 2.34.1