Adding an OSNAME variable

Adriaan de Groot <adridg-FlD2LfDziEhmR6Xm/[email protected]>
Newsgroups gmane.comp.tools.aap.devel
Message-ID <[email protected]>
The attached patch adds a new variable similar to BDIR, but containing just 
the name of the OS (in other words, like BDIR - "build-"). I can imagine it 
is useful where you want to embed the name of the build OS in a target (ie. 
CFLAGS = -DOSNAME=$OSNAME). It fits in with the OSTYPE that already exists. 

This time, a docs patch is included :)
doc.diff (text/x-diff, 961 B)
--- doc/ref-variables.sgml	Tue Oct 21 19:02:35 2003
+++ doc-new/ref-variables.sgml	Sun Nov  2 23:00:04 2003
@@ -679,6 +679,20 @@
 <link linkend="build-variant">the tutorial</link>.</entry>
 </row>
 <row>
+<entry valign="top"><anchor id="var-osname"/> $OSNAME </entry>
+<entry valign="top"> &Aap; </entry>
+<entry valign="top">
+The name of the operating system and its version (on systems that support it).
+For instance, FreeBSD 4.9 gives $OSNAME the value 
+<literal>FreeBSD4_9_STABLE</literal>.
+Systems that do not support name and version yield
+what Python's <literal>os.name</literal> yields -
+usually the same as $OSTYPE except for MS-Windows and MS-DOS.
+This name is usually incorporated in <link linkend="var-bdir">$BDIR</link>
+as well, as <literal>build-<replaceable>OSNAME</replaceable></literal>.
+</entry>
+</row>
+<row>
 <entry valign="top"><anchor id="var-ostype"/> $OSTYPE </entry>
 <entry valign="top"> &Aap; </entry>
 <entry valign="top">
work.diff (text/x-diff, 451 B)
--- Work.orig	Sun Nov  2 22:36:57 2003
+++ Work.py	Sun Nov  2 22:37:54 2003
@@ -73,9 +73,10 @@
             return s
 
         sysname, n, release, v, m = os.uname()
-        rd["BDIR"] = ("build-" + fixname(sysname) + fixname(release))
+	rd["OSNAME"] = fixname(sysname) + fixname(release)
     else:
-        rd["BDIR"] = "build-" + os.name
+        rd["OSNAME"] = os.name
+    rd["BDIR"] = "build-" + rd["OSNAME"]
 
     # $OSTYPE
     n = os.name
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.