makefile ok et ex00 d00 ok
This commit is contained in:
61
d00/ex00/Makefile
Normal file
61
d00/ex00/Makefile
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
||||||
|
# . name = value . name is case sensitive #
|
||||||
|
# VARIABLES . or name = value \ . use VPATH only for .c #
|
||||||
|
# . value . #
|
||||||
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
||||||
|
|
||||||
|
NAME = megaphone
|
||||||
|
|
||||||
|
CC = clang++
|
||||||
|
CFLAGS = -Wall -Wextra -Werror $(INCLUDES) -std=c++98
|
||||||
|
|
||||||
|
VPATH = $(D_SRCS)
|
||||||
|
|
||||||
|
LIBS =
|
||||||
|
|
||||||
|
INCLUDES = -I$(D_HEADERS)
|
||||||
|
|
||||||
|
D_HEADERS = .
|
||||||
|
HEADERS =
|
||||||
|
|
||||||
|
D_SRCS = .
|
||||||
|
SRCS = megaphone.cpp
|
||||||
|
|
||||||
|
D_OBJS = builds
|
||||||
|
OBJS = $(SRCS:%.cpp=$(D_OBJS)/%.o)
|
||||||
|
|
||||||
|
RM_D_OBJS = rm -rf $(D_OBJS)
|
||||||
|
ifeq "$(D_OBJS)" "."
|
||||||
|
RM_D_OBJS =
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
||||||
|
# . target: prerequisites . $@ : target #
|
||||||
|
# RULES . recipe . $< : 1st prerequisite #
|
||||||
|
# . recipe . $^ : all prerequisites #
|
||||||
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
||||||
|
|
||||||
|
all: $(NAME)
|
||||||
|
|
||||||
|
$(D_OBJS)/%.o: %.cpp | $(D_OBJS)
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(D_OBJS):
|
||||||
|
mkdir $@
|
||||||
|
|
||||||
|
$(OBJS): $(HEADERS:%=$(D_HEADERS)/%)
|
||||||
|
|
||||||
|
$(NAME): $(OBJS)
|
||||||
|
$(CC) $(OBJS) -o $@ $(LIBS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJS)
|
||||||
|
|
||||||
|
fclean: clean
|
||||||
|
rm -f $(NAME)
|
||||||
|
$(RM_D_OBJS)
|
||||||
|
|
||||||
|
re: fclean all
|
||||||
|
|
||||||
|
.PHONY : all clean fclean re bonus run valgrind
|
||||||
13
d00/ex00/megaphone.cpp
Normal file
13
d00/ex00/megaphone.cpp
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main(int ac, char **av)
|
||||||
|
{
|
||||||
|
if (ac < 2)
|
||||||
|
std::cout << std::uppercase << "* LOUD AND UNBEARABLE FEEDBACK NOISE *";
|
||||||
|
else
|
||||||
|
for (int i = 1; av[i] != NULL; i++)
|
||||||
|
for (int j = 0; av[i][j] != '\0'; j++)
|
||||||
|
std::cout << (char)toupper(av[i][j]);
|
||||||
|
std::cout << std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
13
d00/megaphone.cpp
Normal file
13
d00/megaphone.cpp
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main(int ac, char **av)
|
||||||
|
{
|
||||||
|
if (ac < 2)
|
||||||
|
std::cout << std::uppercase << "shhhhh... I think the students are asleep...";
|
||||||
|
else
|
||||||
|
for (int i = 1; av[i] != NULL; i++)
|
||||||
|
for (int j = 0; av[i][j] != '\0'; j++)
|
||||||
|
std::cout << (char)toupper(av[i][j]);
|
||||||
|
std::cout << std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user