mirror of
https://gitee.com/openharmony/third_party_littlefs
synced 2024-11-23 06:50:37 +00:00
aab6aa0ed9
- Removed old tests and test scripts - Reorganize the block devices to live under one directory - Plugged new test framework into Makefile renamed: - scripts/test_.py -> scripts/test.py - tests_ -> tests - {file,ram,test}bd/* -> bd/* It took a surprising amount of effort to make the Makefile behave since it turns out the "test_%" rule could override "tests/test_%.toml.test" which is generated as part of test.py.
70 lines
1.1 KiB
Makefile
70 lines
1.1 KiB
Makefile
TARGET = lfs.a
|
|
ifneq ($(wildcard test.c main.c),)
|
|
override TARGET = lfs
|
|
endif
|
|
|
|
CC ?= gcc
|
|
AR ?= ar
|
|
SIZE ?= size
|
|
|
|
SRC += $(wildcard *.c bd/*.c)
|
|
OBJ := $(SRC:.c=.o)
|
|
DEP := $(SRC:.c=.d)
|
|
ASM := $(SRC:.c=.s)
|
|
|
|
ifdef DEBUG
|
|
override CFLAGS += -O0 -g3
|
|
else
|
|
override CFLAGS += -Os
|
|
endif
|
|
ifdef WORD
|
|
override CFLAGS += -m$(WORD)
|
|
endif
|
|
ifdef TRACE
|
|
override CFLAGS += -DLFS_YES_TRACE
|
|
endif
|
|
override CFLAGS += -I.
|
|
override CFLAGS += -std=c99 -Wall -pedantic
|
|
override CFLAGS += -Wextra -Wshadow -Wjump-misses-init -Wundef
|
|
# Remove missing-field-initializers because of GCC bug
|
|
override CFLAGS += -Wno-missing-field-initializers
|
|
|
|
ifdef VERBOSE
|
|
override TFLAGS += -v
|
|
endif
|
|
|
|
|
|
all: $(TARGET)
|
|
|
|
asm: $(ASM)
|
|
|
|
size: $(OBJ)
|
|
$(SIZE) -t $^
|
|
|
|
test:
|
|
./scripts/test.py $(TFLAGS)
|
|
.SECONDEXPANSION:
|
|
test%: tests/test$$(firstword $$(subst \#, ,%)).toml
|
|
./scripts/test.py $(TFLAGS) $@
|
|
|
|
-include $(DEP)
|
|
|
|
lfs: $(OBJ)
|
|
$(CC) $(CFLAGS) $^ $(LFLAGS) -o $@
|
|
|
|
%.a: $(OBJ)
|
|
$(AR) rcs $@ $^
|
|
|
|
%.o: %.c
|
|
$(CC) -c -MMD $(CFLAGS) $< -o $@
|
|
|
|
%.s: %.c
|
|
$(CC) -S $(CFLAGS) $< -o $@
|
|
|
|
clean:
|
|
rm -f $(TARGET)
|
|
rm -f $(OBJ)
|
|
rm -f $(DEP)
|
|
rm -f $(ASM)
|
|
rm -f tests/*.toml.*
|