aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMarvin Borner2021-08-29 21:18:03 +0200
committerMarvin Borner2021-08-29 21:18:03 +0200
commit75bb42663294b388377178b7257c6f8c0f787032 (patch)
tree0371bf7570ee85ada4ab6dfc98e6ffe9098cef16 /Makefile
parenteef250dd4a0ae185a8d9d668f020b2ab5c2f4849 (diff)
KVM stuff
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile21
1 files changed, 13 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 35af12f..391e641 100644
--- a/Makefile
+++ b/Makefile
@@ -1,23 +1,28 @@
-SOURCEDIR = src
-INCDIR = inc
-BUILDDIR = build
+SOURCEDIR = $(PWD)/src
+INCDIR = $(PWD)/inc
+BUILDDIR = $(PWD)/build
SOURCES = $(wildcard $(SOURCEDIR)/*.c)
OBJS = $(patsubst $(SOURCEDIR)/%.c, $(BUILDDIR)/%.o, $(SOURCES))
CC = gcc
WARNINGS = -Wall -Wextra -Wshadow -Wpointer-arith -Wwrite-strings -Wredundant-decls -Wnested-externs -Wformat=2 -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wswitch-default -Wswitch-enum -Wlogical-op -Wunreachable-code -Wundef -Wold-style-definition -Wvla -pedantic
-DEBUG = -fsanitize=undefined -fsanitize=address -ggdb3 -g3 -g -s -Og
+DEBUG = -fsanitize=undefined -fsanitize=address -fstack-protector-strong -ggdb3 -g3 -g -s -Og
CFLAGS = -Ofast $(WARNINGS) -I$(INCDIR) $(DEBUG)
all: $(OBJS)
- @$(CC) -o ./$(BUILDDIR)/out $^ $(CFLAGS)
+ @$(CC) -o $(BUILDDIR)/out $(CFLAGS) $^
clean:
@$(RM) -rf $(BUILDDIR)
-run: clean all
- @./$(BUILDDIR)/out
+run: clean all sync
+ @nasm test.asm -o $(BUILDDIR)/test
+ @$(BUILDDIR)/out
+
+sync:
+ @make --always-make --dry-run | grep -wE 'gcc|g\+\+' | grep -w '\-c' | jq -nR '[inputs|{directory:".", command:., file: match(" [^ ]+$$").string[1:]}]' >compile_commands.json
+ @ctags -R --exclude=.git --exclude=build .
$(BUILDDIR)/%.o: $(SOURCEDIR)/%.c
@mkdir -p $(BUILDDIR)
- @$(CC) -c -o $@ $< $(CFLAGS)
+ @$(CC) -c -o $@ $(CFLAGS) $<