What is the best way to port a software project with thousands of .cpp files and associated headers in a fairly well structured source tree to the tup build system?
If the tree looks like:
colors/
primaries/
red.cpp
green.cpp
blue.cpp
fruity/
orange.cpp
grape.cpp
grayscale/
white.cpp
gray.cpp
black.cpp
some/annoying/nesting/animals/
horse.cpp
bear.cpp
for tens of categories with tens of target files in each, it really seems like a rather inelegant solution to write one-time use shell scripts to dump out Tupfiles in each directory, even if they are ~mostly similar thanks to sharing a Tuprules.tup. What is the right, "best practice", hopefully portable way to do build projects like this with tup?
With the recent addition of (still not well documented) LUA parser you can avoid having one Tupfile per directory. Take a look here http://gittup.org/tup/lua_parser.html read about Tupdefault.lua
Additionally - with recent change that allows output files in DIFFERENT folder you can simlify that even more. You can compile the files "somewhere", adding them to a global group(s), and then - when you need it, link/archive them all.
Simple Tuprules.tup:
TOP = $(TUP_CWD)
!cc = |> gcc $(CFLAGS) -c %f -o %o |> %B.o $(TOP)/<objects>
Simple Tupfile just for compilation (generic one, without modification to flags or sth):
include_rules
: foreach *.c |> !cc |>
Simple Tupfile for compilation and final linking (notes as above):
include_rules
: foreach *.c |> !cc |>
: $(TOP)/<objects> |> gcc %<objects> -o %o |> application.exe
Unfortunately I don't (yet) know how to use this particular feature (global groups) with LUA parser. I even asked about that on tup-users mailing list.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With