Ask questions via twitter! Message any question to @answers on twitter. We'll publish the question and send you a reply each time there's a new answer.
Next Question

Answered Question

 
February 18, 2009 12:35 AM

How do I find the original target in a makefile?

My makefile can be invoked by any one of many top level makefiles. Some of the top level makefiles use a default target of 'lib', or 'releaselib', or 'debuglib'. When my makefile is invoked, I just know that 'lib' is a prerequisite of something, but I would like to be able to figure out the top-level target of the dependency tree.
Interesting Question?  Yes (0)   No (0)   
RSS
 
 

Best Answer  Chosen by Asker

 
February 20, 2009 01:38 AM
Are you looking for your lower level makefile to behave differently depending on what the top-level target was? If so, I think you'd have to have the top-level make files export the target name into an environment variable and have your makefile read that (and check $(MAKELEVEL), too, if you're using gnumake).


Helpful Answer?  (0)   (0)    Tip abbotofunreason for this answer
Permalink | Report
   Reply  
 
 
 
February 20, 2009 01:42 AM
I should have said that answer assumes you are calling make with $(MAKE) or something. It doesn't help if your top-level make file is getting the lower-level one through an include.

Report
 
 

Answer this Question

How tips and payments work

This question has already been resolved. You may add an answer to it but you will not be eligible to win best answer or any associated tips.

Ask a Question


140 characters left
Top of Page
Buy Mahalo Dollars with Credit Card or PayPal

Top Members

This Week All Time
  • buddawiggi
    buddawiggi
    2nd Degree Black Belt
    26710 Points
    M$774.34 Earned
  • kty2777
    kty2777
    Purple Belt with a Brown Tip
    5216 Points
    M$196.67 Earned
  • opher
    opher
    Purple Belt
    3852 Points
    M$152.92 Earned
   See All
 

Most Popular Tags

mahalo(1566)
iphone(460)
music(458)
google(346)
food(312)
online(287)
beer(277)
money(260)
movies(249)
apple(249)
aotd(235)
health(217)
video(201)
free(200)
dog(200)
   See All
 

Categories

Welcome New Members


 
 
Mahalo Dollars are the currency of Mahalo Answers.

Each Mahalo Dollar costs $1.

Once you earn more than 40 Mahalo Dollars, you can request to be paid via PayPal. Each Mahalo Dollar is currently worth $0.75 when paid out via PayPal. Learn More

 
 

Please log in to use this function.