Boost logo

Boost-Build :

From: Jurko Gospodnetić (jurko.gospodnetic_at_[hidden])
Date: 2008-08-26 08:02:01

   Hi John.

> I've been trying to setup a system for running pc-lint on my source
> files, but I'm having a hard time figuring out the right way to setup a
> rule to do so.
> Basically, I want a rule that depends on the input *.lnt file along with
> all the source files, so that if any of those changes, it runs it
> again. My main 'exe' rule will also have the 'lint' rule as a
> dependency so that if pc-lint fails it won't even bother compiling the
> application. Can someone just point me in the right direction to get
> this working? I thought using the 'notfile' rule as a basis would make
> sense since it doesn't actually output any files, but is that not the
> right approach?

   So you have source files (i.e. not built by the build system):


   and you want to build from them:

     a.exe <-- a1.cpp a2.cpp


     a-lint <-- a.lnt a1.cpp a2.cpp

   where a-lint would simply run some sort of a test action that can
either fail or succeed and not generate any new files.

   Well if that are all the requirements then I think notfile would suit
you just fine and your action can simply return 0 if it 'succeeds' or
any other value if it 'fails'.

   If your test action generates some files that your would like Boost
Build to know about (e.g. to remove them when doing a clean) then you
would need to modify your approach by using either a custom target (or a
custom generator but I do not see your target as a typed one at the
moment) or either the make or the generate rule.

   Another, perhaps too smart for its own good, idea would be to prepare
a new typed target for a-link which actually builds all of its sources
and runs the test rule but also returns all of its sources except the
.lnt file as its output virtual-targets. That would allow you to do
something like this:

     a-lint <-- a.lnt a1.cpp a2.cpp
     a.exe <-- a-lint

   and the exe target would be built from the original sources that get
'linted' in the process. I would not go this way without getting the
notfile solution working first.

   Hope this helps.

   Best regards,
    Jurko Gospodnetić

Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at