diff options
author | Ekaitz Zarraga <ekaitz@elenq.tech> | 2024-02-28 22:03:04 +0100 |
---|---|---|
committer | Ekaitz Zarraga <ekaitz@elenq.tech> | 2024-02-28 22:08:20 +0100 |
commit | a1f6afa69bb25191d4b206e4ecba1557629330bc (patch) | |
tree | 3041324b6f0932ef036e9de230e965a4400f2b08 /Makefile |
First commit with project structure
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8b75684 --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +CC = gcc +TARGET = parc +BASENM = buffer piece-table +SRC = $(addsuffix .c, $(addprefix src/, $(BASENM)) ) +OBJDIR = out +OBJ = $(addsuffix .o, $(addprefix $(OBJDIR)/, $(BASENM))) + +HEADERS = $(wildcard src/*.h) + +TEST := buffer +TEST_FILES = $(addprefix tests/, $(TEST)) +TEST_SOURCES = $(addsuffix .c, $(addprefix tests/, $(TEST))) + +all: $(TARGET) + +$(TARGET): $(OBJ) src/main.c + @$(CC) $(CFLAGS) $(OBJ) src/main.c -o $(TARGET) + +$(OBJ): $(OBJDIR)/%.o: src/%.c $(HEADERS) + @mkdir -p out + @$(CC) $(CFLAGS) -o $@ -c $< + +clean: + @rm -f $(TARGET) + @rm -f out/* + @rm -rf out/ + @rm -f $(TEST_FILES) + +$(TEST_FILES): $(TARGET) $(TEST_SOURCES) $(HEADERS) + @$(CC) $(CFLAGS) -o $@ $(addsuffix .c, $@) $(OBJ) + @if ./$@ ; then echo "PASS: $@";else echo "FAIL: $@ exit value: $$?"; fi + +test: $(TEST_FILES) + +.PHONY: clean all test |