Thanks Andrew.
I tried out some scenarios based on your example to explore this further
and I understand things better now.
But now it appears that one can use generated files (from other tupfiles)
as inputs only if they are not written out to a new directory. This still
seems pretty limiting.
If I take your example (which also has windows related changes) and modify
it to use a output directory for object files:
================ a/Tupfile ================
: foreach *.cpp |> cl /EHsc -c %f /Fo%o |> o/%B.o
then use it in Tupfile in b
================ b/Tupfile ================
: foreach *.cpp |> cl /EHsc -c %f /Fo%o |> o/%B.o
: o/*.o ../a/o/*.o |> cl /Fe%o %f |> foo.exe
I get this on running running tup
*tup error: Unable to use inputs from a generated directory (34) that isn't
written to by this Tupfile.*
- [34] a/o
Using a group is a good option here but in scenarios where I would like to
process the generated files separately ( using foreach for example), should
I be using existing directories to write generated files always?.
tup version I am using:
tup --version
tup v0.7.3-60-gd3bfa7c
Thanks,
Arun
On Thursday, January 28, 2016 at 9:41:44 AM UTC+5:30, Andrew Jensen wrote:
>
> That's not true. You can use generated files in another Tupfile. It would
> severely limit the usefulness of tup if that weren't possible. In fact, I
> do just that in a fairly large project all the time. Here is a small
> example:
>
> bash$ ls -l a b
> a:
> total 24
> -rw-r--r-- 1 ajensen staff 165 Jan 27 21:53 ClassA.cc
> -rw-r--r-- 1 ajensen staff 103 Jan 27 21:53 ClassA.h
> -rw-r--r-- 1 ajensen staff 44 Jan 27 21:36 Tupfile
>
> b:
> total 16
> -rw-r--r-- 1 ajensen staff 80 Jan 27 21:47 Tupfile
> -rw-r--r-- 1 ajensen staff 141 Jan 27 21:52 main.cc
> bash$ for fn in a/* b/*; do echo "================ $fn ================";
> cat $fn; done
> ================ a/ClassA.cc ================
> #include "ClassA.h"
> #include <iostream>
>
> ClassA::ClassA()
> : member_(9) {
> }
>
> void ClassA::doit() {
> std::cout << "ClassA: value = " << member_ << std::endl;
> }
> ================ a/ClassA.h ================
> class ClassA {
> public:
> ClassA();
> void doit();
> private:
> int member_;
> };
> ================ a/Tupfile ================
> : foreach *.cc |> g++ -c -o %B.o %f |> %B.o
> ================ b/Tupfile ================
> : foreach *.cc |> g++ -c %f -o %o |> %B.o
> : *.o ../a/*.o |> g++ -o %o %f |> foo
> ================ b/main.cc ================
> #include "../a/ClassA.h"
> #include <iostream>
>
> int
> main(int argc, char** argv) {
> printf("Hello, World!\n");
> ClassA a;
> a.doit();
> }
> bash$ tup
> [ tup ] [0.000s] Scanning filesystem...
> [ tup ] [0.018s] Reading in new environment variables...
> [ tup ] [0.019s] Parsing Tupfiles...
> 1) [0.005s] a
> 2) [0.007s] b
>
> [ ] 100%
> [ tup ] [0.064s] No files to delete.
>
> [ tup ] [0.064s] Generating .gitignore files...
> [ tup ] [0.064s] Executing Commands...
> 1) [0.502s] b: g++ -c main.cc -o main.o
>
> 2) [0.518s] a: g++ -c -o ClassA.o ClassA.cc
>
> 3) [0.084s] b: g++ -o foo main.o ../a/ClassA.o
>
> [ ] 100%
> [ tup ] [0.668s] Updated.
>
> bash$ b/foo
> Hello, World!
> ClassA: value = 9
> bash$
>
--
--
tup-users mailing list
email: [email protected]
unsubscribe: [email protected]
options: http://groups.google.com/group/tup-users?hl=en
---
You received this message because you are subscribed to the Google Groups
"tup-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.