OK, I think I've got a proposal for nice solution which would be
"lua-compatible", but currently doesn't work.
function compile_all(inputs)
tup.foreach_rule(inputs, "$(CXX) $(CXXFLAGS) " ..
tostring(CXXFLAGS_["%f"]) .. " -c %f -o %o", {'%B.o'})
end
To use:
CXXFLAGS_ = {}
CXXFLAGS_["whatever-file-name-you-wish.cpp"] += "-DBLAHBLAH=1"
Above doesn't work, because %f is not substituted in the rule, so the
table is searched for actual "%f" instead of the current file name.
If I put the name of file into the [] operator it works almost fine
(apart from the fact that it's no longer file-specific), because when
there is no string at that index you get "nil" output because of the
tostring(). But you cannot omit this function - otherwise lua protests:
attempt to concatenate field '%f' (a nil value)
The last awkwardness is that you need to explicitly create the table
with CXXFLAGS_ = {}, otherwise lua fails with:
attempt to index global 'CXXFLAGS_' (a nil value)
Would that be possible to make that syntax work? Maybe there is an
alternative? I know that the problem is solved by NOT using foreach_rule
but a "single file fule" - where you know the file name in advance - but
foreach is really important for simple builds...
Regards,
FCh
--
--
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.