linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] Mac OS X specs for cgcc
@ 2007-12-20 13:50 Marko Kreen
  0 siblings, 0 replies; only message in thread
From: Marko Kreen @ 2007-12-20 13:50 UTC (permalink / raw)
  To: linux-sparse

[-- Attachment #1: Type: text/plain, Size: 612 bytes --]

This patch adds MacOS X (darwin) specific defines to cgcc.

Only suspicios aspect about it is that OSX system include
files expect either __LITTLE_ENDIAN__ or __BIG_ENDIAN__ to be
defined to show endianess.  I added a arch switch to darwin
section to pick this up to avoid polluting general i86 and x86_64
sections.  (note: i dont speak perl and i dont have any ppc32/64
to test it on).

Somwhat simpler would be to put __LITTLE_ENDIAN__ unconditionally
to darwin section on the grounds that ppc is unsupported anyway,
but if the support appears it may be better to have the switch
available already.

-- 
marko

[-- Attachment #2: cgcc.macos.specs.diff --]
[-- Type: application/octet-stream, Size: 606 bytes --]

diff --git a/cgcc b/cgcc
index 9acf498..d4c50f8 100755
--- a/cgcc
+++ b/cgcc
@@ -214,6 +214,14 @@ sub add_specs {
     } elsif ($spec eq 'linux') {
 	return &add_specs ('unix') .
 	    ' -D__linux__=1 -D__linux=1 -Dlinux=linux';
+    } elsif ($spec eq 'darwin') {
+	my $osx = ' -D__MACH__=1 -D__APPLE__=1 -D__APPLE_CC__=1 -D__DYNAMIC__=1';
+	my $arch = `uname -m`;
+	if ($arch =~ /ppc/i) {
+	  return ($osx . " -D__BIG_ENDIAN__");
+	} else {
+	  return ($osx . " -D__LITTLE_ENDIAN__");
+	}
     } elsif ($spec eq 'unix') {
 	return ' -Dunix=1 -D__unix=1 -D__unix__=1';
     } elsif ( $spec =~ /^cygwin/) {

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-12-20 13:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-20 13:50 [patch] Mac OS X specs for cgcc Marko Kreen

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 NNTP newsgroup(s).