[clug] linking makefiles

Paul TBBle Hampson Paul.Hampson at anu.edu.au
Wed Jul 13 10:16:42 GMT 2005


On Wed, Jul 13, 2005 at 02:48:43PM +0530, deepshikha wrote:
> hello,
>  i am having a problem compiling a C code. i have two directories and each 
> one has a separate Makefile.
> a program(file.c) in directory 'B' needs to access a function which belongs 
> to a file(i2c.c, i2c.h) in directory 'A'. 
>  how do i link the two files. will i have to make a new makefile?
>  will appreciate any kind of help.
>  thanks

Your makefile in B:

myprog: ../A/i2c.o
	*build myprog*

../A/i2c.o: ../A/i2c.c
	make -C ../A i2c.o

(off the top of my head...)

-- 
-----------------------------------------------------------
Paul "TBBle" Hampson, MCSE
8th year CompSci/Asian Studies student, ANU
The Boss, Bubblesworth Pty Ltd (ABN: 51 095 284 361)
Paul.Hampson at Anu.edu.au

"No survivors? Then where do the stories come from I wonder?"
-- Capt. Jack Sparrow, "Pirates of the Caribbean"

License: http://creativecommons.org/licenses/by/2.1/au/
-----------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/linux/attachments/20050713/d0825d60/attachment.bin


More information about the linux mailing list