Question

I'm trying to modify an existing makefile.am to include a rule to convert the *.rc extension into a resource file. Here's as far as I can currently get.

mytarget_SOURCES += ico.rc

.rc.o:
    windres -i $< $@

As is described here: http://www.gnu.org/software/automake/manual/html_node/Suffixes.html In the generated makefile, ico.rc is added to the sources, and ico.o is added to the objects (so that's good I guess).

At the end of the makefile a this .rc.o rule is literally pasted, but I am doubting that should be the case, right? The .rc.o is supposed to be an automake rule, but it isn't a good make rule for creating the ico.o file, is it?

When make is run, it remakes the makefile and then goes on to complain on there being no rule to make ico.o. windres, or whatever I put there (e.g. an echo) is never run. I've tried googling, but information is scarce, and most I've been able to find is copies of the link I gave above. What am I doing wrong?

Était-ce utile?

La solution

Automake simply copies make rules into the generated Makefile verbatim. So as long as what you write is valid makefile syntax, it's OK.

What you have there is part of a valid implicit suffix rule in make. However, you're missing that you need to define .rc as a valid suffix (the .o is part of the built-in suffix list so you don't have to add it, unless you just want to be complete).

Add this to your Makefile.am as well:

.SUFFIXES: .rc

See http://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html for more details.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top