You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.1KB

  1. NAME = minishell
  2. CC = gcc
  3. CFLAGS = -Wall -Wextra -Werror -fsanitize=address
  4. SRC_NAME = main.c \
  5. command/cmd_cd_util.c \
  6. command/cmd_cd.c \
  7. command/cmd_echo.c \
  8. command/cmd_env.c \
  9. command/cmd_exit.c \
  10. command/cmd_export_util.c \
  11. command/cmd_export.c \
  12. command/cmd_pwd.c \
  13. command/cmd_unset.c \
  14. refine_command/redirection_error.c \
  15. refine_command/redirection_util.c \
  16. refine_command/redirection.c \
  17. refine_command/refine_identifier_util.c \
  18. refine_command/refine_identifier.c \
  19. refine_command/refine_prev_return.c \
  20. refine_command/refine_save.c \
  21. refine_command/refine_util.c \
  22. refine_command/refine.c \
  23. utils/check_syntax_utils.c \
  24. utils/check_syntax.c \
  25. utils/is_quote.c \
  26. utils/print_error.c \
  27. utils/split.c \
  28. utils/string_array_util.c \
  29. utils/string_array.c \
  30. utils/token.c \
  31. variable/variable_clear.c \
  32. variable/variable_clone.c \
  33. variable/variable_query.c \
  34. variable/variable_util.c \
  35. variable/variable_util_env.c \
  36. variable/variable_util_key.c \
  37. variable/variable.c \
  38. cmd.c \
  39. execute_builtin.c \
  40. execute_cmd.c \
  41. execute_line.c \
  42. execute_utils.c \
  43. find_cmd_path.c \
  44. get_verified_input.c \
  45. prepare_line.c \
  46. print_promt.c \
  47. ready_to_execute.c \
  48. run_one_cmd.c \
  49. run_many_cmd.c \
  50. shell.c \
  51. signal.c
  52. SRC_DIR = srcs/
  53. SRC = $(addprefix $(SRC_DIR), $(SRC_NAME))
  54. OBJ_NAME = $(SRC_NAME:.c=.o)
  55. OBJ_DIR = objs/
  56. OBJ = $(addprefix $(OBJ_DIR), $(OBJ_NAME))
  57. INCS = ./includes
  58. INC = $(addprefix -I, $(INCS))
  59. LIB_DIR = libft/
  60. LIB_INCS = ./libft
  61. LIB_INC = $(addprefix -I, $(LIB_INCS))
  62. LIB_FILE = libft/libft.a
  63. LIB_FLAG = -L./libft -lft
  64. DIRNAME = $(shell dirname $1)
  65. all : $(NAME)
  66. $(NAME) : $(OBJ) $(LIB_FILE)
  67. $(CC) $(CFLAGS) $(INC) $(LIB_INC) -o $@ $(OBJ) $(LIB_FLAG)
  68. $(OBJ_DIR)%.o: $(SRC_DIR)%.c
  69. @mkdir -p $(call DIRNAME, $@) 2> /dev/null || true
  70. $(CC) $(CFLAGS) $(INC) $(LIB_INC) -o $@ -c $^
  71. $(LIB_FILE) :
  72. @make -C $(call DIRNAME, $@)
  73. clean :
  74. rm -rf $(OBJ_DIR)
  75. fclean : clean
  76. rm -rf $(NAME)
  77. re : fclean all
  78. norminette :
  79. norminette ./srcs ./includes $(LIB_DIR)
  80. .PHONY : clean fclean re norminette all