Search code examples
windowswdk

Generate custom error message from makefile with WDK build tools


I'm compiling a driver using build.exe from the Windows Driver Kit.

The system which builds the drivers needs to have a specific environment variable set. If not, I want build to fail with a custom error message.

Does anyone have an idea on how to do that?

I already tried to output a message to stderr by adding this test to makefile.inc:

all:
    echo My Custom Error 1>&2

But the output doesn't show up and the build process doesn't fail. I do know that the all target is executed, as I have tested this by redirecting the output to a file.


Solution

  • Finally, I've found a solution.

    F.e.: if you add this to the makefile.inc, you will force it to fail:

    all:
        echo fatal error : Whatever error message you like
    

    Please use the exact format (and lower-casing) for the string "fatal error x", where x can be replaced with the message you want.