wip makefil diff

This commit is contained in:
asus
2024-01-23 13:52:04 +01:00
parent 32ffbc3341
commit babec0044c
2 changed files with 40 additions and 1 deletions

View File

@@ -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)

14
1_Colleen/tmp_Colleen Normal file
View File

@@ -0,0 +1,14 @@
/*comment outside*/
#include <stdio.h>
char *second_function() {
return "/*comment outside*/%c#include <stdio.h>%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;
}