42_CPP01/ex01/Makefile

26 lines
404 B
Makefile
Raw Permalink Normal View History

2023-05-23 11:38:05 -04:00
CXX = c++
2023-07-11 20:45:13 -04:00
CPPFLAGS = -std=c++98 -Wall -Wextra -Werror -g
2023-05-23 11:38:05 -04:00
SRCDIR = src
OBJDIR = obj
2023-07-11 20:45:13 -04:00
NAME = ex01
2023-05-23 11:38:05 -04:00
SRCS = $(wildcard $(SRCDIR)/*.cpp)
OBJS = $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS))
2023-07-11 20:45:13 -04:00
all: $(NAME)
2023-05-23 11:38:05 -04:00
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
2023-07-11 20:45:13 -04:00
mkdir -p obj
$(CXX) $(CPPFLAGS) -c $< -o $@
2023-05-23 11:38:05 -04:00
2023-07-11 20:45:13 -04:00
$(NAME): $(OBJS)
$(CXX) $(CPPFLAGS) $^ -o $@
2023-05-23 11:38:05 -04:00
clean:
rm -rf $(OBJDIR)/*.o
fclean: clean
2023-07-11 20:45:13 -04:00
rm -fr $(NAME)
2023-05-23 11:38:05 -04:00
re: fclean all