wip better makefile

This commit is contained in:
asus
2024-01-23 16:14:28 +01:00
parent 25fadd05a0
commit 3c1d9f0c3c
5 changed files with 23 additions and 30 deletions

4
.gitignore vendored
View File

@@ -52,3 +52,7 @@ Thumbs.db
builds/
Colleen
Grace
Sully
Colleen_*.c
Grace_*.c
Sully_*.c

View File

@@ -1,5 +1,8 @@
NAME = Colleen
SRCS = Colleen.c
NAME = Colleen
SRCS = Colleen.c
CLONE = $(NAME)_kid.c
CREATE_CLONE = ./$(NAME) > $(CLONE)
include ../MakefileCommon

View File

@@ -1,5 +1,8 @@
NAME = Grace
SRCS = Grace.c
NAME = Grace
SRCS = Grace.c
CLONE = $(NAME)_kid.c
CREATE_CLONE = ./$(NAME) > $(CLONE)
include ../MakefileCommon

View File

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

View File

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