shithub: mc

Download patch

ref: b80e9fa019f244bf9e562f629aeffaded103dec7
parent: 5ce1ef188530525a21db822bafcd7886d96fcb92
author: Ori Bernstein <[email protected]>
date: Tue Sep 18 21:20:50 EDT 2012

Improve build system flexibility a bit.

--- a/6/main.c
+++ b/6/main.c
@@ -12,8 +12,9 @@
 #include "parse.h"
 #include "opt.h"
 #include "asm.h"
-#include "platform.h"
 
+#include "../config.h"
+
 /* FIXME: move into one place...? */
 Node *file;
 int debug;
@@ -56,6 +57,7 @@
     Stab *globls;
     char buf[1024];
 
+    lappend(&incpaths, &nincpaths, Instroot "include/myr");
     while ((opt = getopt(argc, argv, "d::hSo:I:")) != -1) {
         switch (opt) {
             case 'o':
--- a/configure
+++ b/configure
@@ -10,6 +10,8 @@
 done
 echo "Automake emulated successfully"
 
+INST_ROOT='/usr/local'
+
 for arg in $*; do
     shift 1
     case $arg in
@@ -28,9 +30,29 @@
     esac
 done
 
+OS=`uname`
+
+echo export INST_ROOT=$prefix > config.mk
+echo \#define Instroot "\"$prefix\"" > config.h
+
+case $OS in
+    *Linux*)
+        echo '#define Asmcmd "as -g -o %s %s"' >> config.h
+        echo '#define Fprefix ""' >> config.h
+        ;;
+    *Darwin*)
+        echo '\#define Asmcmd "as -g -o %s %s"' >> config.h
+        echo '\#define Fprefix "_"' >> config.h
+        ;;
+    *)
+        echo 'Unknown architecture. Assuming Linux ABI.'
+        echo '#define Asmcmd "as -g -o %s %s"' >> config.h
+        echo '#define Fprefix "' >> config.h
+        ;;
+esac
+
 cat << EOF
     Building with:
         prefix=$prefix
 EOF
 
-echo export INST_ROOT=$prefix > config.mk