2012-05-31 14:17:02 -04:00
|
|
|
TARGET_PREFIX=lm32-elf
|
2013-01-10 11:13:33 -05:00
|
|
|
CLANG=clang -target lm32
|
2012-02-03 06:08:17 -05:00
|
|
|
|
2012-02-07 06:52:34 -05:00
|
|
|
CC_normal := $(CLANG)
|
2012-05-31 14:17:02 -04:00
|
|
|
AR_normal := $(TARGET_PREFIX)-ar
|
|
|
|
LD_normal := $(TARGET_PREFIX)-ld
|
|
|
|
OBJCOPY_normal := $(TARGET_PREFIX)-objcopy
|
|
|
|
RANLIB_normal := $(TARGET_PREFIX)-ranlib
|
2012-02-03 06:08:17 -05:00
|
|
|
|
2012-02-07 06:52:34 -05:00
|
|
|
CC_quiet = @echo " CC " $@ && $(CLANG)
|
2012-05-31 14:17:02 -04:00
|
|
|
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
|
2012-02-03 06:08:17 -05:00
|
|
|
|
|
|
|
ifeq ($(V),1)
|
|
|
|
CC = $(CC_normal)
|
|
|
|
AR = $(AR_normal)
|
|
|
|
LD = $(LD_normal)
|
|
|
|
OBJCOPY = $(OBJCOPY_normal)
|
2012-02-03 06:25:55 -05:00
|
|
|
RANLIB = $(RANLIB_normal)
|
2012-02-03 06:08:17 -05:00
|
|
|
else
|
|
|
|
CC = $(CC_quiet)
|
|
|
|
AR = $(AR_quiet)
|
|
|
|
LD = $(LD_quiet)
|
|
|
|
OBJCOPY = $(OBJCOPY_quiet)
|
2012-02-03 06:25:55 -05:00
|
|
|
RANLIB = $(RANLIB_quiet)
|
2012-02-03 06:08:17 -05:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Toolchain options
|
|
|
|
#
|
2012-05-25 11:20:04 -04:00
|
|
|
INCLUDES = -I$(M2DIR)/software/include/base -I$(M2DIR)/software/include -I$(M2DIR)/common
|
2012-02-03 06:08:17 -05:00
|
|
|
CFLAGS = -O9 -Wall -Wstrict-prototypes -Wold-style-definition -Wshadow \
|
2012-05-25 11:20:04 -04:00
|
|
|
-Wmissing-prototypes -fsigned-char -nostdinc $(INCLUDES)
|
2012-02-03 06:08:17 -05:00
|
|
|
LDFLAGS = -nostdlib -nodefaultlibs
|
2012-02-03 06:25:55 -05:00
|
|
|
|
|
|
|
# compile and generate dependencies, based on
|
|
|
|
# http://scottmcpeak.com/autodepend/autodepend.html
|
|
|
|
|
2012-05-31 14:17:33 -04:00
|
|
|
define compile-dep =
|
|
|
|
$(CC) -c $(CFLAGS) $< -o $*.o
|
|
|
|
@$(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
|
|
|
|
endef
|