6809 util: Link utilities with libgcc
authorTormod Volden <debian.tormod@gmail.com>
Tue, 14 Apr 2015 21:23:14 +0000 (23:23 +0200)
committerAlan Cox <alan@linux.intel.com>
Wed, 15 Apr 2015 11:35:27 +0000 (12:35 +0100)
For example a number of math functions are needed.

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
Applications/util/Makefile.6809

index 628c419..a40e360 100644 (file)
@@ -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