%% “Jim Lambert” <firstname.lastname@example.org> writes:
jl> What is the standard (if any) way of cross-platform development in
jl> C for both Linux and QNX? Do the majority of you just compile
jl> with an environment variable sent to make? Is there an
jl> environment variable that exists in both shells that can be used
jl> as the comparison instead of compiling with a command line env
jl> var? I’m just curious as to what are the normal ways that most of
jl> you do cross-platform development.
You mean, how do you tell inside a makefile what your host platform is?
That’s simple, since both QNX and Linux use GNU make. Try something
HOST_OS := $(shell uname -s)
then $(HOST_OS) will be “Linux” on a Linux box, and “QNX” on QNX.
Of course, remember if you’re cross-compiling what you really care about
is the target platform, not the host platform (except insofar as you
need to find the right cross-compiler), and obviously there’s no way to
“deduce” that if you can build for more than one. The user will have to
specify which one she wants.
Paul D. Smith <email@example.com> HASMAT–HA Software Mthds & Tools
“Please remain calm…I may be mad, but I am a professional.” --Mad Scientist
These are my opinions—Nortel Networks takes no responsibility for them.