Skip to content
compile.lsp.in 4.02 KiB
Newer Older
;;;;  -*- Mode: Lisp; Syntax: Common-Lisp; Package: SYSTEM -*-
;;;;
;;;;  Copyright (c) 2010-2012, Jean-Claude Beaudoin.
;;;;  Copyright by a number of previous anonymous authors
;;;;            presumed to be the same as for the rest of MKCL.
;;;;
;;;;    This program is free software; you can redistribute it and/or
;;;;    modify it under the terms of the GNU Lesser General Public
;;;;    License as published by the Free Software Foundation; either
;;;;    version 3 of the License, or (at your option) any later version.
;;;;
;;;;    See file '../Copyright' for full details.

;;; @configure_input@
;;;
;;; This is the "compile" file for building MKCL. The purpose of this file is
;;;	- Compile the core of the Common-Lisp library (lsp, clos)
;;;	- Build an executable
;;;

(progn
  (setq *package* (find-package "SYSTEM"))
  (setq *features* (cons :mkcl-bootstrap *features*))
  )

;;;
;;; * Ensure that we have the whole of Common-Lisp before we start to compile
;;;
;;(load "bare.lsp" :verbose nil)
(let ((real-start (get-internal-real-time))
      (run-start (get-internal-run-time))
      real-end run-end)
  (load "bare.lsp" :verbose nil :external-format '(:ascii :lf))
  (setq run-end (get-internal-run-time)
	real-end (get-internal-real-time))
  (format *trace-output*
	  "~2&load real time : ~,3F secs~%~
           load run time  : ~,3F secs~2%"
	  (/ (- real-end real-start) internal-time-units-per-second)
	  (/ (- run-end run-start) internal-time-units-per-second))
  )


(load "compile-utils.lsp" :external-format '(:ascii :lf))

;;;
;;; * Trick to make names shorter in C files
;;;
(si::reopen-package "CL")
(rename-package "CL" "CL" '("COMMON-LISP" "LISP"))


;;;
;;; * Compile and link Common-Lisp base library
;;;

(let* (#+windows (compiler::*cc-flags* (concatenate 'string "-DMKCL_API " compiler::*cc-flags*))
       (lsp-objects (compile-if-old "./lsp/" +lisp-module-files+ :fasl-p nil))
       )
  (setq lsp-objects (append lsp-objects (compile-if-old "./clos/" +clos-module-files+ :fasl-p nil)))

  (format t "~&;;About to build static library liblsp.a~%")
  (unless (compiler:build-static-library "lsp" :lisp-object-files lsp-objects)
    (mkcl:quit :exit-code 1))
  (format t "~&;;Done building liblsp.a!~%"))
(let* ((extra-ld-flags #+unix (mkcl:bstr+ "-Wl,-soname,@SHAREDPREFIX@mkcl_" (si:mkcl-version) ".@SHAREDEXT@")))
  (format t "~&;;About to build shared library @SHAREDPREFIX@mkcl_~A.@SHAREDEXT@~%" (si:mkcl-version))
  (unless (compiler:build-shared-library (mkcl:bstr+ "@SHAREDPREFIX@mkcl_" (si:mkcl-version) ".@SHAREDEXT@")
					 :extra-ld-flags extra-ld-flags
					 :object-files (list "c/all_symbols2.@OBJEXT@"
							     "@LIBPREFIX@lsp.@LIBEXT@"
							     "@LIBPREFIX@mkclmin.@LIBEXT@"
							     "@LIBRARIES@"
							     #+mingw64
							     "c:/Users/Jean-Claude/GNU2/mingw64/lib/libgmp.a"
							     )
					 )
    (mkcl:quit :exit-code 1))
  (format t "~&;;Done building shared library @SHAREDPREFIX@mkcl_~A.@SHAREDEXT@!~%" (si:mkcl-version))
  )


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; THE FINAL EXECUTABLE
;;;

(terpri) (princ ";;; About to build main executable mkcl.")

#+unix
(unless (compiler:build-program
	 "bin/mkcl-small"
	 :use-mkcl-shared-libraries nil ;; force static linking
	 ;;:extra-ld-flags "-pg"  ;; for profiling
	 )
  (mkcl:quit :exit-code 1))

(let ((target-name #+msvc "bin/mkcl2" #+(or mingw32 mingw64) "bin/mkcl-small"))
  (unless (compiler:build-program
	   target-name
	   )
    (mkcl:quit :exit-code 1))
  )

(terpri) (princ ";;; Generating supplemental character encoding external support files.")

(defvar *generate-verbose*)
(setq *generate-verbose* nil) ;; Makes the generate.lisp script more verbose.

(defvar *update-mapping*)
(setq *update-mapping* nil) ;; Setting this to something other than nil may result in network activity.

#+UNICODE
(load "../contrib/encodings/generate.lisp" :external-format '(:ascii :lf))



(terpri)
(princ ";;; All done in compile.lsp!")
(terpri)
(finish-output)

(mkcl:quit :exit-code 0) ;; signal to "make" that all is well.