ex00: it works!
This commit is contained in:
commit
6d4b5788d7
16 changed files with 318 additions and 0 deletions
49
ex00/Makefile
Normal file
49
ex00/Makefile
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
NAME = ex00
|
||||
ifeq ($(CPPFLAGS),)
|
||||
CPPFLAGS = -Wall -Wextra -Werror -std=c++98 -ggdb -fsanitize=address,undefined
|
||||
endif
|
||||
ifeq ($(CXX),)
|
||||
CXX = c++
|
||||
endif
|
||||
# g++ is the default on 42 computers
|
||||
ifeq ($(CXX),g++)
|
||||
CXX = c++
|
||||
endif
|
||||
srcs = \
|
||||
Animal.cpp \
|
||||
Cat.cpp \
|
||||
Dog.cpp \
|
||||
WrongAnimal.cpp \
|
||||
WrongDog.cpp \
|
||||
WrongCat.cpp \
|
||||
|
||||
main_objs = main.o $(srcs:.cpp=.o)
|
||||
all_objs = $(main_objs)
|
||||
deps = $(all_objs:.o=.d)
|
||||
|
||||
.PHONY: all clean fclean re run
|
||||
|
||||
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
|
||||
|
||||
run: $(NAME)
|
||||
./$(NAME)
|
||||
Loading…
Add table
Add a link
Reference in a new issue