From 3efd9f86753adcd0cfed13d385d34a77b75917bf Mon Sep 17 00:00:00 2001 From: Onno Kortmann Date: Thu, 5 Dec 2013 21:31:38 -0800 Subject: [PATCH] Make the STM32 Makefile.includes usable from outside the examples tree The Makefile.includes contain a hardcoded ../../../../../libopencm3 path for the TOOLCHAIN_DIR variable. They also contained another copy of this hardcoded path, that is now generated from $TOOLCHAIN_DIR. This allows to have a symbolic link to a Makefile.include in an out-of-tree project and reuse the Makefile infrastructure. --- examples/stm32/f1/Makefile.include | 2 +- examples/stm32/f2/Makefile.include | 2 +- examples/stm32/f3/Makefile.include | 2 +- examples/stm32/f4/Makefile.include | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/stm32/f1/Makefile.include b/examples/stm32/f1/Makefile.include index 0b7af7b..919d918 100644 --- a/examples/stm32/f1/Makefile.include +++ b/examples/stm32/f1/Makefile.include @@ -27,7 +27,7 @@ OBJDUMP = $(PREFIX)-objdump GDB = $(PREFIX)-gdb TOOLCHAIN_DIR ?= ../../../../../libopencm3 -ifeq ($(wildcard ../../../../../libopencm3/lib/libopencm3_stm32f1.a),) +ifeq ($(wildcard $(TOOLCHAIN_DIR)/lib/libopencm3_stm32f1.a),) ifneq ($(strip $(shell which $(CC))),) TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX) endif diff --git a/examples/stm32/f2/Makefile.include b/examples/stm32/f2/Makefile.include index 209ab4b..e8ec423 100644 --- a/examples/stm32/f2/Makefile.include +++ b/examples/stm32/f2/Makefile.include @@ -28,7 +28,7 @@ OBJDUMP = $(PREFIX)-objdump GDB = $(PREFIX)-gdb TOOLCHAIN_DIR ?= ../../../../../libopencm3 -ifeq ($(wildcard ../../../../../libopencm3/lib/libopencm3_stm32f2.a),) +ifeq ($(wildcard $(TOOLCHAIN_DIR)/lib/libopencm3_stm32f2.a),) ifneq ($(strip $(shell which $(CC))),) TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX) endif diff --git a/examples/stm32/f3/Makefile.include b/examples/stm32/f3/Makefile.include index 6bfeead..d52af29 100644 --- a/examples/stm32/f3/Makefile.include +++ b/examples/stm32/f3/Makefile.include @@ -29,7 +29,7 @@ GDB = $(PREFIX)-gdb FLASH = $(shell which st-flash) TOOLCHAIN_DIR ?= ../../../../../libopencm3 -ifeq ($(wildcard ../../../../../libopencm3/lib/libopencm3_stm32f3.a),) +ifeq ($(wildcard $(TOOLCHAIN_DIR)/lib/libopencm3_stm32f3.a),) ifneq ($(strip $(shell which $(CC))),) TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX) endif diff --git a/examples/stm32/f4/Makefile.include b/examples/stm32/f4/Makefile.include index eebbeab..4d8bc2d 100644 --- a/examples/stm32/f4/Makefile.include +++ b/examples/stm32/f4/Makefile.include @@ -29,7 +29,7 @@ GDB = $(PREFIX)-gdb FLASH = $(shell which st-flash) TOOLCHAIN_DIR ?= ../../../../../libopencm3 -ifeq ($(wildcard ../../../../../libopencm3/lib/libopencm3_stm32f4.a),) +ifeq ($(wildcard $(TOOLCHAIN_DIR)/lib/libopencm3_stm32f4.a),) ifneq ($(strip $(shell which $(CC))),) TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX) endif