Makefile 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. NAME = 21sh
  2. LIB = libft/libft.a
  3. SRC_NAME = main.c \
  4. term.c \
  5. keys.c \
  6. term_edition.c \
  7. term_tools.c \
  8. move_horizontally.c \
  9. history.c \
  10. history_tools.c \
  11. detect_cotes.c \
  12. pipe_redir_parsing.c \
  13. pipe_parsing.c \
  14. parse_redirections.c \
  15. pipe_exec.c \
  16. redirect.c \
  17. heredoc.c \
  18. herething.c \
  19. cmd_splitting.c \
  20. exec.c \
  21. env.c \
  22. tabenv.c \
  23. cd.c \
  24. tools.c \
  25. OBJ_NAME = $(SRC_NAME:.c=.o)
  26. SRC_PATH = src
  27. OBJ_PATH = obj
  28. SRC = $(addprefix $(SRC_PATH)/, $(SRC_NAME))
  29. OBJ = $(addprefix $(SRC_PATH)/, $(OBJ_NAME))
  30. FLAG = -g -Wall -Werror -Wextra -lcurses
  31. all: $(NAME)
  32. $(NAME): $(OBJ)
  33. @make -j4 -C libft
  34. @gcc $(FLAG) $^ $(LIB) -o $@
  35. @echo "21 Shell compiled, now run ./21sh."
  36. $(OBJ_PATH)%.o: $(SRC_PATH)%.c
  37. # @mkdir -p $(OBJ_PATH)
  38. @gcc $(FLAG) -c $< -o $@
  39. clean:
  40. @make -C libft clean
  41. @rm -f $(OBJ)
  42. # @rmdir $(OBJ_PATH)
  43. @echo "21 Shell cleaned."
  44. fclean: clean
  45. @make -C libft fclean
  46. @rm -f $(NAME)
  47. @echo "21 Shell fcleaned."
  48. re: fclean all
  49. run: all
  50. @clear
  51. @./$(NAME)
  52. norm:
  53. @clear
  54. @make -C libft norm
  55. @norminette $(SRC) src/*.h | grep -v "42 header" | grep -B 1 "Error"
  56. test: all
  57. @clear
  58. @./tests.sh
  59. git:
  60. @clear
  61. @git diff
  62. @git diff --color-words=.
  63. @git status
  64. malloc:
  65. @grep -rn ft_ src | grep -v Binary | grep -v binaire | grep -v ft_put | grep -v printf | \
  66. grep -v setenv | grep -v strdel | grep -v ft_is | grep -v strlen | \
  67. grep -v strcmp | grep -v tabsize | grep -v strstr | grep -v strchr | \
  68. grep -v search_pos_char
  69. @grep -rn "malloc(" src
  70. leaks:
  71. @./leaks.sh
  72. .PHONY: all, clean, fclean, re, run, norm, test, git, malloc, leaks