makefile create obj folder

This commit is contained in:
starnakin 2023-07-12 02:08:59 +02:00
parent 16ab359cf2
commit bd77483ed4
4 changed files with 4 additions and 2 deletions

View File

@ -2,7 +2,7 @@ CXX = c++
CPPFLAGS = -std=c++98 -Wall -Wextra -Werror -g
SRCDIR = src
OBJDIR = obj
NAME = megaphone
NAME = ex02
SRCS = $(wildcard $(SRCDIR)/*.cpp)
OBJS = $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS))
@ -10,6 +10,7 @@ OBJS = $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS))
all: $(NAME)
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
mkdir -p obj
$(CXX) $(CPPFLAGS) -c $< -o $@
$(NAME): $(OBJS)

View File

View File

@ -2,7 +2,7 @@ CXX = c++
CPPFLAGS = -std=c++98 -Wall -Wextra -Werror -g
SRCDIR = src
OBJDIR = obj
NAME = contacts
NAME = ex02
SRCS = $(wildcard $(SRCDIR)/*.cpp)
OBJS = $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS))
@ -10,6 +10,7 @@ OBJS = $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS))
all: $(NAME)
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
mkdir -p obj
$(CXX) $(CPPFLAGS) -c $< -o $@
$(NAME): $(OBJS)

View File