#sort_stack Copyright (C) 2026 yctct # #This program is free software: you can redistribute it and/or modify #it under the terms of the GNU General Public License as published by #the Free Software Foundation, either version 3 of the License, or #(at your option) any later version. # #This program is distributed in the hope that it will be useful, #but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #GNU General Public License for more details. # #You should have received a copy of the GNU General Public License #along with this program. If not, see . # Programme name NAME = $(BIN)/push_swap # Directories SRC_DIR = ./src LIB_DIR = ./lib BUILD_DIR = ./build BIN = ./bin # Sources files and object files SRCS = $(addprefix $(SRC_DIR)/, \ main.c \ push.c \ rotate.c \ rrotate.c \ rotate_stacks.c \ swap.c \ sort_two.c \ sort_three.c \ sort_five.c \ sort.c \ helper.c \ ft_lstmin.c \ ft_lstmax.c \ pstack.c \ free.c \ errors.c) OBJS = $(SRCS:%.c=$(BUILD_DIR)/%.o) # Libraries LIB = lib/libft.a DEPS = include/push_swap.h # Compiler and flags #FLAGS = -Wextra -Werror -Wall -g -fsanitize=address FLAGS = -Wextra -Werror -Wall -g # Rules $(BUILD_DIR)/%.o:%.c $(DEPS) mkdir -p $(dir $@) $(CC) -c -o $@ $< $(FLAGS) $(NAME): $(OBJS) $(LIB) mkdir -p $(dir $@) $(CC) -o $@ $^ $(FLAGS) $(LIB): $(MAKE) -C $(LIB_DIR) all: $(NAME) # Cleaning .PHONY: clean fclean re clean: rm -rf $(BUILD_DIR) $(MAKE) -C $(LIB_DIR) clean fclean: clean $(MAKE) -C $(LIB_DIR) fclean rm -f $(NAME) re: fclean all