Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging Makefile for target that is not being built

I need some help debugging a Makefile system. I have a rather huge Makefile dependency tree, actually the Android source makefile system.

At some point the build fails because a file is missing:

/bin/bash: out/host/linux-x86/bin/mkfs.ubifs: No such file or directory

The file mkfs.ubifs is supposed to be "build" during the make process, and indeed it works if I do:

make out/host/linux-x86/bin/mkfs.ubifs

The mkfs.ubifs is build, and everything is working, until I again clean everything and build from the beginning.

This indicates to me, that there is a missing dependency somewhere. So my question is, how do I go about debugging this? How do I discover exactly which target is missing a dependency? What options can I provide for make which will give me clues as to where the error is?

Any other suggestions will also be appreciated. Thanks. :)

Update

Using make -d provides quite a lot of output. How exactly do I determine from which make target (sourcefile and line) and error occurred?

like image 426
Bjarke Freund-Hansen Avatar asked Jan 18 '23 17:01

Bjarke Freund-Hansen


1 Answers

Problem solved. It seems make -p was the most useful way to debug this problem:

-p, --print-data-base
    Print  the data base (rules and variable values) that results from
    reading the makefiles; then execute as usual or as otherwise spec-
    ified.   This  also prints the version information given by the -v
    switch (see below).  To print the  data  base  without  trying  to
    remake any files, use make -p -f/dev/null.

From that output it is relatively easy to determine which target was failing, and what dependency that should be included.

like image 57
Bjarke Freund-Hansen Avatar answered Jan 30 '23 23:01

Bjarke Freund-Hansen