3

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
Dan
  • 5,929
  • 6
  • 42
  • 52

1 Answers1

0

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 $@ $<
Dan
  • 5,929
  • 6
  • 42
  • 52
  • You can actually use the built-in rule instead, by defining the `CPPFLAGS` and/or `CXXFLAGS` variables before the rule, because if you run `make -np` you'll see, that the built in rule defined something like `${COMPILE.cc} -c -o $@ $<`, where `COMPILE.cc` is set as something like `${CC} ${CXXFLAGS} ${CPPFLAGS}`—if it different, then it only extends these, as far as I know. – Adam L. S. Jul 02 '13 at 08:53