42_CPP02/ex01/Makefile

26 lines
404 B
Makefile
Raw Normal View History

2023-08-03 08:01:36 -04:00
CXX = c++
2023-08-03 08:10:21 -04:00
CPPFLAGS = -std=c++98 -Wall -Wextra -Werror -g
2023-08-03 08:01:36 -04:00
SRCDIR = src
OBJDIR = obj
2023-08-03 08:10:21 -04:00
NAME = ex01
2023-08-03 08:01:36 -04:00
SRCS = $(wildcard $(SRCDIR)/*.cpp)
OBJS = $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS))
2023-08-03 08:10:21 -04:00
all: $(NAME)
2023-08-03 08:01:36 -04:00
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
2023-08-03 08:10:21 -04:00
mkdir -p obj
$(CXX) $(CPPFLAGS) -c $< -o $@
2023-08-03 08:01:36 -04:00
2023-08-03 08:10:21 -04:00
$(NAME): $(OBJS)
$(CXX) $(CPPFLAGS) $^ -o $@
2023-08-03 08:01:36 -04:00
clean:
rm -rf $(OBJDIR)/*.o
fclean: clean
2023-08-03 08:10:21 -04:00
rm -fr $(NAME)
2023-08-03 08:01:36 -04:00
re: fclean all