[SDL] configure, CVS, platform-dependant, etc...
skaller
skaller at users.sourceforge.net
Mon Feb 27 00:43:15 PST 2006
On Mon, 2006-02-27 at 01:09 -0500, Simon wrote:
[BTW: sorry to SDL readers this is a bit off topic]
> > The tool we use is called "Python". You may prefer Perl.
>
> I know both, I never really practiced any of these, how would you use
> them? Can you show me an example (for how it can help compile...)?
You can do, with suitable subroutines:
if timestamp("foo.c") > timestamp("foo.o"):
os.system ("gcc -c -o foo.o foo.cpp")
instead of
foo.o: foo.c
gcc -c -o foo.o foo.c
The python is a bit longer, but it is easy to generalise
to be table driven.
For dependency checking, it isn't so hard to write
a topological sort in Python .. it is just a recursive
descent on a dictionary of dependencies.
So make is not really doing much useful work you can't
emulate with a few more lines in Python.
On the other hand you can write arbitrary executable
Python code to do conditional building, glob for
filenames, apply regular expressions, or do any
other sort of arbitrary calculation .. all in the
same language with a single tool available on almost
all platforms -- certainly on more platforms than
make or bash. And with some care, like writing
"dir"+os.sep+"foo.c"
instead of just "dir/foo.c" you can write script that
works on Windows too. The build script for Felix
works on both Unix and Windows, including using
MSVC++ instead of gcc. (This took months to get
working -- but at least it is possible!)
--
John Skaller <skaller at users dot sourceforge dot net>
Async PL, Realtime software consultants
Checkout Felix: http://felix.sourceforge.net
More information about the SDL
mailing list