diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -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 |