[Top][All Lists]

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

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

From: David Boyce
Subject: Re: Simple way to ascertain whether we're running on Windows?
Date: Wed, 27 Jul 2005 09:43:52 -0400

A few months ago I sent in a simple (one line!) patch to create a builtin $(MAKE_HOST) variable describing the platform make was built on. For those familiar with the $^O variable in Perl, this would be entirely analogous and could save a lot of runtime work with uname et al. I never heard back and have no idea whether it got into CVS or not. The original email is appended.

-David Boyce

[Original email]
Either I've missed something obvious in the GNU make docs or this is a fairly useful one-line patch:

--- variable.c.orig     Fri Dec 10 23:14:28 2004
+++ variable.c  Fri Dec 10 23:21:46 2004
@@ -578,6 +578,7 @@
           (remote_description == 0 || remote_description[0] == '\0')
           ? "" : remote_description);
   (void) define_variable ("MAKE_VERSION", 12, buf, o_default, 0);
+  (void) define_variable ("MAKE_HOST", 9, MAKE_HOST, o_default, 0);

 #ifdef  __MSDOS__
   /* Allow to specify a special shell just for Make,

Of course the effect is to expose the MAKE_HOST triple which configure has already determined:

% cat Makefile
all:; @echo MAKE_HOST=$(MAKE_HOST)

% make

And the canonical use would be in conditionals:

ifneq (,$(findstring Linux,$(MAKE_HOST)))

reply via email to

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