* Reliably check if we're running under cygwin inside Makefile @ 2009-01-12 12:48 Eric Lilja 2009-01-12 16:19 ` Greg Chicares 0 siblings, 1 reply; 5+ messages in thread From: Eric Lilja @ 2009-01-12 12:48 UTC (permalink / raw) To: cygwin 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/ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Reliably check if we're running under cygwin inside Makefile 2009-01-12 12:48 Reliably check if we're running under cygwin inside Makefile Eric Lilja @ 2009-01-12 16:19 ` Greg Chicares 0 siblings, 0 replies; 5+ messages in thread From: Greg Chicares @ 2009-01-12 16:19 UTC (permalink / raw) To: cygwin On 2009-01-12 12:19Z, Eric Lilja wrote: > 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? Not really Cygwin specific, but here's a common method: http://lists.gnu.org/archive/html/help-make/2006-12/msg00065.html -- 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/ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Reliably check if we're running under cygwin inside Makefile @ 2009-01-12 19:06 Fergus 2009-01-12 20:10 ` Dave Korn 2009-01-12 21:52 ` Grant Edwards 0 siblings, 2 replies; 5+ messages in thread From: Fergus @ 2009-01-12 19:06 UTC (permalink / raw) To: Cygwin ML; +Cc: Fergus > osname := $(shell uname -s) > osver := $(shell uname -r) > cpuarch := $(shell uname -m) Probably the fault is mine but I can't get this to do anything useful in Cygwin. You could try (something like): case `uname` in *CYGWIN*) OS=Cygwin ;; *Darwin*) OS=Darwin ;; *) OS=Linux ;; esac and then try things like if [ ${OS} == "Linux" ] then .. fi Fergus -- 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/ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Reliably check if we're running under cygwin inside Makefile 2009-01-12 19:06 Fergus @ 2009-01-12 20:10 ` Dave Korn 2009-01-12 21:52 ` Grant Edwards 1 sibling, 0 replies; 5+ messages in thread From: Dave Korn @ 2009-01-12 20:10 UTC (permalink / raw) To: cygwin; +Cc: Fergus Fergus wrote: > > osname := $(shell uname -s) > > osver := $(shell uname -r) > > cpuarch := $(shell uname -m) > > Probably the fault is mine but I can't get this to do anything useful in > Cygwin. You could try (something like): > > case `uname` in Hmm, did you try those first examples in bash before deciding they didn't work? Because your alternative proposal looks a lot like shell script... Perhaps you need to read the subject line again! cheers, DaveK -- 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/ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Reliably check if we're running under cygwin inside Makefile 2009-01-12 19:06 Fergus 2009-01-12 20:10 ` Dave Korn @ 2009-01-12 21:52 ` Grant Edwards 1 sibling, 0 replies; 5+ messages in thread From: Grant Edwards @ 2009-01-12 21:52 UTC (permalink / raw) To: cygwin On 2009-01-12, Fergus <fergus@bonhard.uklinux.net> wrote: > > osname := $(shell uname -s) > > osver := $(shell uname -r) > > cpuarch := $(shell uname -m) > > Probably the fault is mine but I can't get this to do anything useful in > Cygwin. You could try (something like): > > case `uname` in > *CYGWIN*) > OS=Cygwin > ;; > *Darwin*) > OS=Darwin > ;; > *) > OS=Linux > ;; > esac > > and then try things like > > if [ ${OS} == "Linux" ] > then > .. > fi That looks like shell to me. I thought the OP was asking for something to use in a Makefile. -- Grant Edwards grante Yow! MERYL STREEP is my at obstetrician! visi.com -- 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/ ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-01-12 20:10 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-01-12 12:48 Reliably check if we're running under cygwin inside Makefile Eric Lilja 2009-01-12 16:19 ` Greg Chicares 2009-01-12 19:06 Fergus 2009-01-12 20:10 ` Dave Korn 2009-01-12 21:52 ` Grant Edwards
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).