Re: Re[2]: [cc65] Compile problem

Date view Thread view Subject view

From: Adam Dunkels (adam_at_sics.se)
Date: 2001-12-10 19:11:16


On Monday 10 December 2001 16:54, you wrote:
> a) regardless whats the current working dir when i type "make", the
> stuff should still work => this renders "searching relative to ."
> useless.

Being able to type "make" in an arbitrary directory and hope to rebuild the 
right files for the right just doesn't work. If you use GNU make, you can 
specify a working directory, however, with "gmake -C /adam/project". Perhaps 
this is the closest thing to your needs?

> whatever, all and all these problems can be easily solved by
> "searching relative to current file" aswell (right after searching
> pathes given by -I option at best) - and thats actually the kind of
> behaviour i'd expect from any decent compiler/assembler out there.
> (except borland turbo-c which suffers from the same problem hehehehe ;D)
>
> infact, i was pretty surprised that ca65 did NOT work like this when i
> first stumbled about it....seems to be another "too easy to let it be
> unfixed" issue to me ;=)

I think that the behavour that ca65/cc65 exhibits is the more common 
behaviour. I haven't come across any compilers that lets you specify "include 
file relative to where this file lives" (but then I haven't come across very 
many compilers).  The common behaviour is that #include files are searched 
relative to all -I paths and some default paths (., /usr/include and friends 
as well as a few others).

Anyway, here is how I solved the problem for the lwIP project. The lwIP 
TCP/IP stack should compile cleanly for many platforms and it should possible 
to compile it with either IPv4 or IPv6 support. The code tree is structured 
in such a way that all makefiles and .o files end up in an project-specific 
directory (called proj/${PROJNAME}) and the source and includefiles are kept 
in another directory (src/). 

All include files are #included with an lwip/ path, like this:

#include "lwip/ip.h"
#include "lwip/debug.h"

(The reason is to avoid clobbering the namespace.)

The are a few different types of include files; those that are lwIP specific, 
those that are architecture specific and those that are project specific. 
Each are kept in diffrent directories. The makefiles are used to specify the 
#include paths with the CFLAGS variable like this:

CFLAGS = -I../src/include -I../src/arch/cc65/include -I../src/include/ipv4

This way, all includes are kept in diffrent directories and the paths are 
relative to the makefile and not to the root of the filesystem.

/adam
-- 
Adam Dunkels <adam_at_sics.se>
http://www.sics.se/~adam
----------------------------------------------------------------------
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