aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32/f4/Makefile.include
diff options
context:
space:
mode:
authorFelix Ruess2012-10-13 15:35:19 +0200
committerPiotr Esden-Tempski2012-10-16 14:09:42 -0700
commitb7ebe6e705b42030a4a6ff0002b7542464917e38 (patch)
tree43f551086052ffc221a83229fbe47a0e3496b289 /examples/stm32/f4/Makefile.include
parent0c779512d6db7fd513c8982059b869df0be29210 (diff)
fix clean target for example makefiles if the compiler is not in PATH
Diffstat (limited to 'examples/stm32/f4/Makefile.include')
-rw-r--r--examples/stm32/f4/Makefile.include6
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/stm32/f4/Makefile.include b/examples/stm32/f4/Makefile.include
index f436bc8..815f375 100644
--- a/examples/stm32/f4/Makefile.include
+++ b/examples/stm32/f4/Makefile.include
@@ -27,14 +27,18 @@ OBJCOPY = $(PREFIX)-objcopy
OBJDUMP = $(PREFIX)-objdump
GDB = $(PREFIX)-gdb
FLASH = $(shell which st-flash)
+
+TOOLCHAIN_DIR ?= ../../../../..
ifeq ($(wildcard ../../../../../lib/libopencm3_stm32f4.a),)
+ifneq ($(strip $(shell which $(CC))),)
TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX)
+endif
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-m4 -mthumb \
-mfloat-abi=hard -mfpu=fpv4-sp-d16 -MD -DSTM32F4