Probando cosas con Makefile

This commit is contained in:
Leonardo Algarra 2025-10-01 21:16:10 +02:00
parent 3c8918372e
commit 7f3ea7936f

View file

@ -6,11 +6,12 @@
# By: lalgarra <lalgarra@student.42madrid.com> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2025/09/29 11:35:48 by lalgarra #+# #+# #
# Updated: 2025/09/29 17:42:30 by lalgarra ### ########.fr #
# Updated: 2025/10/01 21:14:37 by lalgarra ### ########.fr #
# #
# **************************************************************************** #
LIBDIR = ../repo_libft_algarra
#LIBDIR = ../repo_libft_algarra
LIBDIR = ../repo_algarra
#CFLAGS += -Wall -Wextra -Werror -g3 -fsanitize=address
CFLAGS += -Wall -Wextra -Werror -g3 -iquote $(LIBDIR) -L$(LIBDIR) -lft
@ -18,17 +19,46 @@ TESTS:= isalpha_test isdigit_test isalnum_test isascii_test
all: $(TESTS)
run: all
$(foreach E, $(TESTS), \
$(eval X = $(subst _test,_expected.output,$(E))) \
$(eval A = $(subst _test,_actual.output,$(E))) \
echo "SALIDA $(E)" > $(A); ./$(E) >> $(A); \
diff -a $(X) $(A) | less; \
)
#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))) \
rm -f $(E) $(A); \
)
#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)))