get_next_line_testing/Makefile
2025-10-30 18:44:01 +01:00

59 lines
2.2 KiB
Makefile

# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: lalgarra <lalgarra@student.42madrid.com> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2025/10/22 20:41:03 by lalgarra #+# #+# #
# Updated: 2025/10/30 18:42:43 by lalgarra ### ########.fr #
# #
# **************************************************************************** #
NAME = report
# Relative location of sources to test
LIBDIR = ../repo_algarra
TIME = /usr/bin/time
GNL_SOURCES = get_next_line.c get_next_line_utils.c
SOURCES = $(foreach f, $(GNL_SOURCES), $(LIBDIR)/$f)
BONUS_SRC_BN = get_next_line_bonus.c get_next_line_utils_bonus.c
BONUS_SRC = $(foreach f, $(BONUS_SRC_BN), $(LIBDIR)/$f)
CFLAGS += -Wall -Wextra -Werror -g3 -iquote $(LIBDIR) -O0
test001: test001.c $(SOURCES)
$(CC) $(CFLAGS) $+ -o $@
run_test = printf "==\n test001_01: BUFFER_SIZE=$(1): input$(3) vs output$(3)\n" >> $(4) ;\
$(TIME) ./$(2) input$(3) > output$(3) ;\
diff -s input$(3) output$(3) >> $(4) ;
PRG = test_bs$(BUFFER_SIZE)
IDXS = 001 002 003 004 005 006
report_01: BUFFER_SIZE = 42
report_01: test001.c $(SOURCES)
$(CC) $(CFLAGS) -D BUFFER_SIZE=$(BUFFER_SIZE) $+ -o $(PRG)
$(foreach i, $(IDXS), $(call run_test, $(BUFFER_SIZE),$(PRG),$i,$@))
report_02: BUFFER_SIZE = 80
report_02: test001.c $(SOURCES)
$(CC) $(CFLAGS) -D BUFFER_SIZE=$(BUFFER_SIZE) $+ -o $(PRG)
$(foreach i, $(IDXS), $(call run_test, $(BUFFER_SIZE),$(PRG),$i,$@))
report_03: BUFFER_SIZE = 100000
report_03: test001.c $(SOURCES)
$(CC) $(CFLAGS) -D BUFFER_SIZE=$(BUFFER_SIZE) $+ -o $(PRG)
$(foreach i, $(IDXS), $(call run_test, $(BUFFER_SIZE),$(PRG),$i,$@))
fclean:
rm -f test001 test001_01 output* report_* rpt_01 test_bs*
all: report_01 report_02 report_03
re: fclean all