[Cook] Fwd: Foreach in a currentdirectory
Peter Miller
peter.miller.aus at gmail.com
Fri Jun 29 09:13:16 EST 2012
The [obj] variable in your example contains a *list* of object files.
all: prog;
obj = [fromto %0%.cpp %0%.o [glob *.cpp]];
prog: [obj]
{
gcc -o prog [obj];
}
%.o: %.cpp
{
gcc -o %.o -c %.cpp;
}
Cook also comes with some include files for different languages,
containing recipes similar to the above.
Regards
Peter Miller
On Fri, 2012-04-27 at 16:00 +0200, xancorreu wrote:
> Thanks,
>
> The complete example is this?:
>
> obj=[fromto %0%.cpp %0%.o [match_mask %0%.cpp [project_files]];
>
> all: [obj]
> {
> clang++ -o [obj].out [obj].cpp;
> }
>
>
> I get error!!
>
> Xan.
>
> Al 26/04/12 23:09, En/na Aryeh Friedman ha escrit:
> > ---------- Forwarded message ----------
> > From: Aryeh Friedman<aryeh.friedman at gmail.com>
> > Date: Thu, Apr 26, 2012 at 4:21 PM
> > Subject: Re: [Cook] Foreach in a currentdirectory
> > To: "Pendergraft, Jerry"<JPendergraft at sjm.com>
> >
> >
> > A better way is:
> >
> > obj=[fromto %0%.cpp %0%.o [match_mask %0%.cpp [project_files]];
> >
> > all: [obj]
> > {
> > ...
> > }
> >
> > The reasons for this are:
> >
> > 1. It is easier to understand the code
> > 2. It allows you to later do other things with [obj] like use c_incl
> > to do cascade dependence (see ch. 3 of the user guide)
> >
> > This is also covered in the tutorial
> >
> > On Thu, Apr 26, 2012 at 3:58 PM, Pendergraft, Jerry
> > <JPendergraft at sjm.com> wrote:
> >> Best way to deal with issues like this is to have a "manifest" variable.
> >> Then you can do things like:
> >> All : [patsubst %0%.cpp %0%.out [match_mask %0%.cpp [project_files]];
> >>
> >> -----Original Message-----
> >> From: cook-users-bounces+jpendergraft=sjm.com at lists.auug.org.au [mailto:cook-users-bounces+jpendergraft=sjm.com at lists.auug.org.au] On Behalf Of xancorreu
> >> Sent: Thursday, April 26, 2012 7:14 AM
> >> To: cook-users at lists.auug.org.au
> >> Subject: [Cook] Foreach in a currentdirectory
> >>
> >> Hi,
> >>
> >> I have this cookfile:
> >>
> >> all: algorisme.out hola.out;
> >>
> >>
> >> algorisme.out: algorisme.cpp
> >> {
> >> clang++ -o algorisme.out algorisme.cpp;
> >> }
> >>
> >> hola.out: hola.cpp
> >> {
> >> clang++ -o hola.out hola.cpp;
> >> }
> >>
> >>
> >> I want to substitute this for the rule:
> >>
> >> process every file with .cpp extension and write as this file.out
> >>
> >> I try this:
> >>
> >> %0.out: %.cpp
> >> {
> >> clang...
> >> }
> >>
> >>
> >> but how to say that I want to process all the files in the current
> >> directory?
> >> What should I add to all:?
> >>
> >>
> >> Thanks in advance,
> >> Xan.
> >>
> >> _______________________________________________
> >> Cook-users mailing list
> >> Cook-users at lists.auug.org.au
> >> http://lists.auug.org.au/listinfo/cook-users
> >>
> >> This communication, including any attachments, may contain information that is proprietary, privileged, confidential or legally exempt from disclosure. If you are not a named addressee, you are hereby notified that you are not authorized to read, print, retain a copy of or disseminate any portion of this communication without the consent of the sender and that doing so may be unlawful. If you have received this communication in error, please immediately notify the sender via return e-mail and delete it from your system.
> >> _______________________________________________
> >> Cook-users mailing list
> >> Cook-users at lists.auug.org.au
> >> http://lists.auug.org.au/listinfo/cook-users
> > _______________________________________________
> > Cook-users mailing list
> > Cook-users at lists.auug.org.au
> > http://lists.auug.org.au/listinfo/cook-users
>
> _______________________________________________
> Cook-users mailing list
> Cook-users at lists.auug.org.au
> http://lists.auug.org.au/listinfo/cook-users
More information about the Cook-users
mailing list