Makefile pattern rule for no extension?

gnu-make, makefile

Solution

This looks like a job for a static pattern rule:

$(apps) : % : %.o $(objects)
    $(link)

Problem

I have a bunch of applications that are built with the same type of make rule: ``` apps = foo bar baz all: $(apps) foo: foo.o $(objects) $(link) bar: bar.o $(objects) $(link) baz: baz.o $(objects) $(link) ``` If they had an extension (for example `.x`) I could make a pattern rule like: ``` %.x: %.o $(objects) $(link) ``` and I wouldn't have to write out a new rule for each app. But they don't have an extension, and I'm pretty sure that: ``` %: %.o $(objects) $(link) ``` won't work (because it specifies that to build any file you can use this rule). Is there anyway to specify one rule that will cover all the `$(apps)` build rules?

Original source