How do I simplify the following slice of a Makefile? Considering the following Makefile:

%.o: %.cpp
    $(C) $(CF) -c $&lt; -o $@

Audio/%.o: Audio/%.cpp
    $(C) $(CF) -c $&lt; -o $@

Game/%.o: Game/%.cpp
    $(C) $(CF) -c $&lt; -o $@

Generation/%.o: Generation/%.cpp
    $(C) $(CF) -c $&lt; -o $@

Input/%.o: Input/%.cpp
    $(C) $(CF) -c $&lt; -o $@

Particle/%.o: Particle/%.cpp
    $(C) $(CF) -c $&lt; -o $@

Screen/%.o: Screen/%.cpp
    $(C) $(CF) -c $&lt; -o $@

Utility/%.o: Utility/%.cpp
    $(C) $(CF) -c $&lt; -o $@


How can I simplify it so that it only depends on a list of directories, such as:

SUBD = Audio/\
 Game/\
 Generation/\
 Input/\
 Particle/\
 Screen/\
 Utility/
All of these rules

Audio/%.o: Audio/%.cpp
        $(C) $(CF) -c $&lt; -o $@

# etc.


are redundant!  Your first pattern rule

%.o: %.cpp
        $(C) $(CF) -c $&lt; -o $@


already covers them all.