Actually, it is getconf which is used for maximum portability.
The POSIX manual has more on that.  It's a little-known but
quite a useful tool in the shell toolbox.

--Rakesh

----------------------------------------
> Date: Tue, 4 Aug 2015 13:49:06 +0200
> From: reinp...@win.tue.nl
> To: help-make@gnu.org
> Subject: Re: Conditional include directories
>
> On Tue Aug 4 04:03:32 2015, sharma...@hotmail.com (Rakesh Sharma) wrote:
>> One way can be as follows:
>>
>> ## pre-define your library directories based on the output of the "getconf" 
>> output format
>> LIB_32 := /stage2/lib/dbus-1.0/include
>> LIB_64 := /stage2/lib64/dbus-1.0/include
>>
>> # then compute the architecture of the machine running gmake
>> CFLAGS := -I$(LIB_$(strip $(shell getconf LONG_BIT)))
>>
>> ### now you are all set for using the CFLAGS in your build code.
>> ## you may want to incorporate some amount of error checking
>> # when the `getconf' command delivers output different than either 32 or 64.
>>
>> # another method could be to invoke the "uname -m" command.
>
> How portable is this software supposed to be?
>
> uname exists on all the Unixy systems I've used;
> I'm not sure about getconf, but I notice it exists on Cygwin.
>
> --
> Reinier Post
> TU Eindhoven
>
> _______________________________________________
> Help-make mailing list
> Help-make@gnu.org
> https://lists.gnu.org/mailman/listinfo/help-make
                                          
_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to