Difference between revisions of "MansOS Makefiles"

From DiLab
Jump to: navigation, search
m (Running the make)
m (Running the make)
Line 7: Line 7:
 
The common targets of the makefile are as follows:
 
The common targets of the makefile are as follows:
 
* '''build''' - (optional, default) build the module or application
 
* '''build''' - (optional, default) build the module or application
* '''upload''' - upload the 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'''
 
* '''''<target>''''' - targed platform, such as '''telosb'''
 
* '''clean''' - clear the generated object and other files.
 
* '''clean''' - clear the generated object and other files.

Revision as of 10:00, 31 March 2008

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.
  • cleanall - clear everything from the output (build/) directory


  • objs - compile only, generate all object files
  • printenv - print the major variables (for debugging make)

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

 make telosb
 make telosb upload

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


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: