I am interested in using GNU Make on Windows. I created a tiny Makefile using a Pattern Rule:

all: abcd.o

%.o : %.c
    echo hi

However, when I attempt to make all,

D:\test>"C:\Program Files (x86)\GnuWin32\bin\make" -f Makefile.txt
make: *** No rule to make target `abcd.o', needed by `all'.  Stop.

I install GNU Make from this repository. The documentation that I found describes that this Makefile should work.

D:\test>"C:\Program Files (x86)\GnuWin32\bin\make" --version
GNU Make 3.81

How can I use pattern rules in GNU Makefiles on Windows?


make: *** No rule to make target abcd.o', needed byall'. Stop.

Your makefile contains:

all: abcd.o

%.o : %.c
    echo hi

This will only work if a file abcd.c exists or can be made (by another rule).

Thus, a rule of the form

%.o : %.c ; recipe…

specifies how to make a file n.o, with another file n.c as its prerequisite, provided that n.c exists or can be made.

Source 10.5.1 Introduction to Pattern Rules

Further reading


The file abcd.c needs to exist.

  • Close finish with @DavidPostill, but your answer doesn't answer the complete extent of the original question. – agtoever Mar 22 '15 at 22:13

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.