1

I'm trying to find a line from the makefile, and have the following output when I run make clean:

rm -f     ../../lib/i386/ ../../lib/i386/
rm: cannot remove `../../lib/i386/': Is a directory

The above first line is the command. The second is the error. I know how to fix the error, but I don't know where the first line is being called.

Note: The problem is compounded because I don't exactly know which makefile this is coming from. We have several include statements that traverse several makefiles. For instance...

include make_example.inc

make_example.inc contains:

include make_example_example.inc

EDIT: I'm looking for a built in way to show which line from which makefile error. Is there anything like this built into makefiles or a tool that can do this? Using find and grep can take lots of time depending on the situation. The above is just an example.

1
  • 2
    remake or make -d will probably give you a clue Aug 15, 2014 at 1:22

2 Answers 2

2

If you're using a new-enough version of GNU make, you can use the --trace flag.

1

in the root of your source directory, run:

find . -name "make*" | xargs grep -n "../../lib/i386"

(*Assumes all your makefiles start with "make" and that you are on a unix-like OS)

Based on the below comment, also try:

find . -name "make*" | xargs grep -n "rm -f"

2
  • 3
    it also assumes the directory appears verbatim, but it could be coming from something like $(LIBDIR)/$(TARGET). Searching for rm might be a better bet, but some makefiles use $(RM) or $(RM_F) so even that could be unreliable. Aug 14, 2014 at 23:55
  • I provided that as an example, sorry. I guess there is no general way to turn on which line from which makefile. Aug 15, 2014 at 0:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.