PALM PROGRAMMING: Putting it all together.

The Compiler / Linker / Builder.

Written by Mike Andrew on 26-April-02.

This section details the compilation process behind any and all source code intended for a Palm. It does not discuss the source code. For a description of source codes and their syntax, see the relevant section.

Creating a palm application from source involves the use of:

a cross compiler
a librarian
a resource compiler
a linker

While the terms may be familiar to you, the actual programs used to perform the approve process will not.

It is assumed, before you read further, that you have, in fact, downloaded and installed all necessary components as detailed in previous sections of this SxS.

Rather than elaborate, in English, how this process is achieved, I will use a heavily commented Makefile as an example. You should be able to cut 'n paste the contents below, to achieve most of your intended applications.

Be aware that:

a (dot).prc file is the target binary. It is THE file that will be loaded to the palm (or the emulator). Almost all utilities that deal with a palm (loading, emulators eg) look for (dot)prc files as their source.

A confusingly named (dot).rcp file is the resource source code. Resource source is similar to Pascal in syntax and defines the look 'n feel of your application (pull down menus, icons, etc). Normally, one single (dot)rcp file is sufficient for any application. Accordingly, the name of that file follows the convention of having the same name as the main().c EG. hello.c, hello.rcp, with hello.prc as final output.

In the Makefile below, it is assumed that, the names of the files are:

xxx.c # one (or more) C files
hello.prc # the target binary for the palm
hello.rpc # the resource file
resource.h # for above and very standard practice

#Template Makefile
# you should be able to simply alter this 1st section to achieve your aims
# the intent of this Makefile is to compile a "hello world" example
# which I detail in a later chapter

# name of program (and it's consequent .rcp, .prc and .def file)
PROGRAM = hello
#The icon title of the application, on the palm
# C sources derived to:
OBJS = hello1.o hello2.o .... helloN.o
#obviously, fix the above line to reflect the source(s) you have!
#Use the line above for a string of (dot)c files.
# All, will ultimately be merged into a single lib. By convention,
# even a single (dot)c source is handled in this manner.
# # end of configurable section
# location of sdk header files (see bottom for detailed explanation)
include ${HOME}/projects/palm/palminc
#The names of: the resource file, the library (which is built by make) and the output
# compilers and linker
COMPILER_FLAGS = -O2 -Wall -palmos3.5 $(INCLUDE_PALM)
LINK = build-prc
#not used
PRC2BIN = prc2bin

# to make the application xxx.prc
$(PRC): $(PROGLIB) resource.binaries
    (tab)$(LINK) $(PRC)  $(DESCRIPTOR)  $(PROGLIB)  *.bin
    (tab)make clean

see below for a description of the def file, and build-prc syntax.

# To compile the C source(s)
.SUFFIXES: .c .o
     (tab)$(COMPILE) $(COMPILER_FLAGS) $<<br>
# to librarize those source(s)
     (tab)$(MAKELIB) $(PROGLIB) $(OBJS)
#    (tab)$(OBJRES) $(PROGLIB)

#the resource compiler
resource.binaries: $(RESOURCES) resource.h

# clean-up functions
   (tab)rm -f *.[oa] *.bin *.grc *~ $(PROGLIB)


Palm applications utilise a CROSS compiler.

While derived from gcc source code, this compiler must be specifically invoked, and, the location of the all-important SDK header files must be told to it.

[SDK = Standard Development Kit. Within which the all important Application Programmers Interface (API) resides. You don't pass go, you don't collect $200 without it.]

The tree-list of include headers is quite long, and, this list must be exported to the compiler environment (which is different to the Makefile environment).

Happily, the following script will satisfy all needs.

export C_INCLUDE_PATH=/usr/local/palmdev/sdk/include



You will use this same script, regardless of how many palm projects you create. Consequently, it is convenient to place a simple 'include' statement in each and any Makefile to locate this one script. In my example above

include ${HOME}/projects/palm/palminc

I am locating it in a place convenient to me. Your mileage will vary, and you don't require hand holding to the extent where you need to be told where to place it.


For more information on the binaries such as build-prc

info /usr/local/info/


Next -> Palm Source code

searchSearch Index