Reputation: 3801
I am using a custom compilation chain, and I have multiple targets that needs to be compiled, however they need to be compiled using different cxx compilers. Is this possible to do using automake? It seems it is not possible to do something like:
target_CXX = ...
Ideally I would want something like:
target1_SOURCES = ...
target2_SOURCES = ...
target1_CXX = ...
target1_CXXFLAGS = ..
target2_CXX = ...
targer2_CXXFLAGS = ...
Or even better actually, having target1 use the defined target1_CXX and target2 using the normal CXX flag.
Target1 should be a noinst, and only generate object files. These object files should be then used in target2 (defined using LDADD) to generate the full binary.
Thanks!
Upvotes: 3
Views: 677
Reputation: 16315
What you are describing can be done with autotools, but not easily. By default, autotools only uses one toolchain (the host toolchain, e.g. CC
, CXX
, etc.). It's also possible to use the build toolchain also.
What you're going to have to do in this situation will be very similar to what AX_PROG_CXX_FOR_BUILD
(the build toolchain macro referenced above, and its dependent macros) does. Basically, it makes another copy of all the C++ compiler tests with a different set of output variables.
Then something like:
$(target1_OBJECTS) := $(target1_SOURCES:.cc=.o)
$(target1_OBJECTS) : CXX = $(CXX_FOR_BUILD)
$(target1_OBJECTS) : CXXFLAGS = $(target1_CXXFLAGS)
$(target1_OBJECTS) : CPPFLAGS = $(CPPFLAGS_FOR_BUILD)
...
target2_LDADD = $(target1_OBJECTS)
might work to link them together.
Upvotes: 1