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) # checking with a silly test program whether openmp is accessible # maybe at some point a cmake file would be more elegant. OPENMP_FLAG := OPENMP_CHECK := $(shell printf '#include \nint main(){return 0;}' | \ $(CXX) -std=c++23 -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) $