diff --git a/Makefile b/Makefile index 94d4886..7adf9ec 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: lalgarra +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2025/10/22 20:41:03 by lalgarra #+# #+# # -# Updated: 2025/10/30 18:42:43 by lalgarra ### ########.fr # +# Updated: 2025/10/30 19:00:00 by lalgarra ### ########.fr # # # # **************************************************************************** # @@ -21,10 +21,6 @@ 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) @@ -34,26 +30,39 @@ run_test = printf "==\n test001_01: BUFFER_SIZE=$(1): input$(3) vs output$(3)\n" $(TIME) ./$(2) input$(3) > output$(3) ;\ diff -s input$(3) output$(3) >> $(4) ; +test_recipe = $(CC) $(CFLAGS) -D BUFFER_SIZE=$(BUFFER_SIZE) $+ -o $(PRG) ; \ + $(foreach i, $(IDXS), $(call run_test, $(BUFFER_SIZE),$(PRG),$i,$@)) + 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,$@)) + $(call test_recipe) 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,$@)) + $(call test_recipe) 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,$@)) + $(call test_recipe) + +report_04: BUFFER_SIZE = 1 +report_04: test001.c $(SOURCES) + $(call test_recipe) + +BONUS_SRC_BN = get_next_line_bonus.c get_next_line_utils_bonus.c + +BONUS_SRC = $(foreach f, $(BONUS_SRC_BN), $(LIBDIR)/$f) + +bonus_01: BUFFER_SIZE = 42 +bonus_01: test001.c $(BONUS_SRC) + $(call test_recipe) fclean: - rm -f test001 test001_01 output* report_* rpt_01 test_bs* + rm -f test001 test001_01 output* report_* rpt_01 test_bs* bonus_* -all: report_01 report_02 report_03 +all: report_01 report_02 report_03 report_04 re: fclean all