aboutsummaryrefslogtreecommitdiffstats
path: root/arduino/libraries/FileSystem/src/littlefs/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'arduino/libraries/FileSystem/src/littlefs/Makefile')
-rwxr-xr-xarduino/libraries/FileSystem/src/littlefs/Makefile69
1 files changed, 69 insertions, 0 deletions
diff --git a/arduino/libraries/FileSystem/src/littlefs/Makefile b/arduino/libraries/FileSystem/src/littlefs/Makefile
new file mode 100755
index 0000000..17d3616
--- /dev/null
+++ b/arduino/libraries/FileSystem/src/littlefs/Makefile
@@ -0,0 +1,69 @@
+TARGET = lfs.a
+ifneq ($(wildcard test.c main.c),)
+override TARGET = lfs
+endif
+
+CC ?= gcc
+AR ?= ar
+SIZE ?= size
+
+SRC += $(wildcard *.c emubd/*.c)
+OBJ := $(SRC:.c=.o)
+DEP := $(SRC:.c=.d)
+ASM := $(SRC:.c=.s)
+
+TEST := $(patsubst tests/%.sh,%,$(wildcard tests/test_*))
+
+SHELL = /bin/bash -o pipefail
+
+ifdef DEBUG
+override CFLAGS += -O0 -g3
+else
+override CFLAGS += -Os
+endif
+ifdef WORD
+override CFLAGS += -m$(WORD)
+endif
+override CFLAGS += -I.
+override CFLAGS += -std=c99 -Wall -pedantic
+override CFLAGS += -Wshadow -Wunused-parameter -Wjump-misses-init -Wsign-compare
+
+
+all: $(TARGET)
+
+asm: $(ASM)
+
+size: $(OBJ)
+ $(SIZE) -t $^
+
+.SUFFIXES:
+test: test_format test_dirs test_files test_seek test_truncate \
+ test_interspersed test_alloc test_paths test_orphan test_move test_corrupt
+ @rm test.c
+test_%: tests/test_%.sh
+
+ifdef QUIET
+ @./$< | sed -n '/^[-=]/p'
+else
+ ./$<
+endif
+
+-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)