blackmagic/src/Makefile

114 lines
2.3 KiB
Makefile
Raw Normal View History

PROBE_HOST ?= native
PLATFORM_DIR = platforms/$(PROBE_HOST)
VPATH += $(PLATFORM_DIR) platforms/common target
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\
$(OPT_FLAGS) -std=gnu99 -g3 -MD \
-I. -Iinclude -Iplatforms/common -I$(PLATFORM_DIR)
LDFLAGS += $(OPT_FLAGS)
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 \
efm32.c \
exception.c \
2012-11-03 08:33:28 +00:00
gdb_if.c \
gdb_main.c \
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 \
jtagtap_generic.c \
2011-02-04 07:23:52 +00:00
lmi.c \
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 \
kinetis.c \
2012-11-03 08:33:28 +00:00
main.c \
morse.c \
2014-04-25 21:34:58 +00:00
nrf51.c \
2012-11-03 08:33:28 +00:00
platform.c \
sam3x.c \
sam4l.c \
2015-01-18 22:40:02 +00:00
samd.c \
2012-11-03 08:33:28 +00:00
stm32f1.c \
stm32f4.c \
stm32l0.c \
stm32l4.c \
2012-11-03 08:33:28 +00:00
swdptap.c \
2016-06-30 23:51:17 +00:00
swdptap_generic.c \
target.c \
2011-02-04 07:23:52 +00:00
include $(PLATFORM_DIR)/Makefile.inc
2011-02-04 07:23:52 +00:00
OBJ = $(SRC:.c=.o)
blackmagic: include/version.h $(OBJ)
2015-03-07 18:32:52 +00:00
@echo " LD $@"
$(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
%.bin: %
2015-03-07 18:32:52 +00:00
@echo " OBJCOPY $@"
$(Q)$(OBJCOPY) -O binary $^ $@
%.hex: %
2015-03-07 18:32:52 +00:00
@echo " OBJCOPY $@"
$(Q)$(OBJCOPY) -O ihex $^ $@
.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
all_platforms:
2015-03-07 18:32:52 +00:00
$(Q)set -e ;\
mkdir -p artifacts/$(shell git describe --always) ;\
2016-10-22 19:17:57 +00:00
echo "<html><body><ul>" > artifacts/index.html ;\
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);\
if [ -f blackmagic.bin ]; then \
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 ;\
fi ;\
2016-10-22 19:17:57 +00:00
done ;\
echo "</ul></body></html>" >> artifacts/index.html ;\
cp artifacts/*.bin artifacts/$(shell git describe --always)
2016-10-22 19:17:57 +00:00
include/version.h: FORCE
$(Q)echo " GIT include/version.h"
$(Q)echo "#define FIRMWARE_VERSION \"`git describe --always --dirty`\"" > $@
-include *.d