Makefile base

This commit is contained in:
2026-01-09 14:52:16 +01:00
parent 319ed2521e
commit 929d7d4da5
3 changed files with 29 additions and 2 deletions

View File

@@ -69,7 +69,19 @@ DEP = $(OBJ:.o=.d)
# BONUS CONFIG
#============================
BONUS_DIR = bonus
GNL_DIR = bonus/GNL
BONUS_FILES = $(BONUS_DIR)/ft_bzero.c $(BONUS_DIR)/checker_bonus.c
GNL_FILES = $(GNL_DIR)/get_next_line.c $(GNL_DIR)/get_next_line_utils.c
ALL_BONUS_FILES = $(BONUS_FILES) $(GNL_FILES)
BONUS_OBJ = $(addprefix $(OBJ_DIR)/, $(notdir $(ALL_BONUS_FILES:.c=.o)))
BONUS = checker
.PHONY: all clean fclean re
@@ -81,6 +93,12 @@ $(NAME): $(OBJ)
@echo "======= PUSH SWAP COMPILED ========="
@echo "===================================="
$(BONUS): $(BONUS_OBJ)
@$(CC) $(CFLAGS) -I$(GNL_DIR) $(BONUS_OBJ) -o $(BONUS)
@echo "===================================="
@echo "======= PUSH SWAP COMPILED ========="
@echo "===================================="
$(OBJ_DIR)/%.o: $(PARS_DIR)/%.c | $(OBJ_DIR)
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
@@ -111,6 +129,12 @@ $(OBJ_DIR)/%.o: $(CHECKER_DIR)/%.c | $(OBJ_DIR)
$(OBJ_DIR)/%.o: %.c | $(OBJ_DIR)
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
$(OBJ_DIR)/%.o: $(BONUS_DIR)%.c | $(OBJ_DIR)
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
$(OBJ_DIR)/%.o: $(GNL_DIR)%.c | $(OBJ_DIR)
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
$(OBJ_DIR):
@mkdir -p $(OBJ_DIR)

View File

@@ -6,7 +6,7 @@
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/09 11:46:36 by dgaillet #+# #+# */
/* Updated: 2026/01/09 14:40:06 by dgaillet ### ########lyon.fr */
/* Updated: 2026/01/09 14:51:32 by dgaillet ### ########lyon.fr */
/* */
/* ************************************************************************** */
@@ -14,6 +14,7 @@
#include "parsing.h"
#include "get_next_line.h"
#include <unistd.h>
#include <stdlib.h>
static int apply_operation(t_stacks *stacks, char buf[1024])
{

View File

@@ -6,7 +6,7 @@
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/09 11:05:37 by dgaillet #+# #+# */
/* Updated: 2026/01/09 11:26:24 by dgaillet ### ########lyon.fr */
/* Updated: 2026/01/09 14:35:14 by dgaillet ### ########lyon.fr */
/* */
/* ************************************************************************** */
@@ -40,7 +40,9 @@ float compute_disorder(char **strs)
total_pairs += 1;
if (strs[i] > strs[j])
mistakes += 1;
j++;
}
i++;
}
return (mistakes / total_pairs);
}