Difference between revisions of "MansOS Makefiles"

From DiLab
Jump to: navigation, search
(Running the make)
(Makefile basics)
 
Line 58: Line 58:
For a general info on how to work with makefiles look here:
For a general info on how to work with makefiles look here:


* [http://www.gnu.org/software/make/manual/make.html GNU Make manual]
* [http://www.cs.cmu.edu/cgi-bin/info2www?(make.info)Top (make.info) at CMU]
* [http://www.cs.cmu.edu/cgi-bin/info2www?(make.info)Top (make.info) at CMU]



Latest revision as of 13:43, 19 August 2010

MansOS has a makefile system to speed up the development of your applications and the development of MansOS itself

For application developers

Running the make

The common targets of the makefile are as follows:

  • build - (optional, default) build the module or application
  • upload - upload the application via hard wire (USB or COM). Make will upload to the first attached mote it finds.
  • <target> - targed platform, such as telosb
  • clean - clear the generated object and other files.

For example, if you want to build your system and then upload it to the telos mote:

 make telosb
 make telosb upload

Read on about the various MansOS_Platforms and options available for make.

Creating the application Makefile

You need just one Makefile in your project directory. Examples can be found in the apps directory. This makefile must define the following variables:

  • SOURCES - a space-delimited list of source (.c) files. It is assumed that the include files reside in the same directory
  • MODULE - the module name being developed. This could be the application name.
  • PROJDIR - most likely the current directory $(CURDIR) containing the application files.

For example:

 # My makefile
 SOURCES = main.c
 MODULE = MySystem
 PROJDIR = $(CURDIR)


Optional:

  • INCLUDES - space-delimited list of include file directories. The project directory itself is included by default.

The makefile must end with the definition of path to MansOS system MOSROOT and include of the main MansOS Makefile, like this:

 ifndef MOSROOT
   MOSROOT = /home/elo/c/elo/WSN/projects/MansOS/svn
 endif
 
 # Include the main makefile
 include ${MOSROOT}/mos/make/Makefile

Another way to setup MOSROOT, is to write in bash before executing make:

  export MOSROOT=/home/raimonds/MansOS_Work

For MansOS developers

Add path(s) to the source files in the platform makefile.


Makefile basics

For a general info on how to work with makefiles look here:

Here is an example of a makefile system for Java development: