You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.1 KiB
53 lines
1.1 KiB
TARGET ?= host
|
|
TARGET := $(filter host stm32f0,${TARGET})
|
|
|
|
ifeq (${TARGET},)
|
|
$(error No support available for the target)
|
|
endif
|
|
|
|
BUILD ?= build
|
|
BUILD := $(addsuffix /${TARGET},${BUILD})
|
|
|
|
all: $(BUILD)/tbm
|
|
|
|
-include scripts/Makefile.${TARGET}
|
|
|
|
CFLAGS += -Iinclude
|
|
CFLAGS += -Wall -Wundef -Wextra -Wshadow -Wimplicit-function-declaration
|
|
CFLAGS += -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes
|
|
CFLAGS += -fno-common --function-sections -fdata-sections
|
|
|
|
obj-y += source/main.o
|
|
obj-y += source/shell.o
|
|
obj-y += source/spi_flash.o
|
|
obj-y += source/usart.o
|
|
|
|
obj = $(addprefix $(BUILD)/, $(obj-y))
|
|
|
|
# Include the dependencies.
|
|
-include $(obj:.o=.d)
|
|
|
|
# Set up the toolchain.
|
|
CC := $(PREFIX)-gcc
|
|
LD := $(PREFIX)-gcc
|
|
GDB := $(PREFIX)-gdb
|
|
MAKE := make
|
|
|
|
.SECONDARY:
|
|
|
|
clean:
|
|
@echo "CLEAN"
|
|
@rm -rf $(BUILD)
|
|
|
|
# Rule to compile C source code.
|
|
$(BUILD)/%.o: %.c
|
|
@echo "CC $<"
|
|
@mkdir -p $(dir $@)
|
|
@$(CC) -c $< -o $@ $(CFLAGS) -MT $@ -MMD -MP -MF $(@:.o=.d)
|
|
|
|
$(BUILD)/tbm: $(obj) $(LDSCRIPT)
|
|
@echo "LD $@"
|
|
@mkdir -p $(dir $@)
|
|
@$(LD) -o $@ $(CFLAGS) $(LDFLAGS) -T $(LDSCRIPT) $(obj) $(LIBS)
|
|
|
|
.PHONY: clean
|
|
|