#########################################################################
|
#########################################################################
|
|
|
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
|
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
|
else if [ -x /bin/bash ]; then echo /bin/bash; \
|
else if [ -x /bin/bash ]; then echo /bin/bash; \
|
else echo sh; fi ; fi)
|
else echo sh; fi ; fi)
|
|
|
HOSTCC = cc
|
HOSTCC = cc
|
HOSTCFLAGS = -Wall -Wstrict-prototypes -fno-omit-frame-pointer
|
HOSTCFLAGS = -Wall -Wstrict-prototypes -fno-omit-frame-pointer
|
|
|
|
|
#########################################################################
|
#########################################################################
|
|
|
#
|
#
|
# Include the make variables (CC, etc...)
|
# Include the make variables (CC, etc...)
|
#
|
#
|
AS = $(CROSS_COMPILE)as
|
AS = $(CROSS_COMPILE)as
|
LD = $(CROSS_COMPILE)ld
|
LD = $(CROSS_COMPILE)ld
|
CC = $(CROSS_COMPILE)gcc
|
CC = $(CROSS_COMPILE)gcc
|
AR = $(CROSS_COMPILE)ar
|
AR = $(CROSS_COMPILE)ar
|
NM = $(CROSS_COMPILE)nm
|
NM = $(CROSS_COMPILE)nm
|
STRIP = $(CROSS_COMPILE)strip
|
STRIP = $(CROSS_COMPILE)strip
|
OBJCOPY = $(CROSS_COMPILE)objcopy
|
OBJCOPY = $(CROSS_COMPILE)objcopy
|
OBJDUMP = $(CROSS_COMPILE)objdump
|
OBJDUMP = $(CROSS_COMPILE)objdump
|
RANLIB = $(CROSS_COMPILE)ranlib
|
RANLIB = $(CROSS_COMPILE)ranlib
|
|
|
XCFLAGS += -I$(TOPDIR)/include -DOR1K -Wall -Wstrict-prototypes
|
XCFLAGS += -I$(TOPDIR)/include -DOR1K -Wall -Wstrict-prototypes
|
XCFLAGS += -Werror-implicit-function-declaration
|
XCFLAGS += -Werror-implicit-function-declaration
|
#XCFLAGS += -fno-omit-frame-pointer
|
XCFLAGS += -fno-omit-frame-pointer
|
XCFLAGS += -fomit-frame-pointer
|
#XCFLAGS += -fomit-frame-pointer
|
#XCFLAGS += -O0
|
#XCFLAGS += -O0
|
#XCFLAGS += -O2
|
#XCFLAGS += -O2
|
XCFLAGS += -O3
|
XCFLAGS += -O3
|
#XCFLAGS += -Os
|
#XCFLAGS += -Os
|
XCFLAGS += -fno-strength-reduce -pipe -fno-builtin
|
XCFLAGS += -fno-strength-reduce -pipe -fno-builtin
|
# Use all software flags, so is compatible with minimal implementation
|
# Use all software flags, so is compatible with minimal implementation
|
XCFLAGS += -mhard-mul -mhard-div -msoft-float
|
XCFLAGS += -mhard-mul -mhard-div -msoft-float
|
#XCFLAGS += -mhard-mul -msoft-div -msoft-float
|
#XCFLAGS += -mhard-mul -msoft-div -msoft-float
|
#XCFLAGS += -msoft-mul -msoft-div -msoft-float
|
#XCFLAGS += -msoft-mul -msoft-div -msoft-float
|
# We require this as we we won't rely on any existing C library code
|
# We require this as we we won't rely on any existing C library code
|
XCFLAGS += -nostdlib
|
XCFLAGS += -nostdlib
|
#XCFLAGS += -DDEBUG
|
#XCFLAGS += -DDEBUG
|
|
|
# For CoreMark:
|
# For CoreMark:
|
FLAGS_STR ="$(XCFLAGS)"
|
FLAGS_STR ="$(XCFLAGS)"
|
# Add back to CFLAGS
|
# Add back to CFLAGS
|
CFLAGS += $(XCFLAGS) -DFLAGS_STR=\"$(FLAGS_STR)\"
|
CFLAGS += $(XCFLAGS) -DFLAGS_STR=\"$(FLAGS_STR)\"
|
|
|
LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
|
LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
|
LDFLAGS+= $(LIBGCC)
|
LDFLAGS+= $(LIBGCC)
|
|
|
#########################################################################
|
#########################################################################
|
|
|
export CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE \
|
export CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE \
|
AS LD CC AR NM STRIP OBJCOPY OBJDUMP \
|
AS LD CC AR NM STRIP OBJCOPY OBJDUMP \
|
MAKE CFLAGS ASFLAGS
|
MAKE CFLAGS ASFLAGS
|
|
|
#########################################################################
|
#########################################################################
|
|
|
%.o: %.S
|
%.o: %.S
|
$(CC) $(CFLAGS) -c -o $@ $(CURDIR)/$<
|
$(CC) $(CFLAGS) -c -o $@ $(CURDIR)/$<
|
%.o: %.c
|
%.o: %.c
|
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
%.bin: %.or32
|
%.bin: %.or32
|
or32-rtems-objcopy -O binary $< $@
|
or32-rtems-objcopy -O binary $< $@
|
|
|
%.img: %.bin
|
%.img: %.bin
|
utils/bin2flimg 1 $< > $@
|
utils/bin2flimg 1 $< > $@
|
|
|
%.srec: %.bin
|
%.srec: %.bin
|
utils/bin2srec $< > $@
|
utils/bin2srec $< > $@
|
|
|
#########################################################################
|
#########################################################################
|
|
|