fix clean target for example makefiles if the compiler is not in PATH

This commit is contained in:
Felix Ruess 2012-10-13 15:35:19 +02:00 committed by Piotr Esden-Tempski
parent 0c779512d6
commit b7ebe6e705
8 changed files with 37 additions and 9 deletions

View File

@ -26,7 +26,7 @@ SHAREDIR = $(DESTDIR)/$(PREFIX)/share/libopencm3/scripts
INSTALL = install INSTALL = install
SRCLIBDIR = $(shell pwd)/lib SRCLIBDIR = $(shell pwd)/lib
TARGETS = stm32/f1 stm32/f2 stm32/f4 lpc13xx lpc17xx lpc43xx lm3s TARGETS = stm32/f1 stm32/f2 stm32/f4 lpc13xx lpc17xx lpc43xx lm3s
# Be silent per default, but 'make V=1' will show all compiler calls. # Be silent per default, but 'make V=1' will show all compiler calls.
ifneq ($(V),1) ifneq ($(V),1)

View File

@ -24,14 +24,18 @@ CC = $(PREFIX)-gcc
LD = $(PREFIX)-gcc LD = $(PREFIX)-gcc
OBJCOPY = $(PREFIX)-objcopy OBJCOPY = $(PREFIX)-objcopy
OBJDUMP = $(PREFIX)-objdump OBJDUMP = $(PREFIX)-objdump
TOOLCHAIN_DIR ?= ../../../..
ifeq ($(wildcard ../../../../lib/libopencm3_lm3s.a),) ifeq ($(wildcard ../../../../lib/libopencm3_lm3s.a),)
ifneq ($(strip $(shell which $(CC))),)
TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX) TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX)
endif
else else
ifeq ($(V),1) ifeq ($(V),1)
$(info We seem to be building the example in the source directory. Using local library!) $(info We seem to be building the example in the source directory. Using local library!)
endif endif
TOOLCHAIN_DIR := ../../../..
endif endif
CFLAGS += -O0 -g3 -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \ CFLAGS += -O0 -g3 -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \
-mcpu=cortex-m3 -mthumb -MD -mcpu=cortex-m3 -mthumb -MD
LDSCRIPT ?= $(BINARY).ld LDSCRIPT ?= $(BINARY).ld

View File

@ -24,14 +24,18 @@ CC = $(PREFIX)-gcc
LD = $(PREFIX)-gcc LD = $(PREFIX)-gcc
OBJCOPY = $(PREFIX)-objcopy OBJCOPY = $(PREFIX)-objcopy
OBJDUMP = $(PREFIX)-objdump OBJDUMP = $(PREFIX)-objdump
TOOLCHAIN_DIR ?= ../../../..
ifeq ($(wildcard ../../../../lib/libopencm3_lpc13xx.a),) ifeq ($(wildcard ../../../../lib/libopencm3_lpc13xx.a),)
ifneq ($(strip $(shell which $(CC))),)
TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX) TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX)
endif
else else
ifeq ($(V),1) ifeq ($(V),1)
$(info We seem to be building the example in the source directory. Using local library!) $(info We seem to be building the example in the source directory. Using local library!)
endif endif
TOOLCHAIN_DIR := ../../../..
endif endif
CFLAGS += -Os -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \ CFLAGS += -Os -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \
-mcpu=cortex-m3 -mthumb -MD -mcpu=cortex-m3 -mthumb -MD
LDSCRIPT ?= $(BINARY).ld LDSCRIPT ?= $(BINARY).ld

View File

@ -24,14 +24,18 @@ CC = $(PREFIX)-gcc
LD = $(PREFIX)-gcc LD = $(PREFIX)-gcc
OBJCOPY = $(PREFIX)-objcopy OBJCOPY = $(PREFIX)-objcopy
OBJDUMP = $(PREFIX)-objdump OBJDUMP = $(PREFIX)-objdump
TOOLCHAIN_DIR ?= ../../../..
ifeq ($(wildcard ../../../../lib/libopencm3_lpc17xx.a),) ifeq ($(wildcard ../../../../lib/libopencm3_lpc17xx.a),)
ifneq ($(strip $(shell which $(CC))),)
TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX) TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX)
endif
else else
ifeq ($(V),1) ifeq ($(V),1)
$(info We seem to be building the example in the source directory. Using local library!) $(info We seem to be building the example in the source directory. Using local library!)
endif endif
TOOLCHAIN_DIR := ../../../..
endif endif
CFLAGS += -O0 -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \ CFLAGS += -O0 -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \
-mcpu=cortex-m3 -mthumb -MD -mcpu=cortex-m3 -mthumb -MD
LDSCRIPT ?= $(BINARY).ld LDSCRIPT ?= $(BINARY).ld

View File

@ -27,14 +27,18 @@ LD = $(PREFIX)-gcc
OBJCOPY = $(PREFIX)-objcopy OBJCOPY = $(PREFIX)-objcopy
OBJDUMP = $(PREFIX)-objdump OBJDUMP = $(PREFIX)-objdump
GDB = $(PREFIX)-gdb GDB = $(PREFIX)-gdb
TOOLCHAIN_DIR ?= ../../../..
ifeq ($(wildcard ../../../../lib/libopencm3_lpc43xx.a),) ifeq ($(wildcard ../../../../lib/libopencm3_lpc43xx.a),)
ifneq ($(strip $(shell which $(CC))),)
TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX) TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX)
endif
else else
ifeq ($(V),1) ifeq ($(V),1)
$(info We seem to be building the example in the source directory. Using local library!) $(info We seem to be building the example in the source directory. Using local library!)
endif endif
TOOLCHAIN_DIR := ../../../..
endif endif
CFLAGS += -O2 -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \ CFLAGS += -O2 -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include -fno-common \
-mcpu=cortex-m4 -mthumb -MD \ -mcpu=cortex-m4 -mthumb -MD \
-mfloat-abi=hard -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mfpu=fpv4-sp-d16

View File

@ -25,14 +25,18 @@ LD = $(PREFIX)-gcc
OBJCOPY = $(PREFIX)-objcopy OBJCOPY = $(PREFIX)-objcopy
OBJDUMP = $(PREFIX)-objdump OBJDUMP = $(PREFIX)-objdump
GDB = $(PREFIX)-gdb GDB = $(PREFIX)-gdb
TOOLCHAIN_DIR ?= ../../../../..
ifeq ($(wildcard ../../../../../lib/libopencm3_stm32f1.a),) ifeq ($(wildcard ../../../../../lib/libopencm3_stm32f1.a),)
ifneq ($(strip $(shell which $(CC))),)
TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX) TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX)
endif
else else
ifeq ($(V),1) ifeq ($(V),1)
$(info We seem to be building the example in the source directory. Using local library!) $(info We seem to be building the example in the source directory. Using local library!)
endif endif
TOOLCHAIN_DIR := ../../../../..
endif endif
ARCH_FLAGS = -mthumb -mcpu=cortex-m3 -msoft-float ARCH_FLAGS = -mthumb -mcpu=cortex-m3 -msoft-float
CFLAGS += -Os -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include \ CFLAGS += -Os -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include \
-fno-common $(ARCH_FLAGS) -MD -DSTM32F1 -fno-common $(ARCH_FLAGS) -MD -DSTM32F1

View File

@ -26,14 +26,18 @@ LD = $(PREFIX)-gcc
OBJCOPY = $(PREFIX)-objcopy OBJCOPY = $(PREFIX)-objcopy
OBJDUMP = $(PREFIX)-objdump OBJDUMP = $(PREFIX)-objdump
GDB = $(PREFIX)-gdb GDB = $(PREFIX)-gdb
TOOLCHAIN_DIR ?= ../../../../..
ifeq ($(wildcard ../../../../../lib/libopencm3_stm32f2.a),) ifeq ($(wildcard ../../../../../lib/libopencm3_stm32f2.a),)
ifneq ($(strip $(shell which $(CC))),)
TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX) TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX)
endif
else else
ifeq ($(V),1) ifeq ($(V),1)
$(info We seem to be building the example in the source directory. Using local library!) $(info We seem to be building the example in the source directory. Using local library!)
endif endif
TOOLCHAIN_DIR := ../../../../..
endif endif
CFLAGS += -Os -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include \ CFLAGS += -Os -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include \
-fno-common -mcpu=cortex-m3 -mthumb -msoft-float -MD -DSTM32F2 -fno-common -mcpu=cortex-m3 -mthumb -msoft-float -MD -DSTM32F2
LDSCRIPT ?= $(BINARY).ld LDSCRIPT ?= $(BINARY).ld

View File

@ -27,14 +27,18 @@ OBJCOPY = $(PREFIX)-objcopy
OBJDUMP = $(PREFIX)-objdump OBJDUMP = $(PREFIX)-objdump
GDB = $(PREFIX)-gdb GDB = $(PREFIX)-gdb
FLASH = $(shell which st-flash) FLASH = $(shell which st-flash)
TOOLCHAIN_DIR ?= ../../../../..
ifeq ($(wildcard ../../../../../lib/libopencm3_stm32f4.a),) ifeq ($(wildcard ../../../../../lib/libopencm3_stm32f4.a),)
ifneq ($(strip $(shell which $(CC))),)
TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX) TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX)
endif
else else
ifeq ($(V),1) ifeq ($(V),1)
$(info We seem to be building the example in the source directory. Using local library!) $(info We seem to be building the example in the source directory. Using local library!)
endif endif
TOOLCHAIN_DIR := ../../../../..
endif endif
CFLAGS += -Os -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include \ CFLAGS += -Os -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include \
-fno-common -mcpu=cortex-m4 -mthumb \ -fno-common -mcpu=cortex-m4 -mthumb \
-mfloat-abi=hard -mfpu=fpv4-sp-d16 -MD -DSTM32F4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -MD -DSTM32F4