[Cook] wildcard question

Aryeh M. Friedman aryeh.friedman at gmail.com
Fri Feb 8 09:30:09 EST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I just hacked the following example together:

Howto.cook:

*manifest=[collect find .];

all: [fromto %0%.cpp obj/%.o [match_mask %0%.cpp [manifest]]]
{
~    g++ [fromto %0%.cpp obj/%.o [match_mask %0%.cpp [manifest]]] -o out;
}

obj/%.o: %.cpp
~    set mkdir
{
~    g++ -c %.cpp -o [target];
}

foo.cpp:

#include <iostream>

using namespace std;

main()
{
~    cout<<"Hello, world"<<endl;
}
*

Ryan Thompson wrote:
| Thanks for the tip. I have been using the tutorial and user's guide 
quite a bit.
|
| When I try the recipe/ingredients below I get this error message:
| cook: Howto.cook: 63: illegal use of '%0' in "%0%.cpp" pattern
|
| Is there another way?
|
| In the meantime I have gotten everything working putting objects in 
the directories with the source, but I'm still curious if there is a way 
to do this.
|
| -Ryan
|
|
| On Feb 7, 2008 4:42 PM, Aryeh M. Friedman <aryeh.friedman at gmail.com 
<mailto:aryeh.friedman at gmail.com>> wrote:
|
| Try the recipe name and ingrididents like this:
|
| obj/%.o: %0%.cpp
|
| now %0 is not hardwired to XXX/obj (i.e. it lets you put it almost
| anywhere)... also you need to modify [match_mask %.cpp [manifest]]; to
| be [fromto %.cpp obj/%.o [match_mask %.cpp [manifest]]];...
|
| Ryan Thompson wrote:
| | Hi,
| |
| | I am a new user of cook, trying to get a simple build set up. I have
| .cpp sources coming from various directories, but I would like to keep
| all my .o files in one place, in ./obj/
| |
| | At this point in my file I have variables set up like this
| |
| |
| | manifest = File1.cpp ../module/File2.cpp subdir/File3.cpp
| |
| | obj = obj/File1.o obj/File2.o obj/File3.o
| |
| | %0%.o:
| | {
| |        test1 = [match_mask %.cpp [manifest]];
| |        echo test1;
| | }
| |
| |
| | If I do 'cook obj/File1.o' the recipe works as expected. For the other
| two, match_mask doesn't match the .cpp file name with a path on the
| front of the file name.
| |
| | I would like to be able to do something with a wildcard inside the
| recipe, like:
| |       test1 = [match_mask *%.cpp [manifest]];
| |
| | Is this possible? Is there another approach I should try?
| |
| | I know I can just keep the obj files in SRCDIR/obj but I want to know
| if the above is possible. Thanks for any help,
| |
| | -Ryan Thompson
| |
| | -------------------------
| |
| | _______________________________________________
| | Cook-users mailing list
| | Cook-users at auug.org.au <mailto:Cook-users at auug.org.au>
| | http://www.auug.org.au/mailman/listinfo/cook-users
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHq4ZwHYM+mNo6WpsRAhJFAKCHtETsFxOlks0K7IOOtmE2e9/EkQCdFt1g
9w5j3LDDGR167oDos0Ua9MQ=
=FngI
-----END PGP SIGNATURE-----




More information about the Cook-users mailing list