feat(ex00): create Makefile
This commit is contained in:
parent
f58cf157fa
commit
8cfb880a3a
1 changed files with 36 additions and 0 deletions
36
ex00/Makefile
Normal file
36
ex00/Makefile
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
NAME = ex00
|
||||||
|
ifeq ($(CPPFLAGS),)
|
||||||
|
CPPFLAGS = -Wall -Wextra -Werror -std=c++98
|
||||||
|
endif
|
||||||
|
ifeq ($(CXX),)
|
||||||
|
CXX = c++
|
||||||
|
endif
|
||||||
|
# g++ is the default on 42 computers
|
||||||
|
ifeq ($(CXX),g++)
|
||||||
|
CXX = c++
|
||||||
|
endif
|
||||||
|
main_objs = $(addsuffix .o,$(NAME))
|
||||||
|
all_objs = $(main_objs)
|
||||||
|
deps = $(all_objs:.o=.d)
|
||||||
|
|
||||||
|
all: $(NAME)
|
||||||
|
|
||||||
|
-include $(deps)
|
||||||
|
|
||||||
|
$(NAME): $(main_objs)
|
||||||
|
$(CXX) $(CPPFLAGS) -o $@ $^
|
||||||
|
|
||||||
|
%.o: %.cpp
|
||||||
|
$(CXX) -c $(CPPFLAGS) -o $*.o $*.cpp
|
||||||
|
$(CXX) -MM $(CPPFLAGS) -MT $*.o $*.cpp > $*.d
|
||||||
|
|
||||||
|
clean:
|
||||||
|
find . -name '*.o' -print -delete
|
||||||
|
find . -name '*.d' -print -delete
|
||||||
|
|
||||||
|
fclean: clean
|
||||||
|
rm -f $(NAME)
|
||||||
|
|
||||||
|
re:
|
||||||
|
+make fclean
|
||||||
|
+make all
|
||||||
Loading…
Add table
Add a link
Reference in a new issue