42_CPP03/ex02/Makefile

27 lines
435 B
Makefile
Raw Permalink Normal View History

2023-08-29 09:47:04 -04:00
CXX := c++
CXXFLAGS := -std=c++98 -Wall -Wextra -Werror -g
SRCDIR := src
OBJDIR := obj
NAME := ex02
2023-08-09 09:56:36 -04:00
2023-08-29 09:47:04 -04:00
SRCS := $(wildcard $(SRCDIR)/*.cpp)
OBJS := $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS))
2023-08-09 09:56:36 -04:00
all: $(NAME)
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
mkdir -p obj
2023-08-29 09:47:04 -04:00
$(CXX) $(CXXFLAGS) -c $< -o $@
2023-08-09 09:56:36 -04:00
$(NAME): $(OBJS)
2023-08-29 09:47:04 -04:00
$(CXX) $(CXXFLAGS) $^ -o $@
2023-08-09 09:56:36 -04:00
clean:
2023-08-29 09:47:04 -04:00
rm -rf $(OBJDIR)
2023-08-09 09:56:36 -04:00
fclean: clean
rm -fr $(NAME)
2023-08-29 09:47:04 -04:00
re: fclean
@make --no-print-directory all