mescc: Refactor type system: struct/enum fields: (name . <type>).
[mes.git] / build.sh
index df558c07e8901a840073e04e297f2a67ab0e4656..2e2525eaf386948517680134bc60c13abb05218b 100755 (executable)
--- a/build.sh
+++ b/build.sh
 # You should have received a copy of the GNU General Public License
 # along with Mes.  If not, see <http://www.gnu.org/licenses/>.
 
-set -ex
+set -x
+# dash does not export foo=${foo-bar} for some values
+export CC CC32 GUILE MESCC MES_SEED
+export MES_ARENA MES_DEBUG
+export PREFIX DATADIR MODULEDIR
+export CPPFLAGS CFLAGS C32FLAGS MESCCFLAGS
 
-export CC=${CC-$(type -p gcc)}
-export CC32=${CC32-$(type -p i686-unknown-linux-gnu-gcc)}
-export MESCC=${MESCC-$(type -p mescc)}
-export MES_SEED=${MES_SEED-../mes-seed}
-export GUILE=${GUILE-$(type -p guile)}
-export MES_ARENA=${MES_ARENA-300000000}
-export MES_DEBUG=${MES_DEBUG-2}
+CC=${CC-$(command -v gcc)}
+CC32=${CC32-$(command -v i686-unknown-linux-gnu-gcc)}
+MESCC=${MESCC-$(command -v mescc)}
+MES_SEED=${MES_SEED-../mes-seed}
+GUILE=${GUILE-$(command -v guile)}
+MES_ARENA=${MES_ARENA-300000000}
+MES_DEBUG=${MES_DEBUG-2}
 
-export PREFIX=${PREFIX-/usr/local}
-export DATADIR=${DATADIR-$PREFIX/share/mes}
-export MODULEDIR=${MODULEDIR-$DATADIR/module}
+PREFIX=${PREFIX-/usr/local}
+DATADIR=${DATADIR-$PREFIX/share/mes}
+MODULEDIR=${MODULEDIR-$DATADIR/module}
+set -e
 
+CPPFLAGS=${CPPFLAGS-"
+-D VERSION=\"$VERSION\"
+-D MODULEDIR=\"$MODULEDIR\"
+-D PREFIX=\"$PREFIX\"
+-I src
+-I lib
+-I include
+"}
+CFLAGS=${CFLAGS-"
+--std=gnu99
+-O0
+-g
+"}
+C32FLAGS=${C32FLAGS-"
+--std=gnu99
+-O0
+-fno-stack-protector
+-g
+-m32
+-nostdinc
+-nostdlib
+"}
+MESCCLAGS=${MESCCFLAGS-"
+"}
+M1FLAGS=${M1FLAGS-"
+--LittleEndian
+--Architecture=1
+"}
+HEX2FLAGS=${HEX2FLAGS-"
+--LittleEndian
+--Architecture=1
+--BaseAddress=0x1000000
+"}
 
 if [ -n "$GUILE" ]; then
     sh build-aux/build-guile.sh