I want to remove the duplication of recipe in a makefile like the following
SHELL := /bin/bash
a_% : a1_% a2_%       
          cat $^ > $@                                                                                                                             
b_% : b1_% b2_%   %_b3                                                                                                                         
          cat $^ > $@   
However the following does not work. I guess the trick in this SO question does not work with pattern rules.
SHELL := /bin/bash
a_% : a1_% a2_%       
b_% : b1_% b2_%   %_b3                                                                                                                         
a_% b_%:
          cat $^ > $@   
Any suggestions ? ( In my original makefile, recipe duplication is occurring in 4 targets, and each of those take 3 substitutions, so I can't unroll the targets)
--EDIT-- I realized that one way to solve this was the following.
CMD1 = cat $^ > $@
a_% : a1_% a2_%       
         $(CMD1)
b_% : b1_% b2_%   %_b3
        $(CMD1)