+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
$(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