mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
57 lines
2.1 KiB
Makefile
57 lines
2.1 KiB
Makefile
|
ifeq (, $(NEWLIB_BASE))
|
||
|
NEWLIB_BASE := $(RIOTBASE)/toolchain/x86/i586-none-elf
|
||
|
|
||
|
ifneq (0, $(shell test -e "$(NEWLIB_BASE)/lib/libc.a" && echo $$?))
|
||
|
NEWLIB_PRECOMPILED_NAME := i586-newlib_2.1.0_tlsf.txz
|
||
|
NEWLIB_PRECOMPILED := http://download.riot-os.org/$(NEWLIB_PRECOMPILED_NAME)
|
||
|
|
||
|
$(warning "Precompiled newlib is missing in $(NEWLIB_BASE)")
|
||
|
$(warning "Downloading from $(NEWLIB_PRECOMPILED)")
|
||
|
|
||
|
$(shell cd $(RIOTBASE) && wget -qO- "$(NEWLIB_PRECOMPILED)" | tar xJ)
|
||
|
endif
|
||
|
endif
|
||
|
|
||
|
ifeq (,$(BUILD_INCLUDE_BASE))
|
||
|
GCC_BUILD_TRIPLET ?= $(shell gcc -dumpmachine)
|
||
|
GCC_BUILD_VERSION ?= $(shell gcc -dumpversion)
|
||
|
BUILD_INCLUDE_BASE = /usr/lib/gcc/$(GCC_BUILD_TRIPLET)/$(GCC_BUILD_VERSION)
|
||
|
|
||
|
ifeq (,$(shell echo $(GCC_BUILD_TRIPLET) | sed -e 's,-.*,,' | grep -e '\(x\|i[3-7]\)86'))
|
||
|
$(warning Your build machine is a(n) $(GCC_BUILD_TRIPLET).)
|
||
|
$(warning Since this is not IA32 compatible, you must set BUILD_INCLUDE_BASE explicitly!)
|
||
|
endif
|
||
|
endif
|
||
|
|
||
|
export INCLUDES += -isystem $(BUILD_INCLUDE_BASE)/include \
|
||
|
-isystem $(NEWLIB_BASE)/include \
|
||
|
-isystem $(NEWLIB_BASE)/sys-include \
|
||
|
-isystem $(BUILD_INCLUDE_BASE)/include-fixed \
|
||
|
-I$(RIOTBOARD)/x86-multiboot-common/include
|
||
|
export CPU = x86
|
||
|
|
||
|
# toolchain config
|
||
|
export CC ?= $(PREFIX)gcc
|
||
|
export AR ?= $(PREFIX)ar
|
||
|
export AS ?= $(PREFIX)as
|
||
|
export RANLIB ?= $(PREFIX)ranlib
|
||
|
export LINK ?= $(RIOTBASE)/boards/x86-multiboot-common/dist/link $(PREFIX)gcc
|
||
|
export SIZE ?= $(PREFIX)size
|
||
|
export OBJCOPY ?= $(PREFIX)objcopy
|
||
|
|
||
|
export CFLAGS += -m32 -mfpmath=387 -ffreestanding -nostdlib -nostdinc -fno-builtin
|
||
|
export OFLAGS = -O binary
|
||
|
|
||
|
LINKFLAGS += -m32 -nostdlib -nostdinc -nostartfiles -nodefaultlibs \
|
||
|
--prefix=$(NEWLIB_BASE) \
|
||
|
-Wl,-rpath,$(NEWLIB_BASE)/lib \
|
||
|
-T $(RIOTBASE)/boards/x86-multiboot-common/linker.ld
|
||
|
UNDEF += $(BINDIR)x86-multiboot-common_base/startup.o
|
||
|
|
||
|
#CFLAGS += -ffunction-sections -fdata-sections
|
||
|
#LINKFLAGS += -Wl,--gc-sections
|
||
|
#CFLAGS += -Wall -Wextra -Werror -pedantic -pedantic-errors \
|
||
|
|
||
|
BASELIBS += $(NEWLIB_BASE)/lib/libc.a \
|
||
|
$(NEWLIB_BASE)/lib/libm.a
|