Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

out of tree builds? #2

Open
umlaeute opened this issue Oct 28, 2015 · 3 comments
Open

out of tree builds? #2

umlaeute opened this issue Oct 28, 2015 · 3 comments

Comments

@umlaeute
Copy link
Contributor

is it possible to build out-of-sourcetree builds (that is: running the build from a directory different from where the Makefile is)?

this can be very handy when building for multiple configurations (architectures, optimization,...)

@katjav
Copy link
Contributor

katjav commented Oct 30, 2015

Out-of-sourcetree builds would be a great thing to have but there's one reason I don't see how to implement that. It depends on VPATH, and VPATH needs automatic variables in recipes. Variable $^ expands to the prerequisites of a target. When prerequisites are object files only, this works. But Makefile.pdlibbuilder defines implicit dependencies (header files) as prerequisites too when doing non-clean builds. In that case I can't find a way to reference the object files in the recipe.

If you have a suggestion how to solve this catch I'm all ears.

@umlaeute
Copy link
Contributor Author

OK makes sense (and I don't have any suggestions).

Maybe it should be mentioned somewhere in the docs.

umlaeute added a commit to umlaeute/pd-lib-builder that referenced this issue Oct 31, 2015
@katjav
Copy link
Contributor

katjav commented Mar 30, 2016

This documentation by Paul D. Smith, maintainer of GNU make brought the topic to my mind again:

http://make.mad-scientist.net/papers/how-not-to-use-vpath/
http://make.mad-scientist.net/papers/multi-architecture-builds/

The second article illustrates several methods to build outside source directories. His favorite method implements a bunch of nifty make tricks. Not sure if these are compatible with Makefile.pdlibbuilder's own nifty tricks.

I'm now thinking that my earlier argument about $^ may not be relevant. For executables which are built directly from multiple source files (with implicit linking) the automatic variables can't be used. But such targets aren't defined in Makefile.pdlibbuilder. Maybe the automatic variables can be used throughout, and VPATH / vpath supported. That is only a first step (convenient but not even strictly required) towards out of source tree builds.

I'll keep this topic on my (admittedly not well-defined) agenda.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants