Compare commits

...

2 commits

Author SHA1 Message Date
lalgarra
61486dac3a Functional Makefile done 2025-10-03 18:11:03 +02:00
lalgarra
2d02955697 Simplificando recipe para 'fclean' 2025-10-03 17:45:39 +02:00

View file

@ -5,26 +5,25 @@
# +:+ +:+ +:+ #
# By: lalgarra <lalgarra@student.42madrid.com> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2025/09/29 11:35:48 by lalgarra #+# #+# #
# Updated: 2025/10/01 21:14:37 by lalgarra ### ########.fr #
# Created: 2025/10/03 18:03:12 by lalgarra #+# #+# #
# Updated: 2025/10/03 18:10:11 by lalgarra ### ########.fr #
# #
# **************************************************************************** #
# Location of your libft.a; it must already exist
LIBDIR = ../repo_libft_algarra
#LIBDIR = ../repo_algarra
#CFLAGS += -Wall -Wextra -Werror -g3 -fsanitize=address
CFLAGS += -Wall -Wextra -Werror -g3 -iquote $(LIBDIR) -L$(LIBDIR) -lft
TESTS:= isalpha_test isdigit_test isalnum_test isascii_test
%_actual.output : %_test
./$*_test > ./$*_actual.output ;
#%_report : %_test %_actual.output
# $(shell diff -a $*_expected.output $*_actual.output > $*_report )
@./$*_test > ./$*_actual.output ;
%_report : %_test %_actual.output
-(diff -a $*_expected.output $*_actual.output && echo "Test OK") > $*_report
-(diff -a $*_expected.output $*_actual.output && \
echo "Test OK") > $*_report
EXES = $(TESTS)
@ -34,62 +33,17 @@ ACT_REPORTS = $(TESTS:_test=_report)
.SECONDARY = $(ACT_REPORTS) $(ACT_OUTPUTS)
# Rule to create a 'report' file with info about the execution of
# tests in $(TEST)
report : $(EXES) $(ACT_OUTPUTS) $(ACT_REPORTS)
rm -f report ;
$(foreach E, $(TESTS), \
@rm -f report ;
@$(foreach E, $(TESTS), \
$(eval T = $(subst _test,,$(E))) \
$(eval R = $(subst _test,_report,$(E))) \
echo "=== $(T) ===" >> report ; \
cat $(R) >> report ; \
)
#all: $(TESTS)
#build_output: all
# $(foreach E, $(TESTS), \
# $(eval A = $(subst _test,_actual.output,$(E))) \
# ./$(E) > $(A); \
# )
#
#run: build_output
# echo "=== PRUEBAS ==="
# $(foreach E, $(TESTS), \
# $(eval A = $(subst _test,_actual.output,$(E))) \
# $(eval X = $(subst _test,_expected.output,$(E))) \
# $(shell diff -a $(X) $(A)) \
# $(eval R = ok) \
# $(eval R = $(if $(.SHELLSTATUS), NOK)) \
# echo "$(E) $(.SHELLSTATUS) - $(R) \n" \
# )
#
fclean:
$(foreach E, $(TESTS), \
$(eval A = $(subst _test,_actual.output,$(E))) \
$(eval R = $(subst _test,_report,$(E))) \
rm -f $(E) $(A) $(R) \
)
rm -f report
#runmal:
# $(foreach E, $(TESTS), \
# $(eval X = $(subst _test,_expected.output,$(E))) \
# $(eval A = $(subst _test,_actual.output,$(E))) \
# $(eval R = $(shell diff -a $(X) $(A))) \
# $(if $(R), $(shell echo "$(E) NOK"), $(shell echo "$(E) ok")) \
# )
#
##foo: TESTS
#%_actual.output : %_test
# ./$*_test > ./$*_actual.output
# echo ha intentado generar actual
#
#run_%: %_actual.output
# $(shell diff -a $*_expected.output $*_actual.output )
# $(info $(.SHELLSTATUS))
# $(let R , $(intcmp 0, $(.SHELLSTATUS), ok, nok), $(info $(R)))
#
rm -f report $(ACT_REPORTS) $(ACT_OUTPUTS) $(EXES)