aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32/f2/Makefile.include
diff options
context:
space:
mode:
Diffstat (limited to 'examples/stm32/f2/Makefile.include')
-rw-r--r--examples/stm32/f2/Makefile.include11
1 files changed, 8 insertions, 3 deletions
diff --git a/examples/stm32/f2/Makefile.include b/examples/stm32/f2/Makefile.include
index f68da43..93f6ce6 100644
--- a/examples/stm32/f2/Makefile.include
+++ b/examples/stm32/f2/Makefile.include
@@ -26,9 +26,14 @@ LD = $(PREFIX)-gcc
OBJCOPY = $(PREFIX)-objcopy
OBJDUMP = $(PREFIX)-objdump
GDB = $(PREFIX)-gdb
-# Uncomment this line if you want to use the installed (not local) library.
-#TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX)
-TOOLCHAIN_DIR = ../../../../..
+ifeq ($(shell ls ../../../../../lib/libopencm3_stm32f2.a 2>/dev/null),)
+TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX)
+else
+ifeq ($(V),1)
+$(info We seem to be building the example in the source directory. Using local library!)
+endif
+TOOLCHAIN_DIR := ../../../../..
+endif
CFLAGS += -Os -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include \
-fno-common -mcpu=cortex-m3 -mthumb -msoft-float -MD -DSTM32F2
LDSCRIPT ?= $(BINARY).ld