diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7cc3798 --- /dev/null +++ b/Makefile @@ -0,0 +1,78 @@ +#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 <https://www.gnu.org/licenses/>. + +# 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 + |
