You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
759 B
Makefile

# 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
SOURCES := $(wildcard $(SRC_DIR)/*.cpp)
TARGETS := $(patsubst $(SRC_DIR)/%.cpp,$(OUT_DIR)/%,$(SOURCES))
# 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)
ifeq ($(CXX23_SUPPORTED),)
$(error Your compiler does not support C++23. Please update your system!)
endif
all: $(OUT_DIR) $(TARGETS)
$(OUT_DIR):
mkdir -p $(OUT_DIR)
$(OUT_DIR)/%: $(SRC_DIR)/%.cpp
$(CXX) $(CXXFLAGS) $< -o $@
clean:
rm -rf $(OUT_DIR)
.PHONY: all clean