How can I get the dependencies of a target in a recursive makefile?In a makefile, is a directory name a phony target or “real” target?Makefile target with makefile as dependencyMakefiles, targets as dependenciesHow to Get a List of Direct Dependencies on a Makefile TargetHow to handle dependencies from recursive Makefile invocations?Is the first target in Makefile an implicit phony target?How to make a target in make that is itself named 'makefile'?How to create non-dependent phony targets in a GNU Makefile?How to determine if Make target is a PHONY?Define target for recursive makefiles invocation
Does a member have to be initialized to take its address?
What are some possible reasons that a father's name is missing from a birth certificate - England?
Help decide course of action for rotting windows
Limit of an integral vs Limit of the integrand
Is the homebrew weapon attack cantrip 'Arcane Strike' balanced?
Washer drain pipe overflow
How do I tell my supervisor that he is choosing poor replacements for me while I am on maternity leave?
Is there a faster way to calculate Abs[z]^2 numerically?
Adding slope values to attribute table (QGIS 3)
Should these notes be played as a chord or one after another?
Is there any evidence to support the claim that the United States was "suckered into WW1" by Zionists, made by Benjamin Freedman in his 1961 speech?
LocalDate.plus Incorrect Answer
How old is Captain America at the end of "Avengers: Endgame"?
Why was this sacrifice sufficient?
Why was the Ancient One so hesitant to teach Dr. Strange the art of sorcery?
On studying Computer Science vs. Software Engineering to become a proficient coder
How to pronounce "r" after a "g"?
Is the schwa sound consistent?
Is there a need for better software for writers?
Would an 8% reduction in drag outweigh the weight addition from this custom CFD-tested winglet?
Will change of address affect direct deposit?
How can I answer high-school writing prompts without sounding weird and fake?
We are two immediate neighbors who forged our own powers to form concatenated relationship. Who are we?
Is it a Munchausen Number?
How can I get the dependencies of a target in a recursive makefile?
In a makefile, is a directory name a phony target or “real” target?Makefile target with makefile as dependencyMakefiles, targets as dependenciesHow to Get a List of Direct Dependencies on a Makefile TargetHow to handle dependencies from recursive Makefile invocations?Is the first target in Makefile an implicit phony target?How to make a target in make that is itself named 'makefile'?How to create non-dependent phony targets in a GNU Makefile?How to determine if Make target is a PHONY?Define target for recursive makefiles invocation
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
When a project depends on some other project which has its own makefile, recursive make is used like this:
LIBDIR := path/to/lib
LIBNAME := library.a
LIBPATH := $(LIBDIR)/$(LIBNAME)
$(LIBPATH):
$(MAKE) -C $(LIBDIR) $(LIBNAME)
However the obvious problem with this is that make is unable to determine the dependencies of the $(LIBPATH)
because it's defined in the recursive makefile in $(LIBDIR)
.
What I'm currently doing is using a .PHONY target to force the check if the sub-project needs rebuilding:
$(LIBPATH): always_build
$(MAKE) -C $(LIBDIR) $(LIBNAME)
.PHONY: always_build
While this allow me to trigger rebuild when it needed it still needs to walk through a lot of directories and invoke make a lot of times, just to find out nothing needs to be done.
Is there a way to get the dependencies out of the sub-makefile so I can add them as a dependencies of the $(LIBPATH)
so the sub-makefile is only invoked when it really need to be invoked?
makefile gnu-make
add a comment |
When a project depends on some other project which has its own makefile, recursive make is used like this:
LIBDIR := path/to/lib
LIBNAME := library.a
LIBPATH := $(LIBDIR)/$(LIBNAME)
$(LIBPATH):
$(MAKE) -C $(LIBDIR) $(LIBNAME)
However the obvious problem with this is that make is unable to determine the dependencies of the $(LIBPATH)
because it's defined in the recursive makefile in $(LIBDIR)
.
What I'm currently doing is using a .PHONY target to force the check if the sub-project needs rebuilding:
$(LIBPATH): always_build
$(MAKE) -C $(LIBDIR) $(LIBNAME)
.PHONY: always_build
While this allow me to trigger rebuild when it needed it still needs to walk through a lot of directories and invoke make a lot of times, just to find out nothing needs to be done.
Is there a way to get the dependencies out of the sub-makefile so I can add them as a dependencies of the $(LIBPATH)
so the sub-makefile is only invoked when it really need to be invoked?
makefile gnu-make
In fact, it's the main reason "why recursive make considered harmful". Rewrite it to be non-recursive or just live with it.
– Matt
Mar 23 at 12:18
This github.com/igagis/prorab should help you get started with non-recursive make fast
– igagis
Mar 24 at 12:41
add a comment |
When a project depends on some other project which has its own makefile, recursive make is used like this:
LIBDIR := path/to/lib
LIBNAME := library.a
LIBPATH := $(LIBDIR)/$(LIBNAME)
$(LIBPATH):
$(MAKE) -C $(LIBDIR) $(LIBNAME)
However the obvious problem with this is that make is unable to determine the dependencies of the $(LIBPATH)
because it's defined in the recursive makefile in $(LIBDIR)
.
What I'm currently doing is using a .PHONY target to force the check if the sub-project needs rebuilding:
$(LIBPATH): always_build
$(MAKE) -C $(LIBDIR) $(LIBNAME)
.PHONY: always_build
While this allow me to trigger rebuild when it needed it still needs to walk through a lot of directories and invoke make a lot of times, just to find out nothing needs to be done.
Is there a way to get the dependencies out of the sub-makefile so I can add them as a dependencies of the $(LIBPATH)
so the sub-makefile is only invoked when it really need to be invoked?
makefile gnu-make
When a project depends on some other project which has its own makefile, recursive make is used like this:
LIBDIR := path/to/lib
LIBNAME := library.a
LIBPATH := $(LIBDIR)/$(LIBNAME)
$(LIBPATH):
$(MAKE) -C $(LIBDIR) $(LIBNAME)
However the obvious problem with this is that make is unable to determine the dependencies of the $(LIBPATH)
because it's defined in the recursive makefile in $(LIBDIR)
.
What I'm currently doing is using a .PHONY target to force the check if the sub-project needs rebuilding:
$(LIBPATH): always_build
$(MAKE) -C $(LIBDIR) $(LIBNAME)
.PHONY: always_build
While this allow me to trigger rebuild when it needed it still needs to walk through a lot of directories and invoke make a lot of times, just to find out nothing needs to be done.
Is there a way to get the dependencies out of the sub-makefile so I can add them as a dependencies of the $(LIBPATH)
so the sub-makefile is only invoked when it really need to be invoked?
makefile gnu-make
makefile gnu-make
edited Mar 23 at 10:51
Calmarius
asked Mar 23 at 10:30
CalmariusCalmarius
8,8311380122
8,8311380122
In fact, it's the main reason "why recursive make considered harmful". Rewrite it to be non-recursive or just live with it.
– Matt
Mar 23 at 12:18
This github.com/igagis/prorab should help you get started with non-recursive make fast
– igagis
Mar 24 at 12:41
add a comment |
In fact, it's the main reason "why recursive make considered harmful". Rewrite it to be non-recursive or just live with it.
– Matt
Mar 23 at 12:18
This github.com/igagis/prorab should help you get started with non-recursive make fast
– igagis
Mar 24 at 12:41
In fact, it's the main reason "why recursive make considered harmful". Rewrite it to be non-recursive or just live with it.
– Matt
Mar 23 at 12:18
In fact, it's the main reason "why recursive make considered harmful". Rewrite it to be non-recursive or just live with it.
– Matt
Mar 23 at 12:18
This github.com/igagis/prorab should help you get started with non-recursive make fast
– igagis
Mar 24 at 12:41
This github.com/igagis/prorab should help you get started with non-recursive make fast
– igagis
Mar 24 at 12:41
add a comment |
1 Answer
1
active
oldest
votes
If you mean, in an automated way then no. Even if there were it wouldn't make any sense.
In order to get those prerequisites you'd have to invoke make to compute them. Once that sub-make had computed them it would inform the parent make and the parent make would check the prerequisites then if any were out of date it would invoke the sub-make again which would re-compute the prerequisites to actually build the target.
Far from being MORE efficient, you'd actually be doing about three times as much work!
In a recursive make scenario, your current method of delegating the out-of-date computation to a sub-make is the best you can do.
What you're really asking is to use a non-recursive make environment where a single instance of make knows all the prerequisites and determines what is out of date. Note, however, that this does not really solve the problem of "not reading lots of makefiles".
Ultimately you can't know that your project is completely up to date, without checking that it's completely up to date... which means checking all the dependency relationships.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55312780%2fhow-can-i-get-the-dependencies-of-a-target-in-a-recursive-makefile%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you mean, in an automated way then no. Even if there were it wouldn't make any sense.
In order to get those prerequisites you'd have to invoke make to compute them. Once that sub-make had computed them it would inform the parent make and the parent make would check the prerequisites then if any were out of date it would invoke the sub-make again which would re-compute the prerequisites to actually build the target.
Far from being MORE efficient, you'd actually be doing about three times as much work!
In a recursive make scenario, your current method of delegating the out-of-date computation to a sub-make is the best you can do.
What you're really asking is to use a non-recursive make environment where a single instance of make knows all the prerequisites and determines what is out of date. Note, however, that this does not really solve the problem of "not reading lots of makefiles".
Ultimately you can't know that your project is completely up to date, without checking that it's completely up to date... which means checking all the dependency relationships.
add a comment |
If you mean, in an automated way then no. Even if there were it wouldn't make any sense.
In order to get those prerequisites you'd have to invoke make to compute them. Once that sub-make had computed them it would inform the parent make and the parent make would check the prerequisites then if any were out of date it would invoke the sub-make again which would re-compute the prerequisites to actually build the target.
Far from being MORE efficient, you'd actually be doing about three times as much work!
In a recursive make scenario, your current method of delegating the out-of-date computation to a sub-make is the best you can do.
What you're really asking is to use a non-recursive make environment where a single instance of make knows all the prerequisites and determines what is out of date. Note, however, that this does not really solve the problem of "not reading lots of makefiles".
Ultimately you can't know that your project is completely up to date, without checking that it's completely up to date... which means checking all the dependency relationships.
add a comment |
If you mean, in an automated way then no. Even if there were it wouldn't make any sense.
In order to get those prerequisites you'd have to invoke make to compute them. Once that sub-make had computed them it would inform the parent make and the parent make would check the prerequisites then if any were out of date it would invoke the sub-make again which would re-compute the prerequisites to actually build the target.
Far from being MORE efficient, you'd actually be doing about three times as much work!
In a recursive make scenario, your current method of delegating the out-of-date computation to a sub-make is the best you can do.
What you're really asking is to use a non-recursive make environment where a single instance of make knows all the prerequisites and determines what is out of date. Note, however, that this does not really solve the problem of "not reading lots of makefiles".
Ultimately you can't know that your project is completely up to date, without checking that it's completely up to date... which means checking all the dependency relationships.
If you mean, in an automated way then no. Even if there were it wouldn't make any sense.
In order to get those prerequisites you'd have to invoke make to compute them. Once that sub-make had computed them it would inform the parent make and the parent make would check the prerequisites then if any were out of date it would invoke the sub-make again which would re-compute the prerequisites to actually build the target.
Far from being MORE efficient, you'd actually be doing about three times as much work!
In a recursive make scenario, your current method of delegating the out-of-date computation to a sub-make is the best you can do.
What you're really asking is to use a non-recursive make environment where a single instance of make knows all the prerequisites and determines what is out of date. Note, however, that this does not really solve the problem of "not reading lots of makefiles".
Ultimately you can't know that your project is completely up to date, without checking that it's completely up to date... which means checking all the dependency relationships.
answered Mar 23 at 11:47
MadScientistMadScientist
48.8k55570
48.8k55570
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55312780%2fhow-can-i-get-the-dependencies-of-a-target-in-a-recursive-makefile%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
In fact, it's the main reason "why recursive make considered harmful". Rewrite it to be non-recursive or just live with it.
– Matt
Mar 23 at 12:18
This github.com/igagis/prorab should help you get started with non-recursive make fast
– igagis
Mar 24 at 12:41