Makefile 1.1 KB

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