Recognizing host OS

Mark Jaffe markie@osafoundation.org
Thu Jun 3 18:45:00 GMT 2004


I am very perplexed by this situation, and I wonder if I am alone. When 
compiling our sources (mixed environments supported) I am discovering 
that when run on cygwin (host WinXP env) the make script is failing to 
properly identify the OS. I have documented this here:
(in the following, REAL_OS is determined in the subject Makefile thus:
REAL_OS=unknown

ifeq ($(OS),Cygwin)
   REAL_OS=WINNT
endif

ifeq ($(OS),WINNT)
   REAL_OS=WINNT
endif
OS and PLATFORM are determined in an included Makefile.inc thus:
OS=$(shell uname)

ifeq ($(findstring CYGWIN,$(OS)),CYGWIN)
OS=Cygwin
endif

ifeq ($(findstring WINNT,$(OS)),WINNT)
OS=Cygwin
endif

ifeq ($(OS),Cygwin)
PYTHON:=$(PREFIX)/bin/$(PYTHON).exe
SITE=bin/Lib/site-packages
PLATFORM=windows
else
ifeq ($(OS),Darwin)
FRAMEWORK=Library/Frameworks/Python.framework/Versions/2.3
PYTHON:=$(PREFIX)/$(FRAMEWORK)/bin/$(PYTHON)
SITE=$(FRAMEWORK)/lib/python2.3/site-packages
PLATFORM=macosx
else
PYTHON:=$(PREFIX)/bin/$(PYTHON)
SITE=lib/python2.3/site-packages
PLATFORM=linux
endif
endif
)

dummy:
         @echo "OS is" $(OS) "real OS is " $(REAL_OS) " platform is " 
$(PLATFORM)
         @something=$(findstring WIN,$(OS))
         @echo $(something)

and running it four times in a row without any other changes yielded 
this result:
builder@haleakala ~/new-extern/external/openssl
$ make dummy
OS is Cygwin real OS is  WINNT  platform is  windows


builder@haleakala ~/new-extern/external/openssl
$ make dummy
OS is CYGWIN_NT-5.1 real OS is  unknown  platform is  linux


builder@haleakala ~/new-extern/external/openssl
$ make dummy
OS is Cygwin real OS is  WINNT  platform is  windows


builder@haleakala ~/new-extern/external/openssl
$ make dummy
OS is real OS is  unknown  platform is  linux


-- 
Mark Jaffe               | (415) 946-3028 (work)
Release Engineer         | (408) 807-2093 (cell)
OSAF                     | (415) 946-3001 (FAX)
markie@osafoundation.org | http://www.osafoundation.org/
PGP Fingerprint: 3435 EB88 6424 F5DF F2CA EF16 2DBF DFEF 143C 1ADE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2208 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20040603/689ab283/attachment.bin>


More information about the Cygwin mailing list