| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- TARGET = lfs.a
- ifneq ($(wildcard test.c main.c),)
- override TARGET = lfs
- endif
- CC ?= gcc
- AR ?= ar
- SIZE ?= size
- SRC += $(wildcard *.c rambd/*.c filebd/*.c testbd/*.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
- 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
- all: $(TARGET)
- asm: $(ASM)
- size: $(OBJ)
- $(SIZE) -t $^
- .SUFFIXES:
- test: \
- test_format \
- test_dirs \
- test_files \
- test_seek \
- test_truncate \
- test_entries \
- test_interspersed \
- test_alloc \
- test_paths \
- test_attrs \
- test_move \
- test_orphan \
- test_relocations \
- test_corrupt
- @rm test.c
- test_%: tests/test_%.sh
- ifdef QUIET
- @./$< | sed -nu '/^[-=]/p'
- else
- ./$<
- endif
- test_:
- ./scripts/test_.py $(TFLAGS)
- -include $(DEP)
- %?:
- @echo '$($*)'
- 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_/test_*.toml.*
|