I failed to reproduce the errors you're seeing. Potentially you could set
up a minimum working example that fails under the same circumstances?

One potential issue I see with the way you're structuring your Tupfiles is
your use of wild cards. As far as I understand, these get expanded when tup
does its directory scan, but not using its "knowledge" of all generated
files it may produce. Thus, if there are no matches to src/*.pb.c
initially, the glob won't match anything. A way to solve this is to use
groups. In solution 1, this would look like:

Root Tupfile
include_rules
: foreach proto/*.proto |> $(PROTOC) -I=$(PROTOSRCDIR)
--cpp_out=$(COREDIR)/src %f |> $(COREDIR)/src/%B.pb.h $(COREDIR)/src/%
B.pb.cc $(COREDIR)/<protos>
…
# Same for the other modules

Core Tupfile
include_rules
: foreach src/*.cpp | <protos> |> $(CC) $(CFLAGS) -o obj/%B.o -c %f |>
obj/%B.o obj/%B.gcno

I believe something along these lines should work, but if not, something
reproducible should help to debug.

On Sun, May 14, 2017 at 7:43 PM vincent bonval <[email protected]> wrote:

> Hi,
>
> I'm trying to set up *tup* for a project organized (that is currently
> using *cmake* with broken and hard to maintain *CMakeLists.txt*) in
> modules.
> The project directory tree is :
>
>     ├── char
>     │   ├── include
>     │   └── src
>     ├── core
>     │   ├── include
>     │   ├── obj
>     │   └── src
>     ├── login
>     │   ├── include
>     │   └── src
>     ├── map
>     │   ├── include
>     │   └── src
>     ├── proto
>     └── rosecommon
>         ├── include
>         └── src
>
>
>
>
> Each directory (*proto* excepted) is a module and is compiled into a
> static library. Those modules may use different flags. Each module depend
> on protobuf C++ file generated from the source file in *proto*.
>
> I've tried two solution:
>
>
>    - (solution 1) a root *Tupfile* that generate the protobuf C++ file
>    and a *Tupfile* by module that compile the C++ source code. With this
>    solution, *tup* complains that the module depends on file not
>    generated by *tup*
>    - (solution 2) a *Tupfile* by module which generate the protobuf C++
>    file and compile the module. With this solution, *tup* complains that
>    it can't find the protobuf files.
>
>
>
> The *Tupfiles* for the solutions that I've tried:
>
> The link part of the compilation (into the static library and into the
> final executable) is not in the *Tupfiles* presented but it does not
> affect the issue.
>
>
> *Solution 1*
>
> *Tuprules.tup*
>
>  PROTOC      = protoc
>  CC          = g++
>
>  ROOT        = $(TUP_PWD)
>
>  COREDIR     = $(ROOT)/core
>  PROTOSRCDIR = $(ROOT)/proto
>
>
>
>
> *Root Tupfile*
>
> include_rules
> : foreach proto/*.proto |> $(PROTOC) -I=$(PROTOSRCDIR)
> --cpp_out=$(COREDIR)/src %f |> $(COREDIR)/src/%B.pb.h $(COREDIR)/src/%
> B.pb.cc
> # Same for the other modules
>
>
>
> *Core tupfile (the other are the same, with some difference in the CFLAGS)*
>
> include_rules
> : foreach src/*.cpp | src/*.pb.c src/*.pb.h |> $(CC) $(CFLAGS) -o
> obj/%B.o -c %f |> obj/%B.o obj/%B.gcno
>
>
>
>
> *Solution 2*
>
> *Tuprules.tup*
>
> PROTOC      = protoc
> CC          = g++
>
> ROOT        = $(TUP_PWD)
>
> COREDIR     = $(ROOT)/core
> PROTOSRCDIR = $(ROOT)/proto
>
>
>
> *Core tupfile (the other are the same, with some difference in the CFLAGS)*
>
> include_rules
> : foreach proto/*.proto |> $(PROTOC) -I=$(PROTOSRCDIR)
> --cpp_out=$(COREDIR)/src %f |> $(COREDIR)/src/%B.pb.h $(COREDIR)/src/%
> B.pb.cc
> : foreach src/*.cpp | src/*.pb.c src/*.pb.h |> $(CC) $(CFLAGS) -o obj/%B.o
> -c %f |> obj/%B.o obj/%B.gcno
>
>
>
> How sould I organize *tup* for this project ?
>
> Thank you for your answers.
>
> --
> --
> 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.
>

-- 
-- 
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.

Reply via email to