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-02-25 20:31:14 +00:00
|
|
|
ifdef DEBUG
|
|
|
|
CFLAGS += -O0 -g3
|
|
|
|
else
|
2017-02-27 03:00:39 +00:00
|
|
|
CFLAGS += -Os
|
2017-02-25 20:31:14 +00:00
|
|
|
endif
|
|
|
|
ifdef WORD
|
|
|
|
CFLAGS += -m$(WORD)
|
|
|
|
endif
|
|
|
|
CFLAGS += -I.
|
|
|
|
CFLAGS += -std=c99 -Wall -pedantic
|
|
|
|
|
|
|
|
|
|
|
|
all: $(TARGET)
|
|
|
|
|
|
|
|
asm: $(ASM)
|
|
|
|
|
|
|
|
size: $(OBJ)
|
|
|
|
$(SIZE) -t $^
|
|
|
|
|
2017-03-25 23:11:45 +00:00
|
|
|
.SUFFIXES:
|
2017-04-14 23:27:06 +00:00
|
|
|
test: test_format test_dirs test_files test_alloc test_orphan test_paths
|
2017-03-25 23:11:45 +00:00
|
|
|
test_%: tests/test_%.sh
|
|
|
|
./$<
|
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)
|