dotfiles/.local/share/script-data/cpp20/Makefile

27 lines
678 B
Makefile
Raw Normal View History

2024-04-23 04:34:15 +02:00
CXX = clang++
CXXFLAGS = -std=c++20 --debug
SRCDIR := .
BUILDDIR := build
INCDIR := include
SRCS := $(wildcard $(SRCDIR)/*.cpp)
OBJS := $(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.o,$(SRCS))
DEPS := $(OBJS:.o=.d)
EXEC := main
all: compile_msg build
compile_msg:
2024-04-25 08:43:27 +02:00
@echo -e "\e[34m Compile: $(SRCS)\e[0m"
2024-04-23 04:34:15 +02:00
$(EXEC): $(OBJS)
2024-04-25 08:43:27 +02:00
@echo -e "\n\e[34m Link: $(EXEC)\e[0m"
2024-04-23 04:34:15 +02:00
$(CXX) $(CXXFLAGS) $(OBJS) -o $(EXEC)
build: $(EXEC)
$(BUILDDIR)/%.o: $(SRCDIR)/%.cpp
@mkdir -p $(BUILDDIR)
$(CXX) $(CXXFLAGS) -I$(INCDIR) -MMD -MP -c $< -o $@
-include $(DEPS)
run: $(EXEC)
2024-04-25 08:43:27 +02:00
@echo -e "\n\e[34m󱓞 Execute : $(EXEC)\e[0m"
2024-04-23 04:34:15 +02:00
./$(EXEC)
clean:
rm -rf $(BUILDDIR) $(EXEC)
.PHONY: all build run clean