2017-02-25 20:31:14 +00:00
|
|
|
TARGET = lfs
|
|
|
|
|
|
|
|
CC = gcc
|
|
|
|
AR = ar
|
|
|
|
SIZE = size
|
|
|
|
|
|
|
|
SRC += $(wildcard *.c emubd/*.c)
|
|
|
|
OBJ := $(SRC:.c=.o)
|
|
|
|
DEP := $(SRC:.c=.d)
|
|
|
|
ASM := $(SRC:.c=.s)
|
|
|
|
|
2017-03-25 23:11:45 +00:00
|
|
|
TEST := $(patsubst tests/%.sh,%,$(wildcard tests/test_*))
|
2017-03-25 22:02:16 +00:00
|
|
|
|
2017-11-22 20:49:48 +00:00
|
|
|
SHELL = /bin/bash -o pipefail
|
|
|
|
|
2017-02-25 20:31:14 +00:00
|
|
|
ifdef DEBUG
|
2018-01-29 17:30:53 +00:00
|
|
|
override CFLAGS += -O0 -g3
|
2017-02-25 20:31:14 +00:00
|
|
|
else
|
2018-01-29 17:30:53 +00:00
|
|
|
override CFLAGS += -Os
|
2017-02-25 20:31:14 +00:00
|
|
|
endif
|
|
|
|
ifdef WORD
|
2018-01-29 17:30:53 +00:00
|
|
|
override CFLAGS += -m$(WORD)
|
2017-02-25 20:31:14 +00:00
|
|
|
endif
|
2018-01-29 17:30:53 +00:00
|
|
|
override CFLAGS += -I.
|
|
|
|
override CFLAGS += -std=c99 -Wall -pedantic
|
2017-02-25 20:31:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
all: $(TARGET)
|
|
|
|
|
|
|
|
asm: $(ASM)
|
|
|
|
|
|
|
|
size: $(OBJ)
|
|
|
|
$(SIZE) -t $^
|
|
|
|
|
2017-03-25 23:11:45 +00:00
|
|
|
.SUFFIXES:
|
2018-01-20 23:30:40 +00:00
|
|
|
test: test_format test_dirs test_files test_seek test_truncate test_parallel \
|
2017-10-07 14:19:08 +00:00
|
|
|
test_alloc test_paths test_orphan test_move test_corrupt
|
2017-03-25 23:11:45 +00:00
|
|
|
test_%: tests/test_%.sh
|
2017-11-16 23:54:44 +00:00
|
|
|
ifdef QUIET
|
2018-01-29 18:54:48 +00:00
|
|
|
@./$< | sed -n '/^[-=]/p'
|
2017-11-16 23:54:44 +00:00
|
|
|
else
|
2017-03-25 23:11:45 +00:00
|
|
|
./$<
|
2017-11-16 23:54:44 +00:00
|
|
|
endif
|
2017-03-25 22:02:16 +00:00
|
|
|
|
2017-02-25 20:31:14 +00:00
|
|
|
-include $(DEP)
|
|
|
|
|
|
|
|
$(TARGET): $(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)
|