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.
72 lines
1.4 KiB
72 lines
1.4 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 += -DTBM_VERSION=\"2017-07-27-dev\"
|
|
CFLAGS += -Iinclude
|
|
CFLAGS += -Wall -Wundef -Wextra -Wshadow -Wimplicit-function-declaration
|
|
CFLAGS += -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -pedantic
|
|
CFLAGS += -D_XOPEN_SOURCE
|
|
|
|
CFLAGS += -std=c99
|
|
CFLAGS += -Os -flto
|
|
LDFLAGS += -Os -flto
|
|
|
|
-include source/Makefile
|
|
|
|
obj-y += source/bitops.o
|
|
obj-y += source/main.o
|
|
|
|
obj-y += source/core/flash.o
|
|
|
|
obj-y += source/fs/mufs/block.o
|
|
obj-y += source/fs/mufs/dir.o
|
|
obj-y += source/fs/mufs/file.o
|
|
obj-y += source/fs/mufs/path.o
|
|
obj-y += source/fs/mufs/super.o
|
|
obj-y += source/fs/mufs/tree.o
|
|
|
|
obj-y += source/ftl/dev.o
|
|
obj-y += source/ftl/ftl.o
|
|
obj-y += source/ftl/gc.o
|
|
obj-y += source/ftl/map.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) $(obj) $(LIBS)
|
|
|
|
.PHONY: clean
|
|
|