In GNU, you can do something like the following. Imagine that you want to generate .h and .cpp file names from a simple file name without the extension that should be added as the source of some rule. You can write:
define h_and_cpp_sources $(1).h $(1).cpp endef
This creates a Makefile macro that receives the first parameter as $(1) , the second as $(2) , etc. Then:
target: $(call h_and_cpp_sources,file) ...
This will build a rule:
target: file.h file.cpp
source share