One way to accomplish your goal is with lua. Your Tupdefault.lua could look
something like:
if tup.getdirectory() == '_src' then
tup.foreach_rule('*.c', 'gcc-c %f -o %o', {'%B.o', root..'/<objs>'})
end
Note, I haven't tested this, but something along these lines should be
possible. I always forget how foreach rules work in lua. My guess about the
globing issue is just that the parsing is lazy, but there could be better
reason.
On Fri, Mar 9, 2018 at 4:16 PM Paul Guenette <[email protected]> wrote:
> Similarly to other users, I'm using 3 files (Tuprules, Tupdefault,
> Tupfile) to build an entire source tree, but I need to exclude a few
> things. (Yell at me if this is an X/Y problem)
>
> My directory structure looks something like:
>
> Root/
> ├── Tupdefault
> ├── Tupfile
> ├── Tuprules.tup
> ├── Dir1/
> └── Dir2/
> ├── _inc/
> │ ├── a.h
> ├── _src/
> │ ├── a.c
> │ └── b.c
> ├── _test/
> │ ├── bad.c
> └── Subdir1/
> ├── _inc/
> │ └── d.h
> └── _src/
> ├── d.c
> └── e.c
>
> I want to compile ONLY those .c files which contained within a _src/
> folder. To do this, I wrote the following line:
> : foreach _src/*.c |> gcc-c %f -o %o |> %B.o Root/<objs>
>
> This should work great, except I get the following error:
> tup error: Expected node '_src' to be in directory 'Root/Dir1', but it is
> not there
>
> I understand WHY this error occurs, but I consider the behaviour a bit
> odd. If tup doesn't require there to be any .c files in a folder when glob
> is used, why does it require the subdirectory to exist? In any case, are
> there any good ways to fix this that don't involve renaming or moving files?
>
> --
> --
> 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.