From eee1911d8e4e6811fc2ddeeac925b31630ad85e1 Mon Sep 17 00:00:00 2001 From: Isabell Pflug Date: Fri, 17 Apr 2026 16:38:13 +0200 Subject: [PATCH] :hammer: Created Makefile to automatically build projects from src/ and lib/ --- Makefile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..217e991 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +CXX := clang++ +CXXFLAGS := -std=c++23 -O2 -Wall -Wextra -Werror -Ilib + +SRC_DIR := src +LIB_DIR := lib +OUT_DIR := out + +PROJECTS := $(wildcard $(SRC_DIR)/*) +BINS := $(patsubst $(SRC_DIR)/%, $(OUT_DIR)/%, $(PROJECTS)) +LIB_SOURCES := $(wildcard $(LIB_DIR)/*.cpp) + +OPENMP_FLAG := +OPENMP_CHECK := $(shell echo | $(CXX) -fopenmp -x c++ - -o /dev/null 2>/dev/null && echo yes) + +ifeq ($(OPENMP_CHECK),yes) + OPENMP_FLAG := -fopenmp +endif + +CXXFLAGS += $(OPENMP_FLAG) + +all: $(BINS) + +$(OUT_DIR)/%: $(SRC_DIR)/% $(LIB_SOURCES) | $(OUT_DIR) + $(CXX) $(CXXFLAGS) $