avoid repetition in main makefile

This commit is contained in:
asus
2024-01-23 16:25:03 +01:00
parent f7e08d5f5b
commit f8e9a9b8b7

View File

@@ -33,43 +33,36 @@ RESET = "\e[0m"
D_QUINES = ./1_Colleen \
./2_Grace
RULE = all
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# . target: prerequisites . $@ : target #
# RULES . recipe . $< : 1st prerequisite #
# . recipe . $^ : all prerequisites #
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
all: $(D_QUINES)
@for dir in $^; do \
echo $(B_GREEN)"compile $$dir"$(RESET); \
$(MAKE) -C $$dir; \
done
all:
@$(MAKE) RULE=$@ loop
diff: $(D_QUINES)
@for dir in $^; do \
echo $(B_CYAN)"diff $$dir"$(RESET); \
$(MAKE) diff -C $$dir; \
done
diff:
@$(MAKE) RULE=$@ loop
leaks: $(D_QUINES)
@for dir in $^; do \
echo $(B_YELLOW)"leaks $$dir"$(RESET); \
$(MAKE) leaks -C $$dir; \
done
leaks:
@$(MAKE) RULE=$@ loop
clean: $(D_QUINES)
@for dir in $^; do \
echo $(B_YELLOW)"clean $$dir"$(RESET); \
$(MAKE) clean -C $$dir; \
done
clean:
@$(MAKE) RULE=$@ loop
fclean: $(D_QUINES)
fclean:
@$(MAKE) RULE=$@ loop
loop: $(D_QUINES)
@for dir in $^; do \
echo $(B_PURPLE)"fclean $$dir"$(RESET); \
$(MAKE) fclean -C $$dir; \
echo $(B_GREEN)"$(RULE) $$dir"$(RESET); \
$(MAKE) $(RULE) -C $$dir; \
done
re: fclean all
.PHONY : all clean fclean re
.PHONY : all clean fclean re loop