Shraddha
Shraddha

Reputation: 2579

Debugging Makefile

Some Makefile contains this -

ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y)
        msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99);
        NO_LIBUNWIND := 1

and whenever I run this make , I get the error message as

warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99

I want to debug this problem - I want to know the values of SOURCE_LIBUNWIND, FLAGS_UNWIND which are causing this problem - how do I get these values printed on the stdout for debugging purpose ?

Upvotes: 3

Views: 2327

Answers (3)

Etan Reisner
Etan Reisner

Reputation: 81032

Reinier and Shraddha have the right answers for the question as asked but I'm not sure that's the right question to have asked.

It would seem to me (based on nothing more than the snippet of makefile posted) that those are more likely to be variables you can set than variables that are already set. That is they would be how you control the location used for locating libunwind.

So if the try-cc call is failing I'd assume that means you either don't have libunwind installed at all or that you have it installed in a non-standard system location and haven't set those variables to tell make about it.

Upvotes: 1

Reinier Torenbeek
Reinier Torenbeek

Reputation: 17383

GNU make provides several functions that you can use to print the value of a variable: $(error ...), $(warning ...) and $(info ...). The manual mentions them in section 8.12 Functions That Control Make.

Additionally, you can use the command-line parameter -p or --print-data-base to have make print the values of all rules and variables. Redirecting the output to a file and analyzing that might give you a better understanding of why the values are what they are. See section 9.7 Summary of Options for some extra information.

Upvotes: 4

Shraddha
Shraddha

Reputation: 2579

to print value of macro X in the makefile - just add line. ( kind of printf )

$(warning X is $(X))

Upvotes: 3

Related Questions