diff --git a/.gitignore b/.gitignore index 6aea462..d705156 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,7 @@ Thumbs.db builds/ Colleen Grace +Sully +Colleen_*.c +Grace_*.c +Sully_*.c diff --git a/1_Colleen/Makefile b/1_Colleen/Makefile index 264d4d3..1ade035 100644 --- a/1_Colleen/Makefile +++ b/1_Colleen/Makefile @@ -1,5 +1,8 @@ -NAME = Colleen -SRCS = Colleen.c +NAME = Colleen +SRCS = Colleen.c +CLONE = $(NAME)_kid.c +CREATE_CLONE = ./$(NAME) > $(CLONE) include ../MakefileCommon + diff --git a/2_Grace/Makefile b/2_Grace/Makefile index 93dc7f8..4a9495a 100644 --- a/2_Grace/Makefile +++ b/2_Grace/Makefile @@ -1,5 +1,8 @@ -NAME = Grace -SRCS = Grace.c +NAME = Grace +SRCS = Grace.c +CLONE = $(NAME)_kid.c +CREATE_CLONE = ./$(NAME) > $(CLONE) include ../MakefileCommon + diff --git a/2_Grace/tmp_Grace.c b/2_Grace/tmp_Grace.c deleted file mode 100644 index eb53d15..0000000 --- a/2_Grace/tmp_Grace.c +++ /dev/null @@ -1,14 +0,0 @@ -/*comment outside*/ -#include -#define not_main main - -char *second_function() { - return "/*comment outside*/%c#include %c#define not_main main%c%cchar *second_function() {%c return %c%s%c;%c}%c%cint not_main() {%c /*comment inside*/%c char *program = second_function();%c printf(program, 10, 10, 10, 10, 10, 34, program, 34, 10, 10, 10, 10, 10, 10, 10, 10, 10);%c return 0;%c}%c"; -} - -int not_main() { - /*comment inside*/ - char *program = second_function(); - printf(program, 10, 10, 10, 10, 10, 34, program, 34, 10, 10, 10, 10, 10, 10, 10, 10, 10); - return 0; -} diff --git a/MakefileCommon b/MakefileCommon index 4905ff8..29620e1 100644 --- a/MakefileCommon +++ b/MakefileCommon @@ -31,8 +31,10 @@ RESET = "\e[0m" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # FILES : -#NAME -> defined in subfolder makefiles -#SRCS -> defined in subfolder makefiles +#NAME -> defined in subfolder makefiles +#SRCS -> defined in subfolder makefiles +#CLONE -> defined in subfolder makefiles +#CREATE_CLONE -> defined in subfolder makefiles LIBS = D_SRCS = . D_HEADERS = . @@ -55,7 +57,6 @@ ifeq "$(D_OBJS)" "." else RM_OBJS = rm -rf $(D_OBJS) endif -F_DIFF = tmp_$(NAME).c # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # @@ -89,21 +90,17 @@ $(NAME): $(OBJS) leaks: $(NAME) valgrind --leak-check=full --show-leak-kinds=all ./$(NAME) -diff_clean: - rm $(F_DIFF) -diff_exec: +diff: $(NAME) @echo $(CYAN)"compare source with output :"$(RESET) - ./$(NAME) > $(F_DIFF) - - diff --color $(F_DIFF) $(SRCS); \ - if [ $$? -eq 0 ]; then echo $(GREEN)"Files $(NAME) and $(SRCS) are identical"$(RESET); else echo $(RED)":Files $(NAME) and $(SRCS) differ"$(RESET); fi -diff: $(NAME) diff_exec diff_clean -diff_keep: $(NAME) diff_exec + $(CREATE_CLONE) + - diff --color $(CLONE) $(SRCS); \ + if [ $$? -eq 0 ]; then echo $(GREEN)"Files $(SRCS) and $(CLONE) are identical"$(RESET); else echo $(RED)":Files $(NAME) and $(SRCS) differ"$(RESET); fi clean: $(RM_OBJS) - fclean: clean rm -f $(NAME) + rm -f $(CLONE) re: fclean all