Difference between revisions of "MansOS Makefiles"
m (→Running the make) |
(→Creating the application Makefile) |
||
Line 49: | Line 49: | ||
include ${MOSROOT}/mos/make/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 == |
== For MansOS developers == |
Revision as of 08:42, 2 April 2008
MansOS has a makefile system to speed up the development of your applications and the development of MansOS itself
Contents
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
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: