Skip to content
 

ctags with bjam and eliminating user-config.jam

I added a rule to rebuild my tags file whenever the sources change. It took me way too long to figure this out – I was very surprised that a google search for ‘bjam ctags’ turned up nothing.

make tags : [ glob *.cc ] [ glob *.h ] [ glob lib/*.cc ] [ glob include/*.h ] : @ctags ;
actions ctags
{
    ctags $(>)
    cp tags $(<)
}

I can’t figure out how to make targets appear in the project root instead of the build dir. However bjam runs ctags in the project root, so ctags will do the right thing. I copy the generated tags file to the location bjam expects so versioning still works. Note that $(>) refers to the sources and $(<) to the target. See Chapter 5->Custom Command for more info. There is also a nofile rule, which runs a command unconditionally.

Meanwhile I discovered that I could get rid of my $HOME/user-config.jam. I moved it to project-root.jam in my project root, renamed my Jamroot to Jamfile, and then it worked as before. Interestingly I can also rename project-root.jam to Jamroot, so I have a Jamroot and Jamfile in my top level project directory. Maybe project-root.jam and Jamroot serve the same purpose? In any case I prefer this setup because it removes clutter in my homedir and those settings really are project specific.

Leave a Reply