allow to build multiple targets

This commit is contained in:
matthias.ringwald@gmail.com 2014-11-06 20:56:45 +00:00
parent ec6321ee39
commit d895277b5f
2 changed files with 13 additions and 13 deletions

View File

@ -3,7 +3,7 @@
#
# BINARY=led_counter
BINARY=spp_and_le_counter
# BINARY=spp_and_le_counter
OPENCM3_DIR = libopencm3
LDSCRIPT = stm32f1-nucleo.ld
@ -52,7 +52,7 @@ OBJS += $(CORE_OBJ) $(COMMON_OBJ) $(BLE_OBJ)
CFLAGS = -I. -I$(BTSTACK_ROOT)/include -I$(BTSTACK_ROOT)/src -I$(BTSTACK_ROOT)/ble -I$(BTSTACK_ROOT)/chipset-cc256x
examples: libopencm3/lib/libopencm3_stm32f1.a spp_and_le_counter.h $(BINARY).elf
examples: libopencm3/lib/libopencm3_stm32f1.a spp_and_le_counter.h spp_and_le_counter.elf
include libopencm3.stm32f1.mk

View File

@ -47,9 +47,9 @@ STYLECHECKFILES := $(shell find . -name '*.[ch]')
###############################################################################
# Source files
LDSCRIPT ?= $(BINARY).ld
# LDSCRIPT ?= $(BINARY).ld
OBJS += $(BINARY).o
# OBJS += $(BINARY).o
ifeq ($(strip $(OPENCM3_DIR)),)
@ -123,13 +123,13 @@ LDLIBS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group
.SECONDEXPANSION:
.SECONDARY:
all: elf
elf: $(BINARY).elf
bin: $(BINARY).bin
hex: $(BINARY).hex
srec: $(BINARY).srec
list: $(BINARY).list
# all: elf
#
# elf: $(BINARY).elf
# bin: $(BINARY).bin
# hex: $(BINARY).hex
# srec: $(BINARY).srec
# list: $(BINARY).list
images: $(BINARY).images
flash: $(BINARY).flash
@ -153,9 +153,9 @@ flash: $(BINARY).flash
@#printf " OBJDUMP $(*).list\n"
$(Q)$(OBJDUMP) -S $(*).elf > $(*).list
%.elf %.map: $(OBJS) $(LDSCRIPT) $(LIB_DIR)/lib$(LIBNAME).a
%.elf %.map: $(OBJS) %.o $(LDSCRIPT) $(LIB_DIR)/lib$(LIBNAME).a
@#printf " LD $(*).elf\n"
$(Q)$(LD) $(LDFLAGS) $(ARCH_FLAGS) $(OBJS) $(LDLIBS) -o $(*).elf
$(Q)$(LD) $(LDFLAGS) $(ARCH_FLAGS) $(OBJS) $(*).o $(LDLIBS) -o $(*).elf
%.o: %.c
@#printf " CC $(*).c\n"