makefile create obj folder
This commit is contained in:
parent
16ab359cf2
commit
bd77483ed4
@ -2,7 +2,7 @@ CXX = c++
|
|||||||
CPPFLAGS = -std=c++98 -Wall -Wextra -Werror -g
|
CPPFLAGS = -std=c++98 -Wall -Wextra -Werror -g
|
||||||
SRCDIR = src
|
SRCDIR = src
|
||||||
OBJDIR = obj
|
OBJDIR = obj
|
||||||
NAME = megaphone
|
NAME = ex02
|
||||||
|
|
||||||
SRCS = $(wildcard $(SRCDIR)/*.cpp)
|
SRCS = $(wildcard $(SRCDIR)/*.cpp)
|
||||||
OBJS = $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS))
|
OBJS = $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS))
|
||||||
@ -10,6 +10,7 @@ OBJS = $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS))
|
|||||||
all: $(NAME)
|
all: $(NAME)
|
||||||
|
|
||||||
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
|
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
|
||||||
|
mkdir -p obj
|
||||||
$(CXX) $(CPPFLAGS) -c $< -o $@
|
$(CXX) $(CPPFLAGS) -c $< -o $@
|
||||||
|
|
||||||
$(NAME): $(OBJS)
|
$(NAME): $(OBJS)
|
||||||
|
@ -2,7 +2,7 @@ CXX = c++
|
|||||||
CPPFLAGS = -std=c++98 -Wall -Wextra -Werror -g
|
CPPFLAGS = -std=c++98 -Wall -Wextra -Werror -g
|
||||||
SRCDIR = src
|
SRCDIR = src
|
||||||
OBJDIR = obj
|
OBJDIR = obj
|
||||||
NAME = contacts
|
NAME = ex02
|
||||||
|
|
||||||
SRCS = $(wildcard $(SRCDIR)/*.cpp)
|
SRCS = $(wildcard $(SRCDIR)/*.cpp)
|
||||||
OBJS = $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS))
|
OBJS = $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS))
|
||||||
@ -10,6 +10,7 @@ OBJS = $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS))
|
|||||||
all: $(NAME)
|
all: $(NAME)
|
||||||
|
|
||||||
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
|
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
|
||||||
|
mkdir -p obj
|
||||||
$(CXX) $(CPPFLAGS) -c $< -o $@
|
$(CXX) $(CPPFLAGS) -c $< -o $@
|
||||||
|
|
||||||
$(NAME): $(OBJS)
|
$(NAME): $(OBJS)
|
||||||
|
Loading…
Reference in New Issue
Block a user