Permalink
Browse files

Added support for building i686 on x86_64 machines throughout

  • Loading branch information...
1 parent ede15aa commit 3f1565f342bfb46eb6202428875ac6528c027467 Henry committed Oct 19, 2010
Showing with 139 additions and 99 deletions.
  1. +2 −2 Eu2C/Apply/environment.lisp
  2. +24 −24 Eu2C/Bin/eu2c
  3. +2 −12 Eu2C/Examples/Makefile
  4. +10 −20 Eu2C/Makefile
  5. +58 −15 Eu2C/README.html
  6. +8 −8 Eu2C/README.org
  7. +7 −14 Eu2C/Runtime/Makefile
  8. +9 −1 EuXLisp/Makefile
  9. +11 −3 Makefile
  10. +8 −0 Youtoo/Makefile
@@ -45,9 +45,9 @@
(export '*arch*)
(cond
- ((search "m32" *arch*)
+ ((search "i686" *arch*)
(setq *features* (append *features* '(:word32))))
- ((search "m64" *arch*)
+ ((search "x86_64" *arch*)
(setq *features* (append *features* '(:word64))))
(t
(format
View
@@ -19,28 +19,23 @@
## this program. If not, see <http://www.gnu.org/licenses/>.
##
###-----------------------------------------------------------------------------
-### Title: Script to compile EuLisp applications
-### Description:
-### Documentation:
+### Title: Script to compile EuLisp applications
### Notes:
-## Currently this script is hard-coded to run CMUCL
-## with the executable name lisp.
-### Requires:
-### Problems:
-### Authors:
+## Currently this script is hard-coded to run CMUCL
+## with the executable name lisp.
+### Maintainer: Henry G. Weller
###-----------------------------------------------------------------------------
# Set standard image name
if [ $# = 0 -o "$1" = "-H" ]
then
echo "usage: eu2c.application" \
- " [-LCS] [-g][-cards <K>] [-bs basic-system] [-o name]" \
+ " [-LCS] [-g] [-cards <K>] [-arch <arch>] [-bs <basic-system>] [-o <name>]" \
" <app> [CC-OPTIONS files]..."
echo "<app>: the name of the .em application file"
echo " may be preceded by a path"
echo "files: additional files given to the C-compiler"
- echo "-m32: generate 32-bit executable"
- echo "-m64: generate 32-bit library and executable"
+ echo "-arch <arch>: generate executable for given arctitecture"
echo "-g: generate debugging info for system debugger"
echo "-w: generate warnings from C-compiler"
echo "-threads: a special thread gc library will be used for linking"
@@ -74,11 +69,6 @@ else
CC="gcc "
fi
-# Set the default machine word-length to 32bit
-# but override the default for x86_64
-MWORDLEN=m32
-[ $ARCH = "x86_64" ] && MWORDLEN=m64
-
if [ -n "$Eu2C_CC_OPTIMIZE" ]
then
CCOPTIMIZE=$Eu2C_CC_OPTIMIZE
@@ -136,12 +126,9 @@ do
THREADS="-threads"
shift
;;
- "-m32")
- MWORDLEN="m32"
+ "-arch")
+ ARCH=$2
shift
- ;;
- "-m64")
- MWORDLEN="m64"
shift
;;
"-security")
@@ -158,13 +145,26 @@ do
esac
done
-ARCH_DIR=platforms/${ARCH}${MWORDLEN}
+case $ARCH in
+ "i686")
+ MWORDLEN=m32
+ ;;
+ "x86_64")
+ MWORDLEN=m64
+ ;;
+ *)
+ echo "Eu2C: unknown architecture " $ARCH
+ exit 1
+ break
+esac
+
+ARCH_DIR=platforms/${ARCH}
if [ -n "$Eu2CIMAGENAME" ]
then
- Eu2CIMAGE=$Eu2CROOT/Lib/${ARCH}${MWORDLEN}/$Eu2CIMAGENAME
+ Eu2CIMAGE=$Eu2CROOT/Lib/${ARCH}/$Eu2CIMAGENAME
else
- Eu2CIMAGE=$Eu2CROOT/Lib/${ARCH}${MWORDLEN}/eu2c
+ Eu2CIMAGE=$Eu2CROOT/Lib/${ARCH}/eu2c
fi
CL="cmu"
@@ -24,16 +24,6 @@
ARCH := $(shell uname -m)
include ../../Lib.$(ARCH)/Makefile
-# Set the default machine word-length to 32
-# but override the default for x86_84 architectures
-# May also be overridden on the command-line
-WL = m32
-ifeq ($(ARCH),x86_64)
- WL = m64
-endif
-
-ARCH := $(ARCH)$(WL)
-
###-----------------------------------------------------------------------------
### Basic system and optimisation switch
###-----------------------------------------------------------------------------
@@ -71,11 +61,11 @@ all0x: $(EXAMPLES_0X_EXE)
$(EXAMPLES_0_EXE): $(ARCH_DIR)/%: %.em \
${Eu2CROOT}/EuLispModules/$(ARCH_DIR)/level-0.def
- ../Bin/eu2c -$(WL) $(BS0) $<
+ ../Bin/eu2c -arch $(ARCH) $(BS0) $<
$(EXAMPLES_0X_EXE): $(ARCH_DIR)/%: %.em \
${Eu2CROOT}/EuLispModules/$(ARCH_DIR)/level-0x.def
- ../Bin/eu2c -$(WL) $(BS0X) $<
+ ../Bin/eu2c -arch $(ARCH) $(BS0X) $<
###-----------------------------------------------------------------------------
### Run the examples
View
@@ -24,29 +24,19 @@
### Usage: make [options]
### Options:
### CL=<Lisp Compiler: cmu, sbcl>
-### WL=<Machine word length: m32, m64>
+### ARCH=<Machine architecture: i686, x86_64...>
### eu2c=<Eu2C compiler image name>
### module=<module name>
### eu2c, runtime, modlib, modeu2c, clean, distclean
### Defaults:
### CL=cmu
-### WL=[m32 on 32bit machines and m64 on 64bit machines]
+### ARCH=[`uname -m` i.e. the default architecture on the machine]
### eu2c=eu2c
### module=level-0
###-----------------------------------------------------------------------------
ARCH := $(shell uname -m)
include ../Lib.$(ARCH)/Makefile
-# Set the default machine word-length to 32
-# but override the default for x86_84 architectures
-# May also be overridden on the command-line
-WL = m32
-ifeq ($(ARCH),x86_64)
- WL = m64
-endif
-
-ARCH := $(ARCH)$(WL)
-
###-----------------------------------------------------------------------------
### Set Common Lisp compiler
###-----------------------------------------------------------------------------
@@ -67,7 +57,7 @@ endif
### Set C compiler
###-----------------------------------------------------------------------------
CC = gcc
-CFLAGS = -O2 -Wall -Wno-unused
+CFLAGS = -m$(WORD_LENGTH) -O2 -Wall -Wno-unused
#CFLAGS = -ggdb3
###-----------------------------------------------------------------------------
@@ -112,7 +102,7 @@ $(eu2c_image): $(Apply) $(EclModules)
.PHONY: runtime
runtime:
@echo "===> Compile the C runtime library"
- @$(MAKE) -C ${Eu2CROOT}/Runtime WL=$(WL)
+ @$(MAKE) -C ${Eu2CROOT}/Runtime
###-----------------------------------------------------------------------------
### Compile the module library
@@ -126,7 +116,7 @@ ${Eu2CROOT}/EuLispModules/$(ARCH_DIR)/$(module).a: $(eu2c_image) $(EuLispModules
cp ti-sys-signatures.em $(ARCH_DIR)/ti-sys-signatures.def && \
echo "(apply-compiler::compile-basic-system (cadr ext:*command-line-strings*)) (quit)" | \
$(call Eu2C,${Eu2CROOT}/$(eu2c_image),$(module)) && \
- $(CC) -$(WL) $(CFLAGS) -I${Eu2CROOT}/Runtime -I$(ARCH_DIR) \
+ $(CC) $(CFLAGS) -I${Eu2CROOT}/Runtime -I$(ARCH_DIR) \
-c $(ARCH_DIR)/$(module).c -o $(ARCH_DIR)/$(module).o && \
ar rcv $(ARCH_DIR)/$(module).a $(ARCH_DIR)/$(module).o && \
ranlib $(ARCH_DIR)/$(module).a
@@ -142,14 +132,14 @@ $(module_image): $(eu2c_image) ${Eu2CROOT}/EuLispModules/$(ARCH_DIR)/$(module).a
$(call Eu2C,$(eu2c_image),$(module))
###-----------------------------------------------------------------------------
-### Create all four options on a 64bit machine
+### Build both 32bit and 64bit on a 64bit machine
###-----------------------------------------------------------------------------
.PHONY: all
all:
- @$(MAKE)
- @$(MAKE) module=level-0x
- @$(MAKE) WL=m32
- @$(MAKE) WL=m32 module=level-0x
+ $(MAKE)
+ $(MAKE) module=level-0x
+ $(MAKE) ARCH=i686
+ $(MAKE) ARCH=i686 module=level-0x
###-----------------------------------------------------------------------------
### Miscellaneous commands
Oops, something went wrong.

0 comments on commit 3f1565f

Please sign in to comment.