Contiki 2.7 Makefile file (ii)

Source: Internet
Author: User

Second, Makefile.include 1, the first part of

(1)
ifndef Contiki  ${error Contiki not defined! You must specify where Contiki resides}endif

Meaning:

If the Contiki variable is not defined, make stops running .

and generates a fatal error message , Contiki not defined! You must specify where Contiki resides.

Hello-world This example defines the Contiki variable in the main control makefile, so this error does not occur.

Note: Therefore, it is important to define Contiki this variable in the master control makefile.

Relevant knowledge points:

Where error is a function that controls make, the function's call statement is

$ (<function> <arguments>)

The function name and parameter name are separated by a space, and the parameters are separated by commas. The return value of a function can be used as a variable , so the above statement will be the return value of the function.

So ${error Contiki not defined! You must specify where Contiki resides} statement

Makes make stop running and returns an error message Contiki not defined! You must specify where Contiki resides.

(2)
Ifeq ($ (target),)  -include makefile.target  ifeq ($ (target),)    ${info target not defined, using TARGET ' Native '}    target=native  else    ${info using saved target ' $ (target) '}  endifendif

Meaning:

As you know in the Contiki build system, the make command can explicitly define the TARGET: Makes target=ESB

You can also save the default target to makefile.target : Maketarget=esb savetarget

First, determine if the target variable is empty, and if it is not, skip the statement.

If target is empty, then the target variable is not explicitly defined ( at least not previously defined ), import the Makefile.target file to see if the default target has been saved.

If yes (makefile.target file exists), use the default target in the Makefile.target file and prompt.

If there is no explicit definition, and the default target to Makefile.target is not saved, then set Target=native, which is native, and prompt.

Note: The symbol before include-after adding this symbol, even if the command is wrong, make will continue to execute subsequent commands.

Because makefile.target may not exist here, but does not affect make to continue execution, it was added before the include command.

(3)
Ifeq ($ (defines),)  -include makefile.$ (TARGET). Defines  Ifneq ($ (defines),)    ${info using saved defines ' $ (defines) '}  endifendif

Meaning:

As you know in the Contiki build system, the make command can explicitly define defines and set arbitrary variables for C preprocessing: Makestarget=esb defines=mytrace,myvalue=4711

You can also save the default defines to makefile.$ (TARGET). In defines : Maketarget=esb defines=mytrace,myvalue=4711 savedefines

First determine if the defines variable is empty, or skip this paragraph if it is not empty.

If defines is empty, defines is not explicitly defined ( at least not previously defined ) and imported makefile.$ (TARGET). Defines file to see if the default defines has been saved.

If you have already saved the default defines (makefile.$ (TARGET). Defines file exists), the makefile.$ (TARGET) is used. Defines the default defines in the file and prompts.

If there is no save, there is no action.

Note: The symbol before include-after adding this symbol, even if the command is wrong, make will continue to execute subsequent commands.

Because here makefile.$ (TARGET). Defines may not exist, but it cannot affect make to continue executing, so it was added before the include command.

(4)
Ifndef host_os  ifeq ($ (OS), Windows_NT)  # # Todo:detect more specific Windows set-ups,  # # e.g. CygWin, MingW, V Isualc, Watcom, Interix    host_os: = Windows  Else    host_os: = $ (Shell uname)  Endifendif

Meaning:

Determine if a host_os variable is defined, and if the variable is already defined, skip the statement.

If this variable is not defined, determine the value of the OS variable.

If the OS is windows_nt, that is, on the Windows system, set Host_os to Windows.

If the OS is not windows_nt, which is not a Windows system, use the shell uname command to get the name of the current operating system .

$ (shell uname) Gets the return value, which is the name of the operating system , and assigns a value to the Host_os variable.

The shell is the make built-in function, and the shell's arguments are the shell's commands, and the Shell function returns the output of the shell command as a function.

After the shell executes the uname command and outputs Linux, the Shell function returns to Linux.

Contiki 2.7 Makefile file (ii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.