I would like to request a feature for GNU Automake if it is
possible.
When building programs and libraries with GNU Autotools (libtool,
aclocal, automake, and autoconf) it is sometimes desirable to
compile the same source with a custom compiler (other than CC,
CXX, etc.). A sample use case is to compile the same source file
for multiple device accelerator architectures (CUDA, HIP, CPU,
etc.) into a specific program or library.
In this use case, the same source modules need to be compile and
linked into a device specific program or library. Since the same
source would be compiled for multiple devices, it would be
advantageous to compile the source with multiple compilers within
a single Makefile.am. The desire would be to specify the compiler
on a per-program (or per-library) basis in keeping with the
ability to specify program and library variables (`maude_CFLAGS',
`maude_LINK', etc.). The suggestion would be to add new variables
(`maude_CC', `maude_CXX', etc.) and use those in the custom object
targets (`maude-%.o: %.c' where the stem is expanded) in place of
$(CC), $(CXX), etc..
An example Makefile.am would contain the following:
And, as an example, the generated rule for compiling source.c for libcuda.la would be generated as ($CC replaced with $libcuda_la_CC):
libcuda_la-source.lo: source.cIs this possible and acceptable?
If there is another way to accomplish this task, I am open to it.
However, I have researched the topic with documentation searches
and failed AI chats and have not discovered an elegant solution.
Thank you for all of the great work,
Bill