1

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?

2 Answers 2

1

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

-1

The file abcd.c needs to exist.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .