deplinenoise / tundra

Tundra is a code build system that tries to be accurate and fast for incremental builds
MIT License
438 stars 75 forks source link

Automatically add -fpic when building objects for a shared lib on linux #258

Closed twoscomplement closed 9 years ago

twoscomplement commented 9 years ago

Objects included in shared libs on x64 Linux need to be compiled with -fpic.

Is there a way to have tundra add -fpic to CCOPTS and CXXOPTS by default when building a shared lib? Seems like it would require a new env var and a little glue?

deplinenoise commented 9 years ago

Not in any elegant way; you can't really know when the build nodes for the objects are created that they will ultimately (only) be linked into a shared library.

deplinenoise commented 9 years ago

All it takes is a CCFLAGS = { "-fPIC"; Config = "linux-*-*" } in your tundra.lua, so I'm hesitant to add some auto-glue for this. One of the design ideas of Tundra is that explicit is better than implicit.