2012-06-10 04:40:07 +00:00
|
|
|
PROBE_HOST ?= native
|
|
|
|
PLATFORM_DIR = platforms/$(PROBE_HOST)
|
2016-07-03 19:37:25 +00:00
|
|
|
VPATH += $(PLATFORM_DIR) platforms/common target
|
2016-06-18 08:26:56 +00:00
|
|
|
ENABLE_DEBUG ?=
|
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 \
|
2016-06-18 08:26:56 +00:00
|
|
|
-I. -Iinclude -Iplatforms/common -I$(PLATFORM_DIR)
|
2016-06-29 08:03:32 +00:00
|
|
|
LDFLAGS += $(OPT_FLAGS)
|
2016-06-18 08:26:56 +00:00
|
|
|
|
|
|
|
ifeq ($(ENABLE_DEBUG), 1)
|
|
|
|
CFLAGS += -DENABLE_DEBUG
|
|
|
|
endif
|
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 \
|
2016-04-18 18:30:25 +00:00
|
|
|
cortexa.c \
|
2012-11-03 08:33:28 +00:00
|
|
|
cortexm.c \
|
|
|
|
crc32.c \
|
2015-10-23 18:47:23 +00:00
|
|
|
efm32.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 \
|
2016-07-01 04:50:19 +00:00
|
|
|
gdb_hostio.c \
|
2012-11-03 08:33:28 +00:00
|
|
|
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 \
|
2016-06-29 05:56:20 +00:00
|
|
|
jtagtap_generic.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 \
|
2016-06-09 22:20:07 +00:00
|
|
|
lpc15xx.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 \
|
2016-11-20 22:15:58 +00:00
|
|
|
sam4l.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 \
|
2015-08-21 14:57:10 +00:00
|
|
|
stm32l4.c \
|
2012-11-03 08:33:28 +00:00
|
|
|
swdptap.c \
|
2016-06-30 23:51:17 +00:00
|
|
|
swdptap_generic.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)
|
2017-05-23 18:57:35 +00:00
|
|
|
-$(Q)$(RM) -f platforms/*/*.o platforms/*/*.d mapfile include/version.h
|
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 ;\
|
2016-10-22 20:19:00 +00:00
|
|
|
mkdir -p artifacts/$(shell git describe --always) ;\
|
2016-10-22 19:17:57 +00:00
|
|
|
echo "<html><body><ul>" > artifacts/index.html ;\
|
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 \
|
2016-10-22 18:52:41 +00:00
|
|
|
mv blackmagic.bin artifacts/blackmagic-$$PROBE_HOST.bin ;\
|
2016-10-22 19:17:57 +00:00
|
|
|
echo "<li><a href='blackmagic-$$PROBE_HOST.bin'>$$PROBE_HOST</a></li>"\
|
|
|
|
>> artifacts/index.html ;\
|
2015-03-03 06:20:25 +00:00
|
|
|
fi ;\
|
2016-10-22 19:17:57 +00:00
|
|
|
done ;\
|
|
|
|
echo "</ul></body></html>" >> artifacts/index.html ;\
|
2016-10-22 20:19:00 +00:00
|
|
|
cp artifacts/*.bin artifacts/$(shell git describe --always)
|
2016-10-22 19:17:57 +00:00
|
|
|
|
2017-05-23 18:57:35 +00:00
|
|
|
command.c: include/version.h
|
2015-03-03 06:20:25 +00:00
|
|
|
|
2015-04-04 03:21:33 +00:00
|
|
|
include/version.h: FORCE
|
|
|
|
$(Q)echo " GIT include/version.h"
|
2016-10-22 21:45:32 +00:00
|
|
|
$(Q)echo "#define FIRMWARE_VERSION \"`git describe --always --dirty`\"" > $@
|
2015-04-04 03:21:33 +00:00
|
|
|
|
2012-01-08 05:42:24 +00:00
|
|
|
-include *.d
|