|
From: | John Graham-Cumming |
Subject: | Re: function.c, unlink, copy |
Date: | Wed, 28 Sep 2005 10:13:28 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104 |
Torsten Mohr wrote:
In a portable Makefile i have to set that command conditionally, depending on the OS, which leads to the problem to determine the underlying OS. Is there a bullet-proof way to determine it? Environment variables could be set not properly or also not at all set. Also, i can't set it for every command.
If you are on a *nix of some sort (including CYGWIN on Windows) then uname will be able to give you a string representing the OS. I wrote an article for Dr Dobbs on cross-platform Make a while ago and you can find it on this web page http://www.electric-cloud.com/resources/.
Essentially if you get the output of uname via $(shell) in a variable then you can set things conditionally based on the OS.
John. -- John Graham-Cumming address@hidden Home: http://www.jgc.org/ POPFile: http://getpopfile.org/ Sign up for my Spam and Anti-spam Newsletter at http://www.jgc.org/
[Prev in Thread] | Current Thread | [Next in Thread] |