help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple way to ascertain whether we're running on Windows?


From: Greg Chicares
Subject: Re: Simple way to ascertain whether we're running on Windows?
Date: Wed, 27 Jul 2005 09:29:13 -0400
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

On 2005-07-27 06:21 AM, Angus Leeming wrote:
> 
> [attachment] works on both linux and Windows, but currently appends a ".exe"
> extension to the executable names, so:
> 
> EXEEXT          = .exe
> DT2DV           = dt2dv$(EXEEXT)
> DV2DT           = dv2dt$(EXEEXT)
> 
> Is there a simple way to do so on Windows only? In pseudo code:
> 
> if Windows
>   EXEEXT = .exe
> else
>   EXEEXT =
> endif

I have a submakefile for each platform, e.g.

  # in posix.makefile :
  EXEEXT :=
  # ... many other platform-specific definitions

  # in msw.makefile :
  EXEEXT := .exe

and I include the appropriate one based on 'uname':

  uname := $(shell uname -s 2>/dev/null)
  platform-makefile := posix.makefile
  ifeq (MINGW,$(findstring MINGW,$(uname)))
    platform-makefile := msw.makefile
  else
  [handle unames containing other strings like "CYGWIN" similarly]

  include $(src_dir)/$(platform-makefile)

If you use an msw platform that (unlike MinGW or cygwin) doesn't
provide 'uname', then you could write a script like

  #!/usr/bin/sh
  echo

for that platform, and treat it as a default case (empty result
from 'uname' implies msw).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]