From b7ebe6e705b42030a4a6ff0002b7542464917e38 Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Sat, 13 Oct 2012 15:35:19 +0200 Subject: fix clean target for example makefiles if the compiler is not in PATH --- examples/lpc43xx/Makefile.include | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'examples/lpc43xx') diff --git a/examples/lpc43xx/Makefile.include b/examples/lpc43xx/Makefile.include index 4b1a092..15e523b 100644 --- a/examples/lpc43xx/Makefile.include +++ b/examples/lpc43xx/Makefile.include @@ -27,14 +27,18 @@ LD = $(PREFIX)-gcc OBJCOPY = $(PREFIX)-objcopy OBJDUMP = $(PREFIX)-objdump GDB = $(PREFIX)-gdb + +TOOLCHAIN_DIR ?= ../../../.. ifeq ($(wildcard ../../../../lib/libopencm3_lpc43xx.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 += -O2 -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \ -mcpu=cortex-m4 -mthumb -MD \ -mfloat-abi=hard -mfpu=fpv4-sp-d16 -- cgit v1.2.3