From bfdc8d2d843c08bd01517256a63518d03da236f6 Mon Sep 17 00:00:00 2001
From: Marvin Borner
Date: Tue, 27 Jul 2021 21:10:34 +0200
Subject: Started treeify

---
 Makefile | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 7e61d70..9f74876 100644
--- a/Makefile
+++ b/Makefile
@@ -1,23 +1,25 @@
-SOURCEDIR = src
-BUILDDIR = build
+INCLUDEDIR = $(PWD)/inc
+SOURCEDIR = $(PWD)/src
+BUILDDIR = $(PWD)/build
 SOURCES = $(wildcard $(SOURCEDIR)/*.c)
 OBJS = $(patsubst $(SOURCEDIR)/%.c, $(BUILDDIR)/%.o, $(SOURCES))
 
-CC = gcc
-CFLAGS = -Ofast -Wall -Wextra -Werror -pedantic -Wshadow -Wpointer-arith -Wwrite-strings -Wredundant-decls -Wnested-externs -Wformat=1 -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wswitch-default -Wswitch-enum -Wlogical-op -Wunreachable-code -Wundef -Wold-style-definition -Wvla -std=c99 -fsanitize=address -fsanitize=undefined -I$(SOURCEDIR)/inc/
+CC = ccache gcc
+CFLAGS = -Ofast -Wall -Wextra -Werror -pedantic -Wshadow -Wpointer-arith -Wwrite-strings -Wredundant-decls -Wnested-externs -Wformat=1 -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wswitch-default -Wswitch-enum -Wlogical-op -Wunreachable-code -Wundef -Wold-style-definition -Wvla -std=c99 -fsanitize=address -fsanitize=undefined -fstack-protector-strong -I$(INCLUDEDIR)
 
 all: $(OBJS)
-	@$(CC) -o ./$(BUILDDIR)/out $(CFLAGS) $^
+	@$(CC) -o $(BUILDDIR)/out $(CFLAGS) $^
 
 clean:
 	@$(RM) -rf $(BUILDDIR)
 
-run: clean all
-	@./$(BUILDDIR)/out test.fun
+run: clean all sync
+	@$(BUILDDIR)/out test.fun
 
 $(BUILDDIR)/%.o: $(SOURCEDIR)/%.c
 	@mkdir -p $(BUILDDIR)
 	@$(CC) -c -o $@ $(CFLAGS) $<
 
 sync:
-	@make --always-make --dry-run | grep -wE 'gcc|g\+\+' | grep -w '\-c' | jq -nR '[inputs|{directory:"$(PWD)", command:., file: match(" [^ ]+$$").string[1:]}]' > compile_commands.json
+	@ctags -R --exclude=.git --exclude=build .
+	@make --always-make --dry-run | grep -wE 'gcc|g\+\+' | grep -w '\-c' | jq -nR '[inputs|{directory:".", command:., file: match(" [^ ]+$$").string[1:]}]' > compile_commands.json
-- 
cgit v1.2.3