Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
;;;; -*- 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.
;;; compile.pre. Generated from compile.lsp.in by configure.
;;;
;;; 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))
)
;;(setq compiler::*trace-cc* t)
#|
(setq *compile-verbose* t
*compile-print* t
compiler::*suppress-compiler-messages* nil
compiler::*suppress-compiler-warnings* nil
compiler::*suppress-compiler-notes* nil)
|#
(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"))
;(setq compiler::*compiler-break-enable* t) ;; to drop into the debugger on an error.
(setf compiler::*ld-flags* compiler::*external-ld-flags*
#|
compiler::*ld-shared-flags*
(concatenate 'base-string
"-shared mkcl.dll " compiler::*ld-flags*)
compiler::*ld-bundle-flags*
#+:mingw32 ;; I bet this one is not even needed on mingw32! JCB
(concatenate 'base-string
"-shared mkcl.dll " compiler::*ld-flags*)
#-:mingw32
"-shared "
|#
)
;;;
;;; * Compile and link Common-Lisp base library
;;;
(setq si::*keep-documentation* nil) ;; Remove documentation from compiled files
(let* (#+windows (compiler::*cc-flags* (concatenate 'string "-DMKCL_API " compiler::*cc-flags*))
;;(lsp-objects (compile-if-old "src:lsp;" +lisp-module-files+ :fasl-p nil))
(lsp-objects (compile-if-old "./lsp/" +lisp-module-files+ :fasl-p nil))
)
(let* ((compiler::*compile-to-linking-call* nil))
(setq lsp-objects
(append lsp-objects
;;(compile-if-old "src:clos;" +clos-module-files+ :fasl-p nil)
(compile-if-old "./clos/" +clos-module-files+ :fasl-p nil)
)))
(let (;;(compiler::*suppress-compiler-messages* nil)
;;(compiler::*suppress-compiler-warnings* nil)
;;(compiler::*suppress-compiler-notes* nil)
;;(*compile-verbose* t)
;;(*compile-print* t)
)
(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* ((compiler::*ld-shared-flags*
#+unix
;;"-shared libmkclgc.a -lgmp -lm"
"-shared -lgmp -lm"
#+mingw64
"-shared c:/Users/Jean-Claude/GNU2/mingw64/lib/libgmp.a -lws2_32 -lm"
#+(or mingw32 cygwin)
;;"-shared -lws2_32 -lgmp -lm"
"-shared -lws2_32 -lgmp -lm"
#+msvc
"-shared @STATICLIBS@ @CLIBS@"
)
;;(extra-ld-flags "")
(extra-ld-flags #+unix (mkcl:bstr+ "-Wl,-soname,mkcl_" (si:mkcl-version) ".dll"))
;;#+windows
;;(compiler::*cc-flags* (concatenate 'string "-DMKCL_API " compiler::*cc-flags*))
;;(extra-args nil)
)
;; #+(or mingw32 mingw64 cygwin)
;; (progn
;; ;; We need these two to force dllwrap to export the symbols
;; ;; in these libraries. Otherwise it will not be possible to
;; ;; call functions from GMP or GC in code that embeds MKCL.
;; (when (probe-file "libmkclgc.a")
;; (push "libmkclgc.a" extra-args))
;; ;; (when (probe-file "libmkclgmp.a")
;; ;; (push "libmkclgmp.a" extra-args))
;; )
(let (;;(compiler::*suppress-compiler-messages* nil)
;;(compiler::*suppress-compiler-warnings* nil)
;;(compiler::*suppress-compiler-notes* nil)
;;(*compile-verbose* t)
;;(*compile-print* t)
)
(format t "~&;;About to build shared library mkcl_~A.dll~%" (si:mkcl-version))
(unless (compiler:build-shared-library (mkcl:bstr+ "mkcl_" (si:mkcl-version) ".dll")
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
;;"mkcl" ;;(compile-file-pathname "mkcl" :type :dll)
:extra-ld-flags extra-ld-flags
:object-files (list "c/all_symbols2.o"
"liblsp.a"
"libmkclmin.a"
"libmkclgc.a"
;;extra-args
)
)
(mkcl:quit :exit-code 1))
(format t "~&;;Done building libmkcl.so!~%")
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; THE FINAL EXECUTABLE
;;;
(terpri) (princ ";;; About to build main executable mkcl.")
#+unix
(let (;;(compiler::*suppress-compiler-messages* nil)
;;(compiler::*suppress-compiler-warnings* nil)
;;(compiler::*suppress-compiler-notes* nil)
;;(*compile-verbose* t)
;;(*compile-print* t)
#+(or)
(compiler::*ld-flags* (concatenate
'base-string
" -rdynamic libmkcltop.a liblsp.a "
"libmkclmin.a "
"libmkclgc.a "
compiler::*external-ld-flags*
))
(compiler::*ld-flags* compiler::*external-ld-flags*) ;; prevent -lmkcl from showing up.
(object-files '("libmkcltop.a" "liblsp.a" "libmkclmin.a" "libmkclgc.a"))
)
(unless (compiler:build-program
"bin/mkcl-small"
:object-files object-files
:extra-ld-flags "-rdynamic" ;; export main executable symbols to loaded modules and fasls.
;; :extra-ld-flags "-pg -rdynamic" ;; for profiling
)
(mkcl:quit :exit-code 1))
)
#+windows
(let (;;(compiler::*suppress-compiler-messages* nil)
;;(compiler::*suppress-compiler-warnings* nil)
;;(compiler::*suppress-compiler-notes* nil)
;;(*compile-verbose* t)
;;(*compile-print* t)
(compiler::*ld-flags* compiler::*external-ld-flags*) ;; prevent -lmkcl from showing up.
(mkcl-lib-name (concatenate 'base-string
compiler::+shared-library-prefix+
"mkcl_" (si:mkcl-version) "."
compiler::+shared-library-extension+))
(target-name #+msvc "bin/mkcl2" #+(or mingw32 mingw64) "bin/mkcl-small")
)
(unless (compiler:build-program
target-name
:object-files (list mkcl-lib-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.