diff --git a/Makefile b/Makefile index e9ccfcd..c9f488c 100644 --- a/Makefile +++ b/Makefile @@ -1,30 +1,22 @@ -# Pfad zum Makefile selbst bestimmen -MAKEFILE_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) - CXX := clang++ -CXXFLAGS := -Wall -Wextra -Wpedantic -O2 -std=c++23 - -SRC_DIR := $(MAKEFILE_DIR)/src -OUT_DIR := $(MAKEFILE_DIR)/out +CXXFLAGS := -std=c++23 -O2 -Wall -Wextra -Werror -fopenmp -Ilib -SOURCES := $(wildcard $(SRC_DIR)/*.cpp) -TARGETS := $(patsubst $(SRC_DIR)/%.cpp,$(OUT_DIR)/%,$(SOURCES)) +SRC_DIR := src +LIB_DIR := lib +OUT_DIR := out -# Teste ob Compiler C++23 kann -CXX23_SUPPORTED := $(shell echo 'int main(){}' | $(CXX) -std=c++23 -x c++ -o /dev/null - 2>/dev/null && echo yes) +PROJECTS := $(wildcard $(SRC_DIR)/*) +BINS := $(patsubst $(SRC_DIR)/%, $(OUT_DIR)/%, $(PROJECTS)) +LIB_SOURCES := $(wildcard $(LIB_DIR)/*.cpp) -ifeq ($(CXX23_SUPPORTED),) -$(error Your compiler does not support C++23. Please update your system!) -endif +all: $(BINS) -all: $(OUT_DIR) $(TARGETS) +$(OUT_DIR)/%: $(SRC_DIR)/% $(LIB_SOURCES) | $(OUT_DIR) + $(CXX) $(CXXFLAGS) $