Hello, Yes, look at the OCaml Makefile, it does exactly what you are asking for.
You need target-specific variables. With older versions of GNU Make thes variables are propagated backwards to the prerequisites of those targets, to their own prereqs etc. and there is no easy way to escape that. But with newer versions of GNU make you can use the private keyword so that a varialbe dfinition is local to one rule. For the OCaml Makefilelook at the rules for object files under runtime/ Seb.
