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;








0















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?










share|improve this question
























  • 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

















0















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?










share|improve this question
























  • 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













0












0








0








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?










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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

















  • 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












1 Answer
1






active

oldest

votes


















1














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.






share|improve this answer























    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
    );



    );













    draft saved

    draft discarded


















    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









    1














    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.






    share|improve this answer



























      1














      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.






      share|improve this answer

























        1












        1








        1







        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.






        share|improve this answer













        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 23 at 11:47









        MadScientistMadScientist

        48.8k55570




        48.8k55570





























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현