From c5c29199be027bbeb948ab6e620bc2474b1f22c7 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 10 Jan 2013 17:20:31 +0100 Subject: [PATCH] software: run the assembler ourselves to prevent future time wastage due to breakage of our custom Clang toolchain --- software/bios/Makefile | 3 +++ software/common.mak | 33 +++++++++++++++++++++------------ software/libbase/Makefile | 3 +++ 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/software/bios/Makefile b/software/bios/Makefile index 827fe207..0e2fa364 100644 --- a/software/bios/Makefile +++ b/software/bios/Makefile @@ -27,6 +27,9 @@ bios-rescue.elf: linker-rescue.ld $(OBJECTS) libs %.o: %.c $(compile-dep) +%.o: %.S + $(assemble) + libs: make -C $(M2DIR)/software/libbase diff --git a/software/common.mak b/software/common.mak index 498714be..76ea448a 100644 --- a/software/common.mak +++ b/software/common.mak @@ -2,29 +2,33 @@ TARGET_PREFIX=lm32-elf CLANG=clang -target lm32 CC_normal := $(CLANG) +AS_normal := $(TARGET_PREFIX)-as AR_normal := $(TARGET_PREFIX)-ar LD_normal := $(TARGET_PREFIX)-ld OBJCOPY_normal := $(TARGET_PREFIX)-objcopy RANLIB_normal := $(TARGET_PREFIX)-ranlib CC_quiet = @echo " CC " $@ && $(CLANG) +AS_quiet = @echo " AS " $@ && $(TARGET_PREFIX)-as AR_quiet = @echo " AR " $@ && $(TARGET_PREFIX)-ar LD_quiet = @echo " LD " $@ && $(TARGET_PREFIX)-ld OBJCOPY_quiet = @echo " OBJCOPY " $@ && $(TARGET_PREFIX)-objcopy RANLIB_quiet = @echo " RANLIB " $@ && $(TARGET_PREFIX)-ranlib ifeq ($(V),1) - CC = $(CC_normal) - AR = $(AR_normal) - LD = $(LD_normal) - OBJCOPY = $(OBJCOPY_normal) - RANLIB = $(RANLIB_normal) + CC = $(CC_normal) + AS = $(AS_normal) + AR = $(AR_normal) + LD = $(LD_normal) + OBJCOPY = $(OBJCOPY_normal) + RANLIB = $(RANLIB_normal) else - CC = $(CC_quiet) - AR = $(AR_quiet) - LD = $(LD_quiet) - OBJCOPY = $(OBJCOPY_quiet) - RANLIB = $(RANLIB_quiet) + CC = $(CC_quiet) + AS = $(AS_quiet) + AR = $(AR_quiet) + LD = $(LD_quiet) + OBJCOPY = $(OBJCOPY_quiet) + RANLIB = $(RANLIB_quiet) endif # Toolchain options @@ -37,12 +41,17 @@ LDFLAGS = -nostdlib -nodefaultlibs # compile and generate dependencies, based on # http://scottmcpeak.com/autodepend/autodepend.html -define compile-dep = -$(CC) -c $(CFLAGS) $< -o $*.o +define compile-dep +$(CC) -c $(CFLAGS) $< -o $*.ts -S @$(CC_normal) -MM $(CFLAGS) $< > $*.d @mv -f $*.d $*.d.tmp @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \ sed -e 's/^ *//' -e 's/$$/:/' >> $*.d @rm -f $*.d.tmp +@$(AS_normal) -o $*.o $*.ts +endef + +define assemble +$(AS) -o $*.o $< endef diff --git a/software/libbase/Makefile b/software/libbase/Makefile index 4c37fadb..1d6436c3 100644 --- a/software/libbase/Makefile +++ b/software/libbase/Makefile @@ -15,6 +15,9 @@ libbase.a: $(OBJECTS) %.o: %.c $(compile-dep) +%.o: %.S + $(assemble) + .PHONY: clean clean: -- 2.30.2