c - Error compiling - makefile - include header -
i have problem can't seem resolve. i'm trying -i
flag add includes list of compiler at. instead of directly looking in /usr/include directory contains standard library, first in include directory header files. doesn't seem find files since long list of kind of error appears when compile:
src/termcaps/termcapbis.c:13:10: fatal error: 'termcaps.h' file not found #include <termcaps.h>
(that 1 example out of multiple errors same thing.)
so i'm wondering if there wrong makefile or if have else compiler understand header files are.
here's makefile:
name = 42sh src_dir = "src" src_dirs = $(shell find $(src_dir) -type d -follow -print) src_files = $(shell find $(src_dirs) -type f -follow -print | grep "\.c") obj_dir = "obj" obj_dirs = $(src_dirs:$(src_dir)%=$(obj_dir)%) obj_files = $(src_files:$(src_dir)%.c=$(obj_dir)%.o) flags = -wall -wextra -werror include = -iinclude -ilibft/include lib = -llibft -lft -ltermcap all: $(name) $(name): $(obj_files) make -c libft gcc $(flags) $^ $(lib) -o $@ $(obj_dir)%.o: $(src_dir)%.c @mkdir -p $(obj_dirs) $(obj_dir) gcc $(flags) $(include) -o $@ -c $< clean: @rm -rf $(obj_dir) @make fclean -c libft fclean: clean @rm -rf $(name) @make fclean -c libft re: fclean $(name) .phony: clean fclean re
any suggestions?
Comments
Post a Comment