I have added such a function as a loadable library before - you might consider that if you can't get it done another way.
look at hash.c. To try it :
I called the function siphash24 because that's what I used - and its' definitely not cryptographic. I had similar needs such as generating unique target names from many inputs where I didn't want the target name to be of unlimited length or to have illegal characters.
$(shell) was useless as it is far too slow.
I would suggest having $(hash) and $(<hash-alg>) - because then people who care about the algorithm will be able to choose it.
FYI loadable modules are quite cool:
SOURCES:=proga.c progb.c
OBJECTS:=$(SOURCES:.c=.o)
include ../xtra.mk
XTRA_OUTPUTDIR:=.
XTRA_SOURCE:=..
-load $(XTRA_OUTPUTDIR)/hash$(XTRA_EXT)
LIBVERSION:=$(siphash24 $(SOURCES))
LIBNAME:=prog_$(LIBVERSION).so
$(LIBNAME): $(OBJECTS)
cc -o $@ $^ -shared
$(OBJECTS) : %.o : %.c
cc -c -o $@ -fPIC $^
The above will build the $(siphash24) function (if it's not there already) and then use it.