Makefile 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. redirect.c \
  12. heredoc.c \
  13. herething.c \
  14. pipe.c \
  15. cmd_parsing.c \
  16. exec.c \
  17. env.c \
  18. tabenv.c \
  19. cd.c \
  20. tools.c \
  21. # lst.c \
  22. OBJ_NAME = $(SRC_NAME:.c=.o)
  23. SRC_PATH = src
  24. OBJ_PATH = obj
  25. SRC = $(addprefix $(SRC_PATH)/, $(SRC_NAME))
  26. OBJ = $(addprefix $(SRC_PATH)/, $(OBJ_NAME))
  27. FLAG = -Wall -Werror -Wextra -lcurses
  28. all: $(NAME)
  29. $(NAME): $(OBJ)
  30. @make -C libft
  31. @gcc $(FLAG) $^ $(LIB) -o $@
  32. @echo "21 Shell compiled, now run ./21sh."
  33. $(OBJ_PATH)%.o: $(SRC_PATH)%.c
  34. # @mkdir -p $(OBJ_PATH)
  35. @gcc $(FLAG) -c $< -o $@
  36. clean:
  37. @make -C libft clean
  38. @rm -f $(OBJ)
  39. # @rmdir $(OBJ_PATH)
  40. @echo "21 Shell cleaned."
  41. fclean: clean
  42. @make -C libft fclean
  43. @rm -f $(NAME)
  44. @echo "21 Shell fcleaned."
  45. re: fclean all
  46. run: all
  47. @clear
  48. @./$(NAME)
  49. norm:
  50. @clear
  51. @make -C libft norm
  52. @norminette $(SRC) src/*.h | grep -v "42 header" | grep -B 1 "Error"
  53. test: all
  54. @clear
  55. @./tests.sh
  56. git:
  57. @clear
  58. @git diff
  59. @git diff --color-words=.
  60. @git status
  61. .PHONY: all, clean, fclean, re, run, norm, test, git