From ce91cbdfd6c1ec312d2e20d23a0764e3915ef27c Mon Sep 17 00:00:00 2001 From: Camille Chauvet Date: Tue, 29 Aug 2023 13:47:04 +0000 Subject: [PATCH] makefiles fix --- ex00/Makefile | 23 ++++++++++++----------- ex01/Makefile | 23 ++++++++++++----------- ex02/Makefile | 23 ++++++++++++----------- 3 files changed, 36 insertions(+), 33 deletions(-) diff --git a/ex00/Makefile b/ex00/Makefile index b10e2f7..47ad482 100644 --- a/ex00/Makefile +++ b/ex00/Makefile @@ -1,25 +1,26 @@ -CXX = c++ -CPPFLAGS = -std=c++98 -Wall -Wextra -Werror -g -SRCDIR = src -OBJDIR = obj -NAME = ex00 +CXX := c++ +CXXFLAGS := -std=c++98 -Wall -Wextra -Werror -g +SRCDIR := src +OBJDIR := obj +NAME := ex00 -SRCS = $(wildcard $(SRCDIR)/*.cpp) -OBJS = $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS)) +SRCS := $(wildcard $(SRCDIR)/*.cpp) +OBJS := $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS)) all: $(NAME) $(OBJDIR)/%.o: $(SRCDIR)/%.cpp mkdir -p obj - $(CXX) $(CPPFLAGS) -c $< -o $@ + $(CXX) $(CXXFLAGS) -c $< -o $@ $(NAME): $(OBJS) - $(CXX) $(CPPFLAGS) $^ -o $@ + $(CXX) $(CXXFLAGS) $^ -o $@ clean: - rm -rf $(OBJDIR)/*.o + rm -rf $(OBJDIR) fclean: clean rm -fr $(NAME) -re: fclean all +re: fclean + @make --no-print-directory all diff --git a/ex01/Makefile b/ex01/Makefile index e998f72..7f950fe 100644 --- a/ex01/Makefile +++ b/ex01/Makefile @@ -1,25 +1,26 @@ -CXX = c++ -CPPFLAGS = -std=c++98 -Wall -Wextra -Werror -g -SRCDIR = src -OBJDIR = obj -NAME = ex01 +CXX := c++ +CXXFLAGS := -std=c++98 -Wall -Wextra -Werror -g +SRCDIR := src +OBJDIR := obj +NAME := ex01 -SRCS = $(wildcard $(SRCDIR)/*.cpp) -OBJS = $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS)) +SRCS := $(wildcard $(SRCDIR)/*.cpp) +OBJS := $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS)) all: $(NAME) $(OBJDIR)/%.o: $(SRCDIR)/%.cpp mkdir -p obj - $(CXX) $(CPPFLAGS) -c $< -o $@ + $(CXX) $(CXXFLAGS) -c $< -o $@ $(NAME): $(OBJS) - $(CXX) $(CPPFLAGS) $^ -o $@ + $(CXX) $(CXXFLAGS) $^ -o $@ clean: - rm -rf $(OBJDIR)/*.o + rm -rf $(OBJDIR) fclean: clean rm -fr $(NAME) -re: fclean all +re: fclean + @make --no-print-directory all diff --git a/ex02/Makefile b/ex02/Makefile index 6601adb..767d93c 100644 --- a/ex02/Makefile +++ b/ex02/Makefile @@ -1,25 +1,26 @@ -CXX = c++ -CPPFLAGS = -std=c++98 -Wall -Wextra -Werror -g -SRCDIR = src -OBJDIR = obj -NAME = ex02 +CXX := c++ +CXXFLAGS := -std=c++98 -Wall -Wextra -Werror -g +SRCDIR := src +OBJDIR := obj +NAME := ex02 -SRCS = $(wildcard $(SRCDIR)/*.cpp) -OBJS = $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS)) +SRCS := $(wildcard $(SRCDIR)/*.cpp) +OBJS := $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS)) all: $(NAME) $(OBJDIR)/%.o: $(SRCDIR)/%.cpp mkdir -p obj - $(CXX) $(CPPFLAGS) -c $< -o $@ + $(CXX) $(CXXFLAGS) -c $< -o $@ $(NAME): $(OBJS) - $(CXX) $(CPPFLAGS) $^ -o $@ + $(CXX) $(CXXFLAGS) $^ -o $@ clean: - rm -rf $(OBJDIR)/*.o + rm -rf $(OBJDIR) fclean: clean rm -fr $(NAME) -re: fclean all +re: fclean + @make --no-print-directory all