summaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
Diffstat (limited to 'makefile')
-rw-r--r--makefile23
1 files changed, 23 insertions, 0 deletions
diff --git a/makefile b/makefile
new file mode 100644
index 0000000..667f693
--- /dev/null
+++ b/makefile
@@ -0,0 +1,23 @@
+CC := g++
+BUILD_DIR := build
+CCOPTS := -Wall -Wextra -ggdb -pedantic-errors
+SRC_DIR := ./
+OUTPUT := $(shell basename $(CURDIR)).elf
+
+SRCFILES := $(wildcard ./$(SRC_DIR)/*.cpp)
+OBJFILES := $(patsubst ./$(SRC_DIR)/%.cpp,$(BUILD_DIR)/%.o,$(SRCFILES))
+
+make: BUILD_DIR $(OBJFILES)
+ $(CC) $(CCOPTS) -o $(OUTPUT) $(OBJFILES)
+
+debug:
+ gdb -x debug.gdb $(OUTPUT)
+
+$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
+ $(CC) $(CCOPTS) -c $< -o $@
+
+BUILD_DIR:
+ mkdir -p $(BUILD_DIR)
+
+clean:
+ rm -rf build/ $(OUTPUT)