PDA

View Full Version : PRC-tools newbie


phreakonaleash
01-25-2007, 10:25 PM
Well, I'm embarassed.

I just got linux up and running (knoppix to be exact) and installed prc-tools.

I followed their instructions and have it installed. To get a start, I downloaded a few source files for stable apps (Space Trader, Razor! GE), I have been using OnBC, and Pods and thus have no experience with makefiles. So, how do I build them? The sources' folder is /home/PhreakOnALeash/palmdev/razor_092/projects/simpledemo

Please pity me... links will work, too.

hansschmucker
01-26-2007, 12:56 AM
If they supply the makefile, then all you've got to do is change to that directory and type "make", but I'm sure you already know that.

If you want to compile your own code, the easiest way (but SLOOOOOOOW) is to compile it directly:

m68k-palmos-gcc -O2 myapp.c -o myapp.o
build-prc -o myapp.prc myapp.def myapp.o

myapp.c should be your source and myapp.def should look something like this:
application { "MyBreakout" "MyBO" }

The only thing to keep in mind is to include full c files not just the headers:

#include <PalmOS.h>
#include "lib.c" // for makefiles, this would say "lib.h"
UInt32 PilotMain(UInt16 cmd, void *cmdPBP, UInt16 launchFlags){
if (cmd == sysAppLaunchCmdNormalLaunch) {
}
}


If you really want to use makefiles on your first try, do it like this:
Split your code into .c/.h pairs. The .c files should include the function bodies and nothing else. The .h files should include the rest, including function prototypes.
Create a file named "Makefile" in your source directory and open it in the editor
First, set the global variables:

GCC=m68k-palmos-gcc
GCCOPTS=-O2
BUILD=build-prc

Then you go on and define the cascade, that means you specify the topmost file and which one it requires, then include instructions on how to build it, for example:

myapp.prc: myapp.c myapp.h mylib.h mylib.o myapp.def
$GCC $GCCOPTS myapp.c mylib.o -o myapp.o
$BUILD -o myapp.prc myapp.def myapp.o

Then you specify how to build each file needed to compile the topmost entry. myapp.c, myapp.h, mylib.h and myapp.def already exist, but we need to provide instructions on how to build mylib.o, for example:

mylib.o: mylib.c mylib.h
$GCC $GCCOPTS mylib.c -o mylib.o



And that'S pretty much it.... there's a lot more you CAN do but I'm running out of time :) (It's 8am over here: time to head to university)

potter
01-26-2007, 08:50 AM
To get a start, I downloaded a few source files for stable apps (Space Trader, Razor! GE),
Minor note: I do not know about any of the others. However, Space Trader's source distribution is for use in CodeWarrior. I assume one could get it operational under PRC tools, but it will be extra work.

phreakonaleash
01-30-2007, 10:46 AM
Oh, well... Razor! is PRC-tools, so I'll compile the sample project (haven't been on computer lately :()