Browse Source

[mod] use libft as a subtree, fixes:
- move usage of libft as a subtree
- Makefile: fix libft's makefile calling
- fix type.

Moul 4 years ago
parent
commit
7e436be0c2
3 changed files with 9 additions and 11 deletions
  1. 7 9
      Makefile
  2. 1 1
      src/sh.h
  3. 1 1
      src/term_edition.c

+ 7 - 9
Makefile

@@ -1,6 +1,6 @@
 NAME = 21sh
 
-LIB =   ../libft/libft.a
+LIB =   libft/libft.a
 
 SRC_NAME =	main.c \
 			term.c \
@@ -30,27 +30,25 @@ OBJ = $(addprefix $(SRC_PATH)/, $(OBJ_NAME))
 
 FLAG = -Wall -Werror -Wextra -lcurses
 
-all: libft $(NAME)
+all: $(NAME)
 
-$(NAME): $(OBJ) $(LIB)
+$(NAME): $(OBJ)
+	@make -C libft
 	@gcc $(FLAG) $^ $(LIB) -o $@
 	@echo "21 Shell compiled, now run ./21sh."
 
-libft:
-	@make -C ../libft
-
 $(OBJ_PATH)%.o: $(SRC_PATH)%.c
 #	@mkdir -p $(OBJ_PATH)
 	@gcc $(FLAG) -c $< -o $@
 
 clean:
-	@make -C ../libft clean
+	@make -C libft clean
 	@rm -f $(OBJ)
 #	@rmdir $(OBJ_PATH)
 	@echo "21 Shell cleaned."
 
 fclean: clean
-	@make -C ../libft fclean
+	@make -C libft fclean
 	@rm -f $(NAME)
 	@echo "21 Shell fcleaned."
 
@@ -62,7 +60,7 @@ run: all
 
 norm:
 	@clear
-	@make -C ../libft norm
+	@make -C libft norm
 	@norminette $(SRC) src/*.h |  grep -v "42 header" | grep -B 1 "Error"
 
 test: all

+ 1 - 1
src/sh.h

@@ -1,6 +1,6 @@
 #ifndef SH_H
 # define SH_H
-# include "../../libft/libft.h"
+# include "../libft/libft.h"
 # include "struct.h"
 # include "term.h"
 # include <stdlib.h>

+ 1 - 1
src/term_edition.c

@@ -17,7 +17,7 @@ void	insert(t_e *e)
 	snd = ft_strsub(e->cmd, e->pos, e->len);
 	e->cmd[e->pos] = '\0';
 	e->cmd = ft_strjoin(e->cmd, e->key);
-	if (e->col_nbr != NULL)
+	if (e->col_nbr != 0)
 		e->linep = (e->plen + e->pos) / e->col_nbr;
 }