PROBE_HOST ?= native PLATFORM_DIR = platforms/$(PROBE_HOST) VPATH += $(PLATFORM_DIR) platforms/common target ENABLE_DEBUG ?= ifneq ($(V), 1) MAKEFLAGS += --no-print-dir Q := @ endif OPT_FLAGS ?= -O2 CFLAGS += -Wall -Wextra -Werror -Wno-char-subscripts -Wno-cast-function-type \ $(OPT_FLAGS) -std=gnu99 -g3 -MD \ -I. -Iinclude -Iplatforms/common -I$(PLATFORM_DIR) LDFLAGS += $(OPT_FLAGS) ifeq ($(ENABLE_DEBUG), 1) CFLAGS += -DENABLE_DEBUG endif SRC = \ adiv5.c \ adiv5_jtagdp.c \ adiv5_swdp.c \ command.c \ cortexa.c \ cortexm.c \ crc32.c \ efm32.c \ exception.c \ gdb_if.c \ gdb_main.c \ gdb_hostio.c \ gdb_packet.c \ hex_utils.c \ lmi.c \ lpc_common.c \ lpc11xx.c \ lpc17xx.c \ lpc15xx.c \ lpc43xx.c \ kinetis.c \ main.c \ morse.c \ msp432.c \ nrf51.c \ nxpke04.c \ platform.c \ sam3x.c \ sam4l.c \ samd.c \ stm32f1.c \ stm32f4.c \ stm32h7.c \ stm32l0.c \ stm32l4.c \ target.c \ include $(PLATFORM_DIR)/Makefile.inc ifndef TARGET TARGET=blackmagic endif ifndef SWD_HL SRC += swdptap.c swdptap_generic.c endif ifndef JTAG_HL SRC += jtag_scan.c jtagtap.c jtagtap_generic.c endif OBJ = $(SRC:.c=.o) $(TARGET): include/version.h $(OBJ) @echo " LD $@" $(Q)$(CC) -o $@ $(OBJ) $(LDFLAGS) %.o: %.c @echo " CC $<" $(Q)$(CC) $(CFLAGS) -c $< -o $@ %.bin: % @echo " OBJCOPY $@" $(Q)$(OBJCOPY) -O binary $^ $@ %.hex: % @echo " OBJCOPY $@" $(Q)$(OBJCOPY) -O ihex $^ $@ .PHONY: clean host_clean all_platforms FORCE clean: host_clean $(Q)echo " CLEAN" ifeq ($(OS), Windows_NT) -$(Q)$(shell del *.o, *.d, blackmagic*, $(HOSTFILES)) else -$(Q)$(RM) *.o *.d *~ blackmagic $(HOSTFILES) -$(Q)$(RM) platforms/*/*.o platforms/*/*.d mapfile include/version.h endif all_platforms: $(Q)set -e ;\ mkdir -p artifacts/$(shell git describe --always) ;\ echo "" >> artifacts/index.html ;\ cp artifacts/*.bin artifacts/$(shell git describe --always) command.c: include/version.h include/version.h: FORCE $(Q)echo " GIT include/version.h" ifeq ($(OS), Windows_NT) $(Q)echo #define FIRMWARE_VERSION "$(shell git describe --always --dirty)" > $@ else $(Q)echo "#define FIRMWARE_VERSION \"$(shell git describe --always --dirty)\"" > $@ endif -include *.d