From ba9d670ebd9b9bab0a3c4fae0ba61388cc3543d3 Mon Sep 17 00:00:00 2001 From: augustin64 Date: Fri, 20 Oct 2023 17:15:15 +0200 Subject: [PATCH] Add Makefile & .gitignore --- .gitignore | 2 ++ Makefile | 26 ++++++++++++++++++++++++++ build/.gitkeep | 0 3 files changed, 28 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 build/.gitkeep diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5a4c31d --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.o +build/* \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9ecb87f --- /dev/null +++ b/Makefile @@ -0,0 +1,26 @@ +BUILDDIR := ./build +SRCDIR := ./src +CXX := g++ + +# Linker flag +LD_CXXFLAGS = + +# Compilation flag +CXXFLAGS = -Wall -Wextra -std=gnu99 -g -O3 +# Remove warnings about unused variables, functions, ... +# -Wno-unused-parameter -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable +# Compile with debug +# -g +# See memory leaks and Incorrect Read/Write +# -fsanitize=address -lasan + +$(BUILDDIR)/main: $(SRCDIR)/main.cpp + $(CXX) $^ -o $@ $(CFLAGS) $(LD_CFLAGS) + + +$(BUILDDIR)/%.o: $(SRCDIR)/%.cpp $(SRCDIR)/include/%.h + $(CXX) -c $< -o $@ $(CFLAGS) + + +clean: + rm -rf $(BUILDDIR)/* diff --git a/build/.gitkeep b/build/.gitkeep new file mode 100644 index 0000000..e69de29