Why is gnu make ignoring my explicit pattern rule and using a built-in implicit rule instead?

1.4k views Asked by At

My makefile has this rule/recipe:

%o: %cpp Makefile
    g++ -Wall -Wextra -MMD -MP -O2 -c -o $@ $<

This worked fine until I upgraded Cygwin recently and got Make 3.82.90 (previous version was probably 3.81).

Now with make 3.82, it ignores my rule and instead uses a built-in rule to compile each file, such as:

g++    -c -o Foo.o Foo.cpp
1

There are 1 answers

1
Dan On

My pattern didn't have dots (periods) separating the percent-sign and the extension. Problem solved by changing to this:

%.o: %.cpp Makefile
    g++ -Wall -Wextra -MMD -MP -O2 -c -o $@ $<