61 lines
2.3 KiB
Makefile
61 lines
2.3 KiB
Makefile
# **************************************************************************** #
|
|
# #
|
|
# ::: :::::::: #
|
|
# Makefile :+: :+: :+: #
|
|
# +:+ +:+ +:+ #
|
|
# By: lalgarra <lalgarra@student.42madrid.com> +#+ +:+ +#+ #
|
|
# +#+#+#+#+#+ +#+ #
|
|
# Created: 2025/10/03 18:03:12 by lalgarra #+# #+# #
|
|
# Updated: 2025/10/08 20:35:23 by lalgarra ### ########.fr #
|
|
# #
|
|
# **************************************************************************** #
|
|
|
|
# Location of your libft.a; it must already exist
|
|
LIBDIR = ../repo_libft_algarra
|
|
#LIBDIR = ../vogsphere_repo
|
|
|
|
CFLAGS += -Wall -Wextra -Werror -g3 -iquote $(LIBDIR) \
|
|
# -fsanitize=address -Wanalyzer-malloc-leak
|
|
|
|
TESTS := ft_isalpha_test ft_isdigit_test ft_isalnum_test ft_isascii_test \
|
|
ft_isprint_test ft_toupper_test ft_tolower_test ft_strlen_test \
|
|
ft_memset_test ft_bzero_test ft_memcpy_test ft_calloc_test \
|
|
ft_memmove_test ft_strlcpy_test ft_strlcat_test ft_strchr_test \
|
|
ft_strrchr_test ft_strncmp_test ft_memcmp_test ft_strnstr_test \
|
|
ft_atoi_test ft_substr_test ft_strjoin_test
|
|
|
|
%_test : %_test.c
|
|
$(CC) $(CFLAGS) $*_test.c -L$(LIBDIR) -lft -o $*_test
|
|
|
|
%_actual.output : %_test
|
|
@./$*_test 2>&1 > ./$*_actual.output ;
|
|
|
|
#alternative command
|
|
# @script -qc './$*_test &> ./$*_actual.output' 2> ./$*_actual.output 1> /dev/null
|
|
|
|
%_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)
|
|
|
|
# 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), \
|
|
$(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)
|
|
|