Makefile(07)_ path search
Path search in 17.Make _ on 17.0. Experimental material
The source file is located in: src directory
Source file: main.c
# include # include "func.h" int main () {foo (); return 0;}
Source file: func.c
# include # include "func.h" void foo () {printf ("void foo ():% s\ n", "Hello, D.T.Software...");}
The header file is located in: inc directory
Header file func.c
# ifndef FUNC_H#define FUNC_Hvoid foo (); # endif17.1. Project source code organization mode
Question: in an actual project, are all the source files and header files in one folder?
In an actual project, the source code and header files are divided according to modules, as shown below:
The makefile in the project must be able to correctly locate the source and dependency files, and eventually compile to produce an executable program.
Lab 1:
Can the following makefile be compiled successfully when the source code organization directory is as follows?
OBJS: = func.o main.ohello.out: $(OBJS) @ gcc-o $@ $^ @ echo "Target File = > $@" $(OBJS):% .o:% .c func.h @ gcc-o $@-c $