mirror of
https://github.com/DavidGailleton/42-Push_Swap.git
synced 2026-01-27 08:41:58 +00:00
Makefile base
This commit is contained in:
24
Makefile
24
Makefile
@@ -69,7 +69,19 @@ DEP = $(OBJ:.o=.d)
|
|||||||
# BONUS CONFIG
|
# 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
|
.PHONY: all clean fclean re
|
||||||
|
|
||||||
@@ -81,6 +93,12 @@ $(NAME): $(OBJ)
|
|||||||
@echo "======= PUSH SWAP COMPILED ========="
|
@echo "======= PUSH SWAP COMPILED ========="
|
||||||
@echo "===================================="
|
@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)
|
$(OBJ_DIR)/%.o: $(PARS_DIR)/%.c | $(OBJ_DIR)
|
||||||
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
|
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
|
||||||
|
|
||||||
@@ -111,6 +129,12 @@ $(OBJ_DIR)/%.o: $(CHECKER_DIR)/%.c | $(OBJ_DIR)
|
|||||||
$(OBJ_DIR)/%.o: %.c | $(OBJ_DIR)
|
$(OBJ_DIR)/%.o: %.c | $(OBJ_DIR)
|
||||||
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
|
$(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):
|
$(OBJ_DIR):
|
||||||
@mkdir -p $(OBJ_DIR)
|
@mkdir -p $(OBJ_DIR)
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
|
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2026/01/09 11:46:36 by dgaillet #+# #+# */
|
/* 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 "parsing.h"
|
||||||
#include "get_next_line.h"
|
#include "get_next_line.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
static int apply_operation(t_stacks *stacks, char buf[1024])
|
static int apply_operation(t_stacks *stacks, char buf[1024])
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
|
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2026/01/09 11:05:37 by dgaillet #+# #+# */
|
/* 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;
|
total_pairs += 1;
|
||||||
if (strs[i] > strs[j])
|
if (strs[i] > strs[j])
|
||||||
mistakes += 1;
|
mistakes += 1;
|
||||||
|
j++;
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
return (mistakes / total_pairs);
|
return (mistakes / total_pairs);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user