Source code for the Trusted Boot Module.
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.
 
 
 
tbm-mcu/Makefile

73 lines
1.5 KiB

TARGET ?= host
TARGET := $(filter host stm32f0 stm32f1,${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 += -DTBM_VERSION=\"2017-10-31\"
CFLAGS += -DBUILD_VERSION=\""$(shell date -u)"\"
CFLAGS += -Iinclude
CFLAGS += -Wall -Wextra -Wshadow -Wimplicit-function-declaration
CFLAGS += -Wredundant-decls -pedantic
CFLAGS += -D_XOPEN_SOURCE
CFLAGS += -std=c99
CFLAGS += -Os -flto
LDFLAGS += -Os -flto
TEST_LIBS += -lcmocka
-include source/Makefile
obj = $(addprefix $(BUILD)/, $(obj-y))
tbm-obj = $(addprefix $(BUILD)/, $(tbm-obj-y))
tbm-obj += $(obj)
test-obj = $(addprefix $(BUILD)/, $(test-obj-y))
test-obj += $(obj)
# 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: $(tbm-obj) $(LDSCRIPT)
@echo "LD $@"
@mkdir -p $(dir $@)
@$(LD) -o $@ $(CFLAGS) $(LDFLAGS) $(tbm-obj) $(LIBS)
$(BUILD)/test: CFLAGS += $(TEST_CFLAGS)
$(BUILD)/test: $(test-obj)
@echo "LD $@"
@mkdir -p $(dir $@)
@$(LD) -o $@ $(CFLAGS) $(LDFLAGS) $(TEST_LDFLAGS) $(test-obj) $(LIBS) $(TEST_LIBS)
test: $(BUILD)/test
@$(BUILD)/test
.PHONY: clean test