Browse Source

[enh] Makefile: check objects are update. If note recompile them.

Moul 4 years ago
parent
commit
eb9b580b7e
1 changed files with 10 additions and 10 deletions
  1. 10 10
      Makefile

+ 10 - 10
Makefile

@@ -6,7 +6,7 @@
 #    By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+         #
 #                                                 +#+#+#+#+#+   +#+            #
 #    Created: 2014/11/05 11:09:24 by mazimi            #+#    #+#              #
-#    Updated: 2016/02/19 15:52:22 by mazimi           ###   ########.fr        #
+#    Updated: 2016/02/19 17:59:09 by mazimi           ###   ########.fr        #
 #                                                                              #
 # **************************************************************************** #
 
@@ -89,26 +89,26 @@ OBJ_PATH = obj
 
 OBJ_NAME = $(SRC_NAME:.c=.o)
 
-SRC = $(addprefix src/, $(SRC_NAME))
+SRC = $(addprefix $(SRC_PATH)/, $(SRC_NAME))
 
-OBJ = $(addprefix obj/, $(OBJ_NAME))
+OBJ = $(addprefix $(SRC_PATH)/, $(OBJ_NAME))
 
 FLAG = -Wall -Werror -Wextra
 
 all: $(NAME)
 
-$(NAME):
-	@gcc $(FLAG) -c $(SRC)
-	@ar rc $(NAME) $(OBJ_NAME)
+$(NAME): $(OBJ)
+	@ar rc $(NAME) $(OBJ)
 	@echo "Libft: make: library created."
 
-#$(OBJ_PATH)%.o: $(SRC_PATH)%.c
-#	mkdir $(OBJ_PATH) 2> /dev/null || true
-#	gcc -Wall -Werror -Wextra -c $(SRC) $(OBJ)
+$(OBJ_PATH)%.o: $(SRC_PATH)%.c
+#	@mkdir -p $(OBJ_PATH)
+	@gcc $(FLAG) -c $< -o $@
 
 clean:
-	@rm -f $(OBJ_NAME)
+	@rm -f $(OBJ)
 #	@rmdir $(OBJ_PATH) 2> /dev/null || true
+#	@rm -rf $(OBJ_PATH)
 	@echo "Libft: clean: objects cleaned."
 
 fclean: clean