Thought I'd give a little back to the newsgroup for all the info I've
learned from it. Here's an automated way to put build time information in
your Palm app during development if you use the PRC tool chain: I use this
to track internal builds without having to remember to edit my .rcp file to
change the VERSION info each time. Basically, it lets me pop up information
like this:
Build Info:
Tue Jul 31 17:42:30 2001
on my splash screen.
-----> kell
1. Create a little shell script called "buildtime" that contains the
following lines:
--------------------- snip here -----------------------------
export HDR=buildtime.h
set `date`
rm -f $HDR
echo "#ifndef BUILD_TIME_H" > $HDR
echo "#define BUILD_TIME_H" >> $HDR
echo "#define BUILD_TIME \""$1 $2 $3 $4 $5"\"" >> $HDR
echo "#endif // BUILD_TIME_H" >> $HDR
-------------------- snip here ------------------------------
Save this shell script in the same directory as your Makefile. When
executed, this shell script will create a C header file called "buildtime.h"
that has the build time info in it. Now, we just need to tell the Makefile
to run it each time you compile...
2. Add the following lines to your Makefile.
-------------------- snip here -----------------------------
time:
./buildtime
-------------------- snip here -----------------------------
This adds a target called "time" that will run the shell script we
created in step 1.
3. Tell the Makefile to run the shell script whenever you build your Palm
app. You can do this by just adding the "time" target in the following place
in your Makefile.
------------------------- snip here --------------------------
$(PRC): time grc.stamp bin.stamp;
$(BUILDPRC) $(PRC) $(ICONTEXT) $(APPID) *.grc *.bin $(LINKFILES)
ls -l *.prc
------------------------- snip here ----------------------------
4. The last thing you have to do to your Makefile is to tell which of your
source files depends on the header file. E.g., I use the build info in my
splash screen (in SplashScreen.c), so I add the following line to the
Makefile:
-------------------------- snip here ---------------------------
SplashScreen.o: time
-------------------------- snip here ---------------------------
5. That's all! Now, just include the buildtime.h file in your program and
use the BUILD_TIME string to display the build info however you'd like. For
example, I use the following:
--------------------------- snip here --------------------------
#include "buildtime.h"
...
WinPaintChars("Build Info:", 11, 2, 140);
WinPaintChars(BUILD_TIME, StrLen(BUILD_TIME), 2, 150);
---------------------------- snip here --------------------------
which paints the following lines on my splash screen.
Build Info:
Tue Jul 31 17:42:30 2001
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/