1

I am trying to add a patch so that a software can compile and run correctly, unfortunately in order to add the change I am trying I always run into an annoying code style check error. Is there any way to skip this step?

1
  • Maybe, but not generically. You're more likely to get a useful answer if you post the makefile(s) (or at least the relevant parts). – Gilles 'SO- stop being evil' Nov 4 '20 at 21:39
4

If the makefile looks like this:

code-style-check: source.c
        tool-you-dont-have

myprogram: code-style-check source.c
        compile source.c -o myprogram

then you can avoid running tool-you-dont-have by creating a file called code-style-check:

touch code-style-check

Make will see that code-style-check is newer than source.c and won't try to rebuild it.

This doesn't work if code-style-check is a phony target declared with .PHONY: code-style-check: phony targets aren't file names.

Note that if code-style-check has dependencies, they won't count anymore for the sake of deciding whether to rebuild myprogram. It doesn't matter in the example above because code-style-check doesn't have any dependencies that myprogram doesn't have.

An alternative solution with GNU make that works even for a phony target is to run

make -o code-style-check …

The option -o tells make to consider code-style-check to be older than anything that's already there (unlike the touch approach which makes the file newer than anything that's already there), and also not to try to rebuild it. Once again, if dependencies of code-style-check were also needed for myprogram, they won't be built.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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