Embedded system development study notes (5)

Last review

Embedded system development study notes (4)

Embedded system development

Enterprise-level Makefile writing

file name

1. myhead: header file
2. Master control Makefile: enter each function subdirectory to execute the make command, and generate executable files for all .o files
3. scripts: script files
4. Function directory Makefile: change all the files in the function directory .c files are compiled into .o files
5. Script directory Makefile: define variables used by other Makefile files
Read the Makefile order: 5–>2–>4

Function description

Insert picture description here

1. Define wildcard function
.
Example of dollar sign (wildcard space mode parameter) : result: space = dollar sign (wildcard space *.c)
result All .c files in the current directory
2. Define pathsubst
dollar sign (pathsubst space mode parameter, parameter 1. Parameter 2)
Example: result: space dollar sign (pathsubst space %.c, %.o, xc, yc)
result: =xo, yo
3, := (to prevent infinite loops)
a1 :=ao
a2: =dollar sign (a1)bo
a1 :=ao a2 = ao bo
a1 :=dollar sign (a2) bo
a2 :=ao
a1 = bo a2 = ao
4, +=
a1 =ao
a1 += bo
a1 = ao bo
a1 = ao
a1 := dollar sign (a1) bo
a1 = ao bo
5. Dollar sign (addsuffix parameter 1, parameter 2)
result:= dollar sign (addsuffix .c, xy)
result = xc yc

Insert picture description here

6. Foreach
dollar sign (foreach variable parameter, parameter 1, expression)
function: loop to take out the word (namely variable) in parameter 1 and assign it to the variable parameter, and then run the expression. Return value: express the running result
a :=xyz
result:=dollar sign (foreach b, dollar sign (a), dollar sign (b).c)
result = xc yc zc
7. Call
dollar sign (call variable parameter, parameter …)
Function: cyclically assign the parameters to the dollar sign (1), dollar sign (2) in the variable parameter in turn...
Return value: variable value after assignment
a:= dollar sign (2) dollar sign (1)
result := Dollar sign (call $(a), xy)
result =yx

1

Function compilation instructions

Insert picture description here
Insert picture description here

Insert picture description here

Compile from the eleventh line: The
first step: the foreach function takes out the variable check_putin (n=check_putin) in Modules. The
second step: the call function assigns the parameter n to the previous variable parameter
(call dollar sign (make) -c check_putin) )
Step 3: Compile the sixteenth line and compile
all the .c files of Target into .o files

Guess you like

Origin blog.csdn.net/m0_52251623/article/details/114831712