3, the third part
Here we assume that target is native
(1)
Objectdir = obj_$ (TARGET) lowercase =-abcdefghijklmnopqrstuvwxyzuppercase = _abcdefghijklmnopqrstuvwxyztarget_ Uppercase: = ${strip ${shell echo $ (TARGET) | sed y!$ (lowercase)!$ (uppercase)!}} CFLAGS + =-dcontiki=1-dcontiki_target_$ (target_uppercase) =1
Define the objectdir variable as obj_native, which is the directory where the object file is stored
Define lowercase and uppercase variables, which hold letters in lowercase, larger.
target_uppercase Look at the name to know, should be to convert native to native, see how to achieve.
echo $ (target) This command outputs the value of the TARGET variable, which we assume is native, so output native.
| is the pipe that connects the standard output of the previous instruction as the standard input for the next instruction, that is, the input of the SED command is the output native of the echo $ (TARGET).
SED command:
y/source/dest/
Transliterate the characters in the pattern space which appear in source to the corresponding character in Dest.
The corresponding position of lowercase and uppercase is the lowercase and uppercase letters, so the native is converted to native.
The Shell is the make built-in function , the parameter is the shell command, the output of the shell command as the return value, so the return value here is native.
strip is the make built -in function that returns a string value that removes the space. The native here have no spaces, so return to native.
CFLAGS Additional -dcontiki=1-dcontiki_target_native=1
(2)
Include $ (Contiki)/core/net/rime/makefile.rimeinclude $ (Contiki)/core/net/mac/makefile.mac
import two makefile files.
Ifeq ($ (Uip_conf_ipv6), 1) #RIME_UIP6 = Rime-udp.crime_base = rimeaddr.c timesynch.c Rimestats.celserime_chameleon = Chameleon.c channel.c chameleon-raw.c chameleon-bitopt.crime_base = rimeaddr.c rime.c timesynch.c RIMESTATS.C announcement.c polite-announcement.c broadcast-announcement.crime_singlehop = broadcast.c St broadcast.c unicast.c stunicast.c runicast.c abc.c rucb.c polite.c Ipolite.crime_multiho P = netflood.c multihop.c rmh.c trickle.crime_mesh = mesh.c route.c route-discovery.crime_collect = collect.c Coll ECT-NEIGHBOR.C neighbor-discovery.c Collect-link-estimate.crime_rudolph = rudolph0.c rudolph1.c rudolph2.cendif # Uip_conf_ipv6contiki_sourcefiles + = $ (rime_base) $ (rime_singlehop) $ (rime_multihop) $ (Rime_mesh) $ (rime_collect) $ (Rime_rudolph) $ (Rime_chameleon) $ (RIME_UIP6)
This is based on the value of Uip_conf_ipv6 to determine which files in the Rime module need to be included in the contiki_sourcefiles(source file).
The variables here basically can be understood literally in terms of meaning.
Note: Uip_conf_ipv6 is 1 o'clock, walk IPv6.
$ (Contiki)/core/net/mac/makefile.mac
CXMAC.C XMAC.C NULLMAC.C lpp.c SICSLOWMAC.C NULLRDC.C CSMA.C contikimac.c phase.c
Include all source files in Mac module into contiki_sourcefiles(source file)
(3)
SYSTEM = process.c procinit.c autostart.c elfloader.c profile.c timetable.c timetable-aggregate.c compower.c Serial-line.cthreads = mt.clibs = memb.c mmem.c timer.c list.c etimer.c ctimer.c energest.c rtimer.c stimer.c trickle- TIMER.C print-stats.c ifft.c crc16.c random.c checkpoint.c ringbuf.c Settings.cdev = Nullradio.cinclude $ ( Contiki)/core/net/makefile.uipinclude $ (contiki)/CORE/NET/RPL/MAKEFILE.RPLCTK = Ctk.cctkvnc = $ (CTK) CTK-VNCSERVER.C libconio.c vnc-server.c vnc-out.c ctk-vncfont.cifndef contiki_no_net CONTIKIFILES = $ (SYSTEM) $ ( LIBS) $ (NET) $ (THREADS) $ (DHCP) $ (dev) Else contikifiles = $ (SYSTEM) $ (LIBS) $ (THREADS) $ (dev) sicslowpan.c fakeuip.c Endifcontiki_sourcefiles + = $ (contikifiles)
Define system THREADS LIBS DEV variables, which are easy to understand, this is Contiki system Storage System operation, multi-process, library, equipment and other source file variables .
Import $ (contiki)/core/net/makefile.uip
NET = dhcpc.c hc.c nbr-table.c netstack.c PACKETBUF.C packetqueue.c psock.c Queuebuf . C resolv.c sicslowpan.c simple-udp.c tcpdump. C tcpip.c uaodv-rt.c uaodv.c uip-debug . C uip-ds6-route.c uip-ds6-nbr.c uip-ds6.c uip-fw- DRV.C uip-fw.c uip-icmp6.c uip-nd6.c Uip-neigh BOR.C uip-over-mesh.c uip-packetqueue.c uip-split.c uip-udp-packet.c uip.c uip6.c uip_arp.c Uiplib.c
Define the source files required by the UIP and store them in the NET variable.
Import $ (Contiki)/CORE/NET/RPL/MAKEFILE.RPL
Contiki_sourcefiles + = rpl.c rpl-dag.c rpl-icmp6.c rpl-timers.c rpl-mrhof.c rpl-ext-header.c
Include the source file of the RPL module into the contiki_sourcefiles(source file)
CTK = Ctk.cctkvnc = $ (CTK) ctk-vncserver.c libconio.c vnc-server.c vnc-out.c ctk-vncfont.c
Define variables such as CTK and ctkvnc . This is associated with the GUI.
Ifndef contiki_no_net contikifiles = $ (SYSTEM) $ (LIBS) $ (NET) $ (THREADS) $ (DHCP) $ (DEV) Else contikifiles = $ ( SYSTEM) $ (LIBS) $ (THREADS) $ (DEV) sicslowpan.c fakeuip.cendif
determines whether the source file in the NET variable is included in the contikifiles(source file), depending on whether the contiki_no_net variable is defined.
That is, decide whether to include the source files in the uIP .
Contiki_sourcefiles + = $ (contikifiles)
Add the value of the contikifiles variable defined in the previous step to the contiki_sourcefiles(source file).
Contikidirs + = ${addprefix $ (contiki)/core/,dev lib net net/mac net/rime net/rpl sys cfs CTK LIB/CTK loader.}
Defines the Contiki operating system, the source file directory.
Addprefix is the built-in function for make, which is to add $ (Contiki)/core/for the string that is behind.
Last for $ (Contiki)/core/dev, $ (Contiki)/core/lib, $ (Contiki)/core/net, $ (Contiki)/core/net/mac, $ (Contiki)/core/net /rime, $ (Contiki)/CORE/NET/RPL, $ (Contiki)/core/sys, $ (Contiki)/CORE/CFS, $ (Contiki)/CORE/CTK, $ (Contiki)/core/lib/ CTK, $ (Contiki)/core/loader, $ (Contiki)/core/.
These are the kernel source files directories of the Contiki operating system.
Contiki 2.7 Makefile file (iv)