How to build and link a single source file change?

I have been exploring the 6.0.n source code from the nightly revisions on github, and running my resulting linux builds to provide RC feedback. In order to learn more, I added some debugging statements to my local copy of one source file. No problem, but I could save a lot of time if I could avoid running the lengthy full compile ( 31 minutes) and link steps thru the main waf script.

After spending some time looking at the waf python code, I have failed to discover how I could build only one ardour lib that I changed ( example libs/surfaces/generic_midi/ I see that there is a wscript under each ardour lib folder ( example …/libs/surfaces/generic_midi/wscript). I tried to run this as : “python wscript”, which appears to error on missing imports. I was hoping I wouldn’t have to learn python and learn to details of the waf build system.

I’m not looking for someone to do my dirty work. I just thought there may be an existing practice.
Can someone offer guidance on how to run just the one sub-folder wscript, with the needed environment variables, to build the one lib (build/libs/surfaces/generic_midi/
How to run only the link steps to produce the ardour executable?

I searched the online posts for related info but found none. Any advice is appreciated.

Are you saying that ./waf build rebuilds every single file and not just the one you changed and the ones that depended on that?
I haven’t checked it myself but it sounds strange; ‘make’ has been that smart for decades.

Are you running ./waf configure first? If you do then the config file gets renewed and that will probably force an entire rebuild.

If you’re changing a top-level file, which most of the others depend on, then you will get a mostly complete rebuild.

I have already previously run ./waf configure then ./waf. This does a full build.
Later I make a code change in one .cc file.

Now, when I run only ./waf - I get this message.
invalid lock file in /home/u/Dev/Ardour/ardour6.0.15
The project was not configured: run “waf configure” first!

This left me with no choice but to run ./waf configure again, which forces the full build.

The correct sequence is ./waf configure , ./waf build and optionally ./waf install.
If you change a file after running ./waf build you just run that command again and only the changed file and any ones depending on it will be recompiled.

I just tried it myself and it worked as intended.
In linux anyway; it should be the same in OS X, if that’s what you’re using, but I don’t have any first-hand knowledge there.

The home folder directory indicates Linux is more likely, on OS X it would be /Users/…

That being said, @MMP303 Peder is completely correct. WAF is fairly intelligent about rebuilds, and will rebuild what is needed. Note that is not the same as what was changed. The reason for this is that in recompiling that one file, depending on what file that is it may require rebuilding other files, or at the very least relinking, and WAF tries to determine the minimum amount of work needed to get a working program again with your changes.


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.