Makefile 1.2 KB

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