Re: [cc65] Compile problem

Date view Thread view Subject view

From: Marko Mäkelä (msmakela_at_cc.hut.fi)
Date: 2001-12-12 07:54:02


On Tue, 11 Dec 2001, groepaz wrote:

> i think that might even work in a portable way (getcwd/setcwd should
> be available everywhere no?)

POSIX defines chdir(const char* path) and fchdir(int fd), but in Unix,
there's no system call or even a library call for determining the current
working directory.  As far as I know, the pwd(3) program guesses the
current working directory by following the "../../.." chain and doing
something like opendir/readdir/stat to find out a matching subdirectory of
the ".." directory, and to find out when ".." is the same as "." (in the
root directory, it is).  BTW, at least on Sun Solaris 7, the pwd(3)
program fails if one of the parent directories doesn't have read
permissions.

> - well except a "collapsepath" functionality would be needed for
> "OSes" like ms-dos...

Potentially, the maximum path name length can be a problem on any system
when you have very long directory hierarchies.  I guess you're referring
to removing "./" or "somedir/.." parts from the path names.  My Perl
script that generates the index.html navigation files for
http://www.funet.fi/pub/cbm/ does that when it resolves symbolic links.

> just an idea that came to my mind (well you know you always think
> about totally unrelated things when supposed to do boring
> work...writing docfiles....*sigh* ;=))

Or writing "doctor files" (PhD thesis). :-)

To get back on the topic, I agree with Ullrich and would rather keep
platform-specific stuff out of the compiler.  There are tools like GNU
autoconf and automake that allow the creation of "portable Makefiles".
Maybe you should have a look at them.  Perhaps you don't want to use these
tools as such, but you could get some ideas.  The source files (in a broad
sense; including C files and Makefiles) do not need to be exactly
identical on all platform; the main thing is that you can eliminate the
need for manually editing them.

Also, you could perhaps use a set of platform-specific Makefiles, like
Makefile.`uname` where `uname` is replaced by Linux, OSF1, SunOS, etc.
These files would include a common Makefile that'd contain the
platform-independent rules.  I used this approach for a large C++ program
I've written.  (GNU autoconf and automake ease the porting of C programs
to various compilers, but for C++ there are very few compilers that would 
compile the code.  I've only found two.)

	Marko


----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2001-12-14 22:05:44 CET