2012-02-03 06:08:17 -05:00
|
|
|
# Mico32 toolchain
|
|
|
|
#
|
|
|
|
CROSS_COMPILER=lm32-rtems4.11-
|
2012-02-07 06:52:34 -05:00
|
|
|
CLANG=clang -ccc-host-triple mico32-generic-generic -ccc-gcc-name $(CROSS_COMPILER)gcc
|
2012-02-03 06:08:17 -05:00
|
|
|
|
2012-02-07 06:52:34 -05:00
|
|
|
CC_normal := $(CLANG)
|
2012-02-03 06:08:17 -05:00
|
|
|
AR_normal := $(CROSS_COMPILER)ar
|
|
|
|
AS_normal := $(CROSS_COMPILER)as
|
|
|
|
LD_normal := $(CROSS_COMPILER)ld
|
|
|
|
OBJCOPY_normal := $(CROSS_COMPILER)objcopy
|
2012-02-03 06:25:55 -05:00
|
|
|
RANLIB_normal := $(CROSS_COMPILER)ranlib
|
2012-02-03 06:08:17 -05:00
|
|
|
|
2012-02-07 06:52:34 -05:00
|
|
|
CC_quiet = @echo " CC " $@ && $(CLANG)
|
2012-02-03 06:08:17 -05:00
|
|
|
AR_quiet = @echo " AR " $@ && $(CROSS_COMPILER)ar
|
|
|
|
AS_quiet = @echo " AS " $@ && $(CROSS_COMPILER)as
|
|
|
|
LD_quiet = @echo " LD " $@ && $(CROSS_COMPILER)ld
|
|
|
|
OBJCOPY_quiet = @echo " OBJCOPY " $@ && $(CROSS_COMPILER)objcopy
|
2012-02-03 06:25:55 -05:00
|
|
|
RANLIB_quiet = @echo " RANLIB " $@ && $(CROSS_COMPILER)ranlib
|
2012-02-03 06:08:17 -05:00
|
|
|
|
|
|
|
ifeq ($(V),1)
|
|
|
|
CC = $(CC_normal)
|
|
|
|
AR = $(AR_normal)
|
|
|
|
AS = $(AS_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)
|
|
|
|
AS = $(AS_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
|
|
|
|
ASFLAGS = -nostdinc $(INCLUDES)
|
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-25 16:29:15 -04:00
|
|
|
%.o: $(SRCDIR)%.c
|
|
|
|
$(CC) -c $(CFLAGS) $(SRCDIR)$*.c -o $*.o
|
|
|
|
@$(CC_normal) -MM $(CFLAGS) $(SRCDIR)$*.c > $*.d
|
2012-02-03 06:25:55 -05:00
|
|
|
@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
|