2012-06-10 04:40:07 +00:00
|
|
|
PROBE_HOST ?= native
|
|
|
|
PLATFORM_DIR = platforms/$(PROBE_HOST)
|
2015-03-02 18:16:33 +00:00
|
|
|
VPATH += platforms/common $(PLATFORM_DIR)
|
2011-02-04 07:23:52 +00:00
|
|
|
|
2015-03-07 18:32:52 +00:00
|
|
|
ifneq ($(V), 1)
|
|
|
|
MAKEFLAGS += --no-print-dir
|
|
|
|
Q := @
|
|
|
|
endif
|
|
|
|
|
2015-03-16 03:36:58 +00:00
|
|
|
OPT_FLAGS ?= -O2
|
|
|
|
|
|
|
|
CFLAGS += -Wall -Wextra -Werror -Wno-char-subscripts\
|
2015-04-04 04:02:01 +00:00
|
|
|
$(OPT_FLAGS) -std=gnu99 -g3 -MD \
|
2015-03-02 04:15:31 +00:00
|
|
|
-I. -Iinclude -Iplatforms/common -I$(PLATFORM_DIR) \
|
2011-02-04 07:23:52 +00:00
|
|
|
|
2012-11-03 08:33:28 +00:00
|
|
|
SRC = \
|
2011-02-04 07:23:52 +00:00
|
|
|
adiv5.c \
|
2012-11-03 08:33:28 +00:00
|
|
|
adiv5_jtagdp.c \
|
2011-02-04 07:23:52 +00:00
|
|
|
adiv5_swdp.c \
|
|
|
|
command.c \
|
2012-11-03 08:33:28 +00:00
|
|
|
cortexm.c \
|
|
|
|
crc32.c \
|
2015-03-01 04:50:10 +00:00
|
|
|
exception.c \
|
2012-11-03 08:33:28 +00:00
|
|
|
gdb_if.c \
|
|
|
|
gdb_main.c \
|
|
|
|
gdb_packet.c \
|
|
|
|
hex_utils.c \
|
2011-02-04 07:23:52 +00:00
|
|
|
jtag_scan.c \
|
2012-11-03 08:33:28 +00:00
|
|
|
jtagtap.c \
|
2011-02-04 07:23:52 +00:00
|
|
|
lmi.c \
|
2015-04-05 02:15:03 +00:00
|
|
|
lpc_common.c \
|
2013-06-17 04:06:03 +00:00
|
|
|
lpc11xx.c \
|
2012-11-03 08:33:28 +00:00
|
|
|
lpc43xx.c \
|
2015-01-06 09:26:00 +00:00
|
|
|
kinetis.c \
|
2012-11-03 08:33:28 +00:00
|
|
|
main.c \
|
2015-03-01 06:05:10 +00:00
|
|
|
morse.c \
|
2014-04-25 21:34:58 +00:00
|
|
|
nrf51.c \
|
2012-11-03 08:33:28 +00:00
|
|
|
platform.c \
|
|
|
|
sam3x.c \
|
2015-01-18 22:40:02 +00:00
|
|
|
samd.c \
|
2012-11-03 08:33:28 +00:00
|
|
|
stm32f1.c \
|
2011-11-12 06:15:52 +00:00
|
|
|
stm32f4.c \
|
2014-12-20 00:25:22 +00:00
|
|
|
stm32l0.c \
|
2012-11-03 08:33:28 +00:00
|
|
|
swdptap.c \
|
2012-06-24 04:53:13 +00:00
|
|
|
target.c \
|
2011-02-04 07:23:52 +00:00
|
|
|
|
2012-06-10 04:40:07 +00:00
|
|
|
include $(PLATFORM_DIR)/Makefile.inc
|
2011-02-04 07:23:52 +00:00
|
|
|
|
|
|
|
OBJ = $(SRC:.c=.o)
|
|
|
|
|
2015-04-04 03:21:33 +00:00
|
|
|
blackmagic: include/version.h $(OBJ)
|
2015-03-07 18:32:52 +00:00
|
|
|
@echo " LD $@"
|
2015-04-04 03:21:33 +00:00
|
|
|
$(Q)$(CC) -o $@ $(OBJ) $(LDFLAGS)
|
2015-03-07 18:32:52 +00:00
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
@echo " CC $<"
|
|
|
|
$(Q)$(CC) $(CFLAGS) -c $< -o $@
|
2011-02-04 07:23:52 +00:00
|
|
|
|
2015-03-06 22:36:24 +00:00
|
|
|
%.bin: %
|
2015-03-07 18:32:52 +00:00
|
|
|
@echo " OBJCOPY $@"
|
|
|
|
$(Q)$(OBJCOPY) -O binary $^ $@
|
2015-03-06 22:36:24 +00:00
|
|
|
|
|
|
|
%.hex: %
|
2015-03-07 18:32:52 +00:00
|
|
|
@echo " OBJCOPY $@"
|
|
|
|
$(Q)$(OBJCOPY) -O ihex $^ $@
|
2015-03-06 22:36:24 +00:00
|
|
|
|
2015-04-04 03:21:33 +00:00
|
|
|
.PHONY: clean host_clean all_platforms FORCE
|
2011-02-04 07:23:52 +00:00
|
|
|
|
|
|
|
clean: host_clean
|
2015-03-07 18:32:52 +00:00
|
|
|
$(Q)echo " CLEAN"
|
|
|
|
-$(Q)$(RM) -f *.o *.d *~ blackmagic $(HOSTFILES)
|
|
|
|
-$(Q)$(RM) -f platforms/*/*.o platforms/*/*.d mapfile
|
2011-02-04 07:23:52 +00:00
|
|
|
|
2015-03-03 06:20:25 +00:00
|
|
|
all_platforms:
|
2015-03-07 18:32:52 +00:00
|
|
|
$(Q)set -e ;\
|
2015-03-03 06:20:25 +00:00
|
|
|
for i in platforms/*/Makefile.inc ; do \
|
|
|
|
export DIRNAME=`dirname $$i` ;\
|
|
|
|
export PROBE_HOST=`basename $$DIRNAME` ;\
|
|
|
|
export CFLAGS=-Werror ;\
|
2015-03-07 18:32:52 +00:00
|
|
|
echo "Building for hardware platform: $$PROBE_HOST" ;\
|
|
|
|
$(MAKE) $(MAKEFLAGS) clean ;\
|
|
|
|
$(MAKE) $(MAKEFLAGS);\
|
2015-03-03 06:20:25 +00:00
|
|
|
if [ -f blackmagic.bin ]; then \
|
|
|
|
mv blackmagic.bin blackmagic-$$PROBE_HOST.bin ;\
|
|
|
|
fi ;\
|
|
|
|
done
|
|
|
|
|
2015-04-04 03:21:33 +00:00
|
|
|
include/version.h: FORCE
|
|
|
|
$(Q)echo " GIT include/version.h"
|
|
|
|
$(Q)echo "#define FIRMWARE_VERSION \"`git describe --dirty`\"" > $@
|
|
|
|
|
2012-01-08 05:42:24 +00:00
|
|
|
-include *.d
|
2015-03-03 06:20:25 +00:00
|
|
|
|