From afa02f645056c5823b0d8a29d37c1ff10aedce7a Mon Sep 17 00:00:00 2001 From: root Date: Tue, 27 Feb 2024 21:53:44 -0600 Subject: init --- makefile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 makefile (limited to 'makefile') 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) -- cgit v1.2.3