From 9b6b5ce5b01528c0e4e7e3ae138db693a2948840 Mon Sep 17 00:00:00 2001 From: Michael LeMay Date: Fri, 10 Jul 2015 14:07:07 -0700 Subject: [PATCH] galileo: Instruct developer to build C library prior to building Contiki This patch enhances build_newlib.sh to create Makefile.libc so that the main Galileo makefile can attempt to include Makefile.libc and instruct the developer to run build_newlib.sh first if the definition within Makefile.libc is not detected. --- platform/galileo/Makefile.galileo | 10 +++++++++- platform/galileo/bsp/libc/build_newlib.sh | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/platform/galileo/Makefile.galileo b/platform/galileo/Makefile.galileo index fcff32cdd..662042e56 100644 --- a/platform/galileo/Makefile.galileo +++ b/platform/galileo/Makefile.galileo @@ -1,4 +1,6 @@ -LIBC=$(CONTIKI)/platform/galileo/bsp/libc/i586-elf +BSP_PATH=$(CONTIKI)/platform/galileo/bsp +LIBC_PATH=$(BSP_PATH)/libc +LIBC=$(LIBC_PATH)/i586-elf LIBGCC_PATH = /usr/lib/gcc/$(shell gcc -dumpmachine)/$(shell gcc -dumpversion) CONTIKI_TARGET_DIRS = . core/sys/ @@ -11,6 +13,12 @@ include $(CONTIKI)/cpu/x86/Makefile.x86_quarkX1000 CFLAGS += -fno-stack-protector -nostdinc -isystem $(LIBC)/include -isystem $(LIBGCC_PATH)/include -isystem $(LIBGCC_PATH)/include-fixed LDFLAGS += -nostdlib +-include $(LIBC_PATH)/Makefile.libc + +ifndef BUILT_LIBC + $(error Build the C library by executing $(LIBC_PATH)/build_newlib.sh) +endif + # Ideally, this should be part of LDFLAGS (-lc -lm etc). However, we found out that archive # static files (.a) must be linked after our own object files, otherwise the linker gets lost # and we get undefined references only. diff --git a/platform/galileo/bsp/libc/build_newlib.sh b/platform/galileo/bsp/libc/build_newlib.sh index 8456c76c2..a48cb2e4c 100755 --- a/platform/galileo/bsp/libc/build_newlib.sh +++ b/platform/galileo/bsp/libc/build_newlib.sh @@ -85,6 +85,8 @@ build() { make -j${JOBS} all && make install cd .. + + echo "BUILT_LIBC = newlib" > Makefile.libc } setup() {