X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 	tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: sourceware.org
To: cygwin@cygwin.com
From: Eric Lilja <mindcooler@gmail.com>
Subject:  Reliably check if we're running under cygwin inside Makefile
Date:  Mon, 12 Jan 2009 13:19:37 +0100
Lines: 22
Message-ID: <gkfcgt$m9j$1@ger.gmane.org>
Mime-Version:  1.0
Content-Type:  text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding:  7bit
User-Agent: Thunderbird 2.0.0.19 (Windows/20081209)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

Hello, I have a program that will built both under fedora and under 
cygwin. The program is written in C and the Makefile is slightly 
different between the two systems. Is it possible to check some 
environment variable in the makefile to determine what to do?

The source code itself have constructs like these for parts that differ 
between cygwin and fedora:
#if defined __CYGWIN__
    /* Turn on vsync, this works on Cygwin. */
    SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
#elif defined __linux
    /* Fedora doesn't support SDL_GL_SWAP_CONTROL, but we use this 
extension instead. */
    SDL_putenv("__GL_SYNC_TO_VBLANK=1");
#endif

and I'm looking for something similiar to use with the Makefiles so I 
can turn the two Makefiles into one.

I hope this is considered on-topic, if not, I apologise.

- EL


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

