diff --git a/1_Colleen/Makefile b/1_Colleen/Makefile index 2e0a584..cb73354 100644 --- a/1_Colleen/Makefile +++ b/1_Colleen/Makefile @@ -61,7 +61,6 @@ else RM_OBJS = rm -rf $(D_OBJS) endif - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # . target: prerequisites . $@ : target # # RULES . recipe . $< : 1st prerequisite # @@ -93,6 +92,32 @@ $(NAME): $(OBJS) leaks: $(NAME) valgrind --leak-check=full --show-leak-kinds=all ./$(NAME) +#diff: $(NAME) +# @echo $(CYAN)"compare source with output :"$(RESET) +# @echo "diff --color --report-identical-files tmp_$(NAME) $(SRCS)" +# @diff_output=$$(diff --color --report-identical-files tmp_$(NAME) $(SRCS)); \ +# diff_exit=$$?; \ +# diff_color=$(RED); \ +# if [ "$$diff_exit" -eq 0 ]; then diff_color=$(GREEN); fi; \ +# echo $$diff_color"$$diff_output"$(RESET); + +# old diff version : +#diff: $(NAME) +# @echo $(CYAN)"compare source with output :"$(RESET) +# ./$(NAME) > tmp_$(NAME) +# - diff --color --report-identical-files tmp_$(NAME) $(SRCS) +# rm tmp_$(NAME) + +diff: + @echo $(CYAN)"compare source with output :"$(RESET) + - diff --color tmp_$(NAME) $(SRCS); \ + if [ $$? -eq 0 ]; then echo $(GREEN)"Files $(NAME) and $(SRCS) are identical"$(RESET); fi + +#diff: +# @echo $(CYAN)"compare source with output :"$(RESET) +# $(shell diff --color tmp_$(NAME) $(SRCS) ) +# @if [ $(.SHELLSTATUS) -eq 0 ]; then echo $(GREEN)"Files $(NAME) and $(SRCS) are identical"$(RESET); fi + clean: $(RM_OBJS) diff --git a/1_Colleen/tmp_Colleen b/1_Colleen/tmp_Colleen new file mode 100644 index 0000000..6bb97ab --- /dev/null +++ b/1_Colleen/tmp_Colleen @@ -0,0 +1,14 @@ +/*comment outside*/ +#include + +char *second_function() { + return "/*comment outside*/%c#include %c%cchar *second_function() {%c return %c%s%c;%c}%c%cint main() {%c /*comment inside*/%c char *program = second_function();%c printf(program, 10, 10, 10, 10, 34, program, 34, 10, 10, 10, 10, 10, 10, 10, 10, 10);%c return 0;%c}%c"; +} + + +int main() { + /*comment inside*/ + char *program = second_function(); + printf(program, 10, 10, 10, 10, 34, program, 34, 10, 10, 10, 10, 10, 10, 10, 10, 10); + return 0; +}