mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-18 07:12:26 -08:00
156 lines
4.9 KiB
Text
156 lines
4.9 KiB
Text
;;;
|
|
;;; This is the "makefile" file for building ECL. The purpose of this file is
|
|
;;; - Compile the core of the Common-Lisp library (lsp, clos)
|
|
;;; - Compile the compiler (cmp)
|
|
;;; - Build an executable
|
|
;;; This can be done in two ways:
|
|
;;; - Using interpreted code and the ECL_MIN minimal environment.
|
|
;;; - On a second stage, using the final ECL executable, to test it.
|
|
;;;
|
|
|
|
(setq *package* (find-package "SYSTEM"))
|
|
|
|
;;;
|
|
;;; * Ensure that we have the whole of Common-Lisp to compile
|
|
;;;
|
|
(load "bare.lsp" :verbose nil)
|
|
|
|
;;;
|
|
;;; * Dump documentation
|
|
;;;
|
|
#+stage1
|
|
(progn
|
|
(load "@true_srcdir@/doc/help.lsp")
|
|
(si::dump-documentation "@true_builddir@/help.doc"))
|
|
|
|
;;;
|
|
;;; * Trick to make names shorter in C files
|
|
;;;
|
|
(si::package-lock "CL" nil)
|
|
(rename-package "CL" "CL" '("COMMON-LISP" "LISP"))
|
|
|
|
;;;
|
|
;;; * Add include path to not yet installed headers, and remove include flag
|
|
;;; (-I) to installed directory, and Notice that we must explicitely mention
|
|
;;; libecl.so/ecl.dll instead of using -lecl. This is to avoid interference
|
|
;;; with an already installed copy of ECL.
|
|
;;;
|
|
(setq c::*cc-flags*
|
|
"@CFLAGS@ @ECL_CFLAGS@ -I\"@true_srcdir@\"/h -I\"@true_srcdir@\"/gmp -I\"@true_builddir@\"/h"
|
|
c::*cc-format*
|
|
"~S ~A ~:[~*~;~A~] -I\"@true_builddir@\"/h~* -w -c ~S -o ~S"
|
|
c::*ld-format*
|
|
"~S -o ~S -L\"@true_builddir@\"~* ~{~S ~} ~@?")
|
|
#-dlopen
|
|
(setf c::*ld-flags*
|
|
"@LDFLAGS@ @LDRPATH@ @LIBPREFIX@ecl.@LIBEXT@ -lgmp @GCLIB@ @CLIBS@")
|
|
#+dlopen
|
|
(setf c::*ld-flags*
|
|
"@LDFLAGS@ @LDRPATH@ @SHAREDPREFIX@ecl.@SHAREDEXT@ @CLIBS@"
|
|
c::*ld-shared-flags*
|
|
"@LDRPATH@ @SHARED_LDFLAGS@ @LDFLAGS@ @SHAREDPREFIX@ecl.@SHAREDEXT@ @CLIBS@"
|
|
c::*ld-bundle-flags*
|
|
"@LDRPATH@ @BUNDLE_LDFLAGS@ @LDFLAGS@ @SHAREDPREFIX@ecl.@SHAREDEXT@ @CLIBS@")
|
|
|
|
;;;
|
|
;;; * Avoid name clashes with user supplied code.
|
|
;;;
|
|
(setq si::*init-function-prefix* "ECL")
|
|
|
|
;;;
|
|
;;; * Compile and link Common-Lisp base library
|
|
;;;
|
|
(setq si::*keep-documentation* nil)
|
|
(proclaim '(optimize (safety 2) (space 3)))
|
|
(let* ((c::*cc-flags* (concatenate 'string "-I@true_builddir@/c " c::*cc-flags*))
|
|
(lsp-objects (compile-if-old "build:lsp;" +lisp-module-files+
|
|
:system-p t :c-file t :data-file t :h-file t)))
|
|
#+CLOS
|
|
(let* ((c::*compile-to-linking-call* nil))
|
|
(proclaim '(optimize (safety 2) (space 3)))
|
|
(setq lsp-objects (append lsp-objects
|
|
(compile-if-old "build:clos;" +clos-module-files+
|
|
:system-p t :c-file t :data-file t :h-file t))))
|
|
(c::build-static-library "lsp" :lisp-files lsp-objects))
|
|
|
|
#-dlopen
|
|
(si::system "sh -c 'mkdir tmp; rm -f tmp/*; ~
|
|
cp @LIBPREFIX@eclmin.@LIBEXT@ @LIBPREFIX@ecl.@LIBEXT@
|
|
for i in lsp/*.@OBJEXT@ clos/*.@OBJEXT@; do mv $i tmp/lsp_`basename $i`; done; ar -r ../@LIBPREFIX@ecl.@LIBEXT@ tmp/*.@OBJEXT@; rm tmp/*.@OBJEXT@; ~
|
|
ranlib ../@LIBPREFIX@ecl.@LIBEXT@")
|
|
|
|
#+dlopen
|
|
;;;
|
|
;;; We do not need the -rpath flag for the library, nor -lecl.
|
|
;;;
|
|
(let ((c::*ld-shared-flags* "@SHARED_LDFLAGS@ @LDFLAGS@ @CLIBS@")
|
|
(c::*cc-flags* (concatenate 'string "-I@true_builddir@/c " c::*cc-flags*)))
|
|
(c::shared-cc (compile-file-pathname "ecl" :type :dll)
|
|
"c/main.@OBJEXT@"
|
|
"@LIBPREFIX@lsp.@LIBEXT@"
|
|
"@LIBPREFIX@eclmin.@LIBEXT@"
|
|
"-lgmp"
|
|
"@GCLIB@"
|
|
. #.(unless (equalp "@LDINSTALLNAME@" "")
|
|
'("@LDINSTALLNAME@"))))
|
|
|
|
;;;
|
|
;;; * Compile and link Common-Lisp to C compiler
|
|
;;;
|
|
(proclaim '(optimize (safety 2) (space 3)))
|
|
|
|
(si::pathname-translations "SYS" '(("**;*.*.*" "@ecldir@/**/*.*")))
|
|
|
|
#+(and (not cross) (or (not stage1) WANTS-CMP))
|
|
(let ((objects (compile-if-old "build:cmp;" +cmp-module-files+
|
|
:system-p t :c-file t :data-file t :h-file t)))
|
|
#-dlopen
|
|
(c::build-static-library "cmp" :lisp-files objects)
|
|
#+dlopen
|
|
(c::build-fasl "cmp" :lisp-files objects))
|
|
|
|
;;;
|
|
;;; * Compile the portable CLX library.
|
|
;;;
|
|
|
|
(defconstant +clx-module-files+
|
|
'("src:clx;package.lisp"
|
|
"src:clx;depdefs.lisp"
|
|
"src:clx;clx.lisp"
|
|
"src:clx;dependent.lisp"
|
|
"src:clx;macros.lisp"
|
|
"src:clx;bufmac.lisp"
|
|
"src:clx;buffer.lisp"
|
|
"src:clx;display.lisp"
|
|
"src:clx;gcontext.lisp"
|
|
"src:clx;input.lisp"
|
|
"src:clx;requests.lisp"
|
|
"src:clx;fonts.lisp"
|
|
"src:clx;graphics.lisp"
|
|
"src:clx;text.lisp"
|
|
"src:clx;attributes.lisp"
|
|
"src:clx;translate.lisp"
|
|
"src:clx;keysyms.lisp"
|
|
"src:clx;manager.lisp"
|
|
"src:clx;image.lisp"
|
|
"src:clx;resource.lisp"))
|
|
|
|
#+WANTS-CLX
|
|
(progn
|
|
(proclaim '(optimize (safety 2) (speed 1)))
|
|
(push :clx-ansi-common-lisp *features*)
|
|
(unless (probe-file "build:clx;")
|
|
(si::mkdir "build:clx;" #o0777))
|
|
(mapcar #'load +clx-module-files+)
|
|
(let* ((objects (compile-if-old "build:clx;" +clx-module-files+
|
|
:system-p t :c-file t :data-file t :h-file t)))
|
|
(c::build-static-library "clx" :lisp-files objects)
|
|
#+dlopen
|
|
(c::build-fasl "clx" :lisp-files objects)))
|
|
|
|
(compiler::build-program
|
|
#+(or cross stage1) "ecl"
|
|
#-(or cross stage1) "ecl2"
|
|
:lisp-files '(#+(and (not dlopen) WANTS-CMP) cmp
|
|
#+(and (not dlopen) WANTS-CLX) clx)
|
|
:ld-flags '("-L./"))
|