libft_testing/Makefile
2025-10-03 17:45:39 +02:00

46 lines
1.7 KiB
Makefile

# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# 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 #
# #
# **************************************************************************** #
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
-(diff -a $*_expected.output $*_actual.output && echo "Test OK") > $*_report
EXES = $(TESTS)
ACT_OUTPUTS = $(TESTS:_test=_actual.output)
ACT_REPORTS = $(TESTS:_test=_report)
.SECONDARY = $(ACT_REPORTS) $(ACT_OUTPUTS)
report : $(EXES) $(ACT_OUTPUTS) $(ACT_REPORTS)
rm -f report ;
$(foreach E, $(TESTS), \
$(eval T = $(subst _test,,$(E))) \
$(eval R = $(subst _test,_report,$(E))) \
echo "=== $(T) ===" >> report ; \
cat $(R) >> report ; \
)
fclean:
rm -f report $(ACT_REPORTS) $(ACT_OUTPUTS) $(EXES)