petites transformations sur les makefiles

This commit is contained in:
hugogogo
2022-02-27 22:07:04 +01:00
parent c056db80b7
commit 8f6c8259c8
15 changed files with 351 additions and 0 deletions

14
d05/ex00/Bureaucrate.hpp Normal file
View File

@@ -0,0 +1,14 @@
#ifndef BUREAUCRATE_HPP
# define BUREAUCRATE_HPP
class Bureaucrate {
public:
Bureaucrate();
Bureaucrate(std::string name, int grade);
private:
std::string const _name;
int _grade;
}
#endif

71
d05/ex00/Makefile Normal file
View File

@@ -0,0 +1,71 @@
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# . name = value \ . += append to a variable #
# VARIABLES . value . != set result of command #
# . name is case sensitive . ?= set if not already set #
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
NAME = bureaucrate
#CC = gcc
CXX = c++
#CFLAGS = -Wall -Wextra -Werror $(INCLUDES)
CXXFLAGS = -Wall -Wextra -Werror $(INCLUDES) -std=c++98
#EXT = c
EXT = cpp
VPATH = $(D_SRCS)
LIBS =
INCLUDES = -I$(D_HEADERS)
D_SRCS = .
SRCS = main.cpp \
Bureaucrate.cpp
D_HEADERS = .
HEADERS = Bureaucrate.hpp
D_OBJS = builds
OBJS = $(SRCS:%.$(EXT)=$(D_OBJS)/%.o)
ifeq "$(D_OBJS)" "."
RM_OBJS = rm -f $(OBJS)
else
RM_OBJS = rm -rf $(D_OBJS)
endif
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# . target: prerequisites . $@ : target #
# RULES . recipe . $< : 1st prerequisite #
# . recipe . $^ : all prerequisites #
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
all: $(NAME)
$(D_OBJS)/%.o: %.$(EXT) | $(D_OBJS)
# $(CC) $(CFLAGS) -c $< -o $@
$(CXX) $(CXXFLAGS) -c $< -o $@
$(D_OBJS):
mkdir $@
$(OBJS): $(HEADERS:%=$(D_HEADERS)/%)
$(NAME): $(OBJS)
# $(CC) $(OBJS) -o $@ $(LIBS)
$(CXX) $(OBJS) -o $@ $(LIBS)
clean:
$(RM_OBJS)
fclean: clean
rm -f $(NAME)
re: fclean all
.PHONY : all clean fclean re

10
d05/ex00/main.cpp Normal file
View File

@@ -0,0 +1,10 @@
int main() {
try
{
}
catch (std::exception & e)
{
}
}