l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
December 2: Social gathering
Next Installfest:
TBD
Latest News:
Nov. 18: Club officer elections
Page last updated:
2004 Mar 31 15:19

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] Make question: headers depending on other headers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] Make question: headers depending on other headers



I think in general you want to use a tool like 'makedepend' or
'gcc -M' instead of trying to write your Makefile dependencies
yourself.  These track down the headers used by a .c file and
output the appropriate Makefile dependency line.  I haven't really
done this much, but there's a good page of information about it at
http://make.paulandlesley.org/autodep.html


Matt

On Wed, Mar 31, 2004 at 02:56:38PM -0800, Bill Kendrick wrote:
> 
> I have some source files that depend on some other sources' headers.
> 
> In turn, some of THOSE headers depend on other headers (e.g., a header
> defining a structure might depend on another header that defines some other
> structures).
> 
> Is it useful to list these 'dependencies' within the Makefile?
> 
> For example, consider foo.c:
> 
>   /* foo.c
>      I do foo things */
> 
>   #include "foo.h"  /* My header */
>   #include "bar.h"  /* bar.c's header, so I can get to its function(s) and/or
>                        typedefs... */
> 
>   ...
> 
> 
> In Makefile, I'd do:
> 
>   foo.o:  foo.c foo.h bar.h
>           ...compile foo.c into foo.o...
> 
> 
> However, say in "bar.h", I have:
> 
> 
>   /* bar.h
>      I do things with alcohol (get it? "bar?" hahaha...) */
> 
>   #include "bar.h"  /* My header */
>   #include "zzz.h"  /* Contains some #define's for compile-time options */
> 
>   ...
> 
> 
> Should I make "bar.h" depend on "zzz.h"?  Or "foo.o" depend on it?  Or...?
> 
> 
> I just want to make sure that in case I touch something somewhere, that
> everybody who needs to get update GETS updated.
> 
> Thx!
> 
> -bill!
> bill@newbreedsoftware.com              Have you visited the Linux Users' Group
> http://newbreedsoftware.com/bill/        of Davis yet!?  http://www.lugod.org/
> _______________________________________________
> vox-tech mailing list
> vox-tech@lists.lugod.org
> http://lists.lugod.org/mailman/listinfo/vox-tech

-- 

*************************************************
* Matt Roper <matt@mattrope.com>                *
* http://www.mattrope.com                       *
* PGP Key: http://www.mattrope.com/mattrope.asc *
*************************************************
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Sunset Systems
Who graciously hosts our website & mailing lists!