[Cook] two questions
Brendan J Simon
brendan.simon at bigpond.com
Sat Nov 2 23:24:41 EST 2002
Here is my simple example. It's a little tricky so it's not trivially
simple but you should get the general idea. It is not necessarily the
best way to achieve this but it works. It would be nice to not have to
specify the src and build directories at the top of each module.mk file
but I can live with that. Anyone got any ideas how to automatically
calculate the src directory ???
You should be able to cd to any directory and type "make" or "make all"
or "make debug". It should only build things for that subdirectory and
below and any dependecies such as libraries.
I could probably cut down some of the repetition in the sub makefiles.
The find script is one thing that could probably be simplified (very
easy for aegis users). Maybe a seperate script in /usr/local/bin might
make the find more elegant. I wonder if the "find" command can search
backwards up a path ???
Cheers,
Brendan Simon.
Brendan J Simon wrote:
>
> I'll try to put together a simple project which has the basic
> features. The one I use at work is big, confusing and probably counts
> as intellectual property which I can not divulge :)
>
> Stay tuned.
>
> Regards,
> Brendan Simon.
>
>
> Shaw, Steven wrote:
>
>> Hi Brendan,
>>
>> I'd like to hear more about your way of using make.
>>
>> you wrote:
>>
>>
>>> I haven't done this with Cook, but with Make I have a makefile
>>> fragment (module.mk) in each directory which is included by the
>>> SINGLE top level Makefile. I've set it up so that I can have a
>>> Makefile in any directory and it will include module.mk which will
>>> control including any subdirectory module.mk files and so on.
>>> Alternatively, my subdirectory makefiles can workout the
>>> dependencies (eg. "make all" includes all module.mk files and sets
>>> the ALL variable), figures out the real top level Makefile and calls
>>> it as "make $(ALL)".
>>>
>>
>>
>> Would you mind explaining how this is done. I assume you are using
>> Gnu make (I don't think others have the 'include' command)? I've used
>> this technique to a degree (within a bigger project that used recursive
>> makefiles). The problem I had was that I had to always refer to the
>> files by there relative path names. I think I always had to issue the
>> make command from the top directory (where the main, aka
>> one-and-only, Makefile is).
>>
>> Is it possible to teach make to accept $ make foo.o' in a
>> subdirectory? Instead of have to do something like:
>> $ (cd $TOP; make foo/foo.o)
>>
>> With your setup, if I am in the foo directory and type:
>> $ make foo
>> which relies on bar.so in the bar directory (also under $TOP), will
>> it ensure that bar.so is up-to-date too?
>>
>> Cheers, Steve.
>>
>>
>>
>
>
> _______________________________________________
> Cook-users mailing list
> Cook-users at auug.org.au
> http://www.auug.org.au/mailman/listinfo/cook-users
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: single-makefile-example.tar.gz
Type: application/gzip
Size: 2738 bytes
Desc: not available
URL: <http://lists.auug.org.au/pipermail/cook-users/attachments/20021102/af5364bd/attachment.bin>
More information about the Cook-users
mailing list