summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorOskar <[email protected]>2024-07-28 12:52:38 +0200
committerOskar <[email protected]>2024-07-28 12:52:38 +0200
commit5aac3c3f8bcfef0b2aad28d91d87b9ebf1d5e7df (patch)
tree38736b9f0c57f69e272121e0fc1f3969bb7468e2 /Makefile
first commit
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile29
1 files changed, 29 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..40ebce8
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,29 @@
+CC1=clang++
+CC2=g++
+CFLAGS_CLANG=-O0 -Wfatal-errors -Wall -Werror -Wextra -g3 -fsanitize=address -fsanitize=leak -Wpedantic -Wformat=2 -Wshadow -fno-common -std=c++11
+CFLAGS_GCC=-O0 -Wfatal-errors -Wall -Werror -Wextra -g3 -fsanitize=address -fsanitize=leak -Wpedantic -Wformat=2 -Wshadow -fno-common -std=c++11 -Wformat-truncation=2 -Wformat-overflow
+BINDIR=bin
+SRCS=$(wildcard *.cpp)
+OBJS_CLANG=$(patsubst %.cpp, $(BINDIR)/clang/%, $(SRCS))
+OBJS_GCC=$(patsubst %.cpp, $(BINDIR)/gcc/%, $(SRCS))
+MAKEFLAGS += -j$(nproc)
+
+all: clang gcc
+
+clean:
+ rm -rf $(BINDIR)/gcc/*
+ rm -rf $(BINDIR)/clang/*
+
+clang: $(OBJS_CLANG)
+
+gcc: $(OBJS_GCC)
+
+$(BINDIR)/clang/%: %.cpp
+ @mkdir -p $(BINDIR)/clang
+ $(CC1) $(CFLAGS_CLANG) -o $@ $<
+
+$(BINDIR)/gcc/%: %.cpp
+ @mkdir -p $(BINDIR)/gcc
+ $(CC2) $(CFLAGS_GCC) -o $@ $<
+
+.PHONY: all clean clang gcc