Clean up cross-compilation package creation, part 2 of 2
[sbcl.git] / src / cold / shared.lisp
blobc89178fffeca71a6acbcfab2ddb940fb5acb209d
1 ;;;; stuff which is not specific to any particular build phase, but
2 ;;;; used by most of them
3 ;;;;
4 ;;;; Note: It's specifically not used when bootstrapping PCL, because
5 ;;;; we do SAVE-LISP after that, and we don't want to save extraneous
6 ;;;; bootstrapping machinery into the frozen image which will
7 ;;;; subsequently be used as the mother of all Lisp sessions.
9 ;;;; This software is part of the SBCL system. See the README file for
10 ;;;; more information.
11 ;;;;
12 ;;;; This software is derived from the CMU CL system, which was
13 ;;;; written at Carnegie Mellon University and released into the
14 ;;;; public domain. The software is in the public domain and is
15 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
16 ;;;; files for more information.
18 ;;; SB-COLD holds stuff used to build the initial SBCL core file
19 ;;; (including not only the final construction of the core file, but
20 ;;; also the preliminary steps like e.g. building the cross-compiler
21 ;;; and running the cross-compiler to produce target FASL files).
22 (defpackage "SB-COLD" (:use "CL"))
24 (in-package "SB-COLD")
26 (defun parse-make-host-parallelism (str)
27 (multiple-value-bind (value1 end) (parse-integer str :junk-allowed t)
28 (when value1
29 (let ((value2 (if (and value1
30 (< end (1- (length str))) ; ~ /,[\d]+/
31 (eql (char str end) #\,))
32 (parse-integer str :start (1+ end)))))
33 ;; If only 1 integer, assume same parallelism for both passes.
34 (unless value2
35 (setq value2 value1))
36 ;; 0 means no parallelism. 1 means use at most one subjob,
37 ;; just in case you want to test the controlling loop.
38 (when (eql value1 0) (setq value1 nil))
39 (when (eql value2 0) (setq value2 nil))
40 ;; Parallelism on pass 1 works only if LOAD does not compile.
41 ;; Otherwise it's slower than compiling serially.
42 ;; (And this has only been tested with sb-fasteval, not sb-eval.)
43 (cons (and (find-package "SB-INTERPRETER") value1)
44 value2)))))
46 (defvar *make-host-parallelism*
47 (or #+sbcl
48 (let ((envvar (sb-ext:posix-getenv "SBCL_MAKE_PARALLEL")))
49 (when envvar
50 (parse-make-host-parallelism envvar)))))
52 (defun make-host-1-parallelism () (car *make-host-parallelism*))
53 (defun make-host-2-parallelism () (cdr *make-host-parallelism*))
55 ;;; If TRUE, then COMPILE-FILE is being invoked only to process
56 ;;; :COMPILE-TOPLEVEL forms, not to produce an output file.
57 ;;; This is part of the implementation of parallelized make-host-2.
58 (defvar *compile-for-effect-only* nil)
60 ;;; prefixes for filename stems when cross-compiling. These are quite arbitrary
61 ;;; (although of course they shouldn't collide with anything we don't want to
62 ;;; write over). In particular, they can be either relative path names (e.g.
63 ;;; "host-objects/" or absolute pathnames (e.g. "/tmp/sbcl-xc-host-objects/").
64 ;;;
65 ;;; The cross-compilation process will force the creation of these directories
66 ;;; by executing CL:ENSURE-DIRECTORIES-EXIST (on the xc host Common Lisp).
67 (defvar *host-obj-prefix*)
68 (defvar *target-obj-prefix*)
70 (defvar *target-obj-suffix*
71 ;; Target fasl files are LOADed (actually only quasi-LOADed, in
72 ;; GENESIS) only by SBCL code, and it doesn't care about particular
73 ;; extensions, so we can use something arbitrary.
74 ".lisp-obj")
75 (defvar *target-assem-obj-suffix*
76 ;; Target fasl files from SB!C:ASSEMBLE-FILE are LOADed via GENESIS.
77 ;; The source files are compiled once as assembly files and once as
78 ;; normal lisp files. In the past, they were kept separate by
79 ;; clever symlinking in the source tree, but that became less clean
80 ;; as ports to host environments without symlinks started appearing.
81 ;; In order to keep them separate, we have the assembled versions
82 ;; with a separate suffix.
83 ".assem-obj")
85 ;;; a function of one functional argument, which calls its functional argument
86 ;;; in an environment suitable for compiling the target. (This environment
87 ;;; includes e.g. a suitable *FEATURES* value.)
88 (declaim (type function *in-target-compilation-mode-fn*))
89 (defvar *in-target-compilation-mode-fn*)
91 ;;; a function with the same calling convention as CL:COMPILE-FILE, to be
92 ;;; used to translate ordinary Lisp source files into target object files
93 (declaim (type function *target-compile-file*))
94 (defvar *target-compile-file*)
96 ;;; designator for a function with the same calling convention as
97 ;;; SB-C:ASSEMBLE-FILE, to be used to translate assembly files into target
98 ;;; object files
99 (defvar *target-assemble-file*)
101 ;;;; some tools
103 ;;; Take the file named X and make it into a file named Y. Sorta like
104 ;;; UNIX, and unlike Common Lisp's bare RENAME-FILE, we don't allow
105 ;;; information from the original filename to influence the final
106 ;;; filename. (The reason that it's only sorta like UNIX is that in
107 ;;; UNIX "mv foo bar/" will work, but the analogous
108 ;;; (RENAME-FILE-A-LA-UNIX "foo" "bar/") should fail.)
110 ;;; (This is a workaround for the weird behavior of Debian CMU CL
111 ;;; 2.4.6, where (RENAME-FILE "dir/x" "dir/y") tries to create a file
112 ;;; called "dir/dir/y". If that behavior goes away, then we should be
113 ;;; able to get rid of this function and use plain RENAME-FILE in the
114 ;;; COMPILE-STEM function above. -- WHN 19990321
115 (defun rename-file-a-la-unix (x y)
117 (let ((path ;; (Note that the TRUENAME expression here is lifted from an
118 ;; example in the ANSI spec for TRUENAME.)
119 (with-open-file (stream y :direction :output)
120 (close stream)
121 ;; From the ANSI spec: "In this case, the file is closed
122 ;; when the truename is tried, so the truename
123 ;; information is reliable."
124 (truename stream))))
125 (delete-file path)
126 (rename-file x path)))
127 (compile 'rename-file-a-la-unix)
129 ;;; other miscellaneous tools
130 (load "src/cold/read-from-file.lisp")
131 (load "src/cold/rename-package-carefully.lisp")
132 (load "src/cold/with-stuff.lisp")
134 ;;; Try to minimize/conceal any non-standardness of the host Common Lisp.
135 (load "src/cold/ansify.lisp")
137 ;;;; special read-macros for building the cold system (and even for
138 ;;;; building some of our tools for building the cold system)
140 (load "src/cold/shebang.lisp")
142 ;;; When cross-compiling, the *FEATURES* set for the target Lisp is
143 ;;; not in general the same as the *FEATURES* set for the host Lisp.
144 ;;; In order to refer to target features specifically, we refer to
145 ;;; *SHEBANG-FEATURES* instead of *FEATURES*, and use the #!+ and #!-
146 ;;; readmacros instead of the ordinary #+ and #- readmacros.
147 (setf *shebang-features*
148 (let* ((default-features
149 (funcall (compile
151 (read-from-file "local-target-features.lisp-expr"))
152 (read-from-file "base-target-features.lisp-expr")))
153 (customizer-file-name "customize-target-features.lisp")
154 (customizer (if (probe-file customizer-file-name)
155 (compile nil
156 (read-from-file customizer-file-name))
157 #'identity)))
158 (funcall customizer default-features)))
159 (let ((*print-length* nil)
160 (*print-level* nil))
161 (format t
162 "target features *SHEBANG-FEATURES*=~%~@<~S~:>~%"
163 *shebang-features*))
165 (defvar *shebang-backend-subfeatures*
166 (let* ((default-subfeatures nil)
167 (customizer-file-name "customize-backend-subfeatures.lisp")
168 (customizer (if (probe-file customizer-file-name)
169 (compile nil
170 (read-from-file customizer-file-name))
171 #'identity)))
172 (funcall customizer default-subfeatures)))
173 (let ((*print-length* nil)
174 (*print-level* nil))
175 (format t
176 "target backend-subfeatures *SHEBANG-BACKEND-FEATURES*=~@<~S~:>~%"
177 *shebang-backend-subfeatures*))
179 ;;; Call for effect of signaling an error if no target picked.
180 (target-platform-name)
182 ;;; You can get all the way through make-host-1 without either one of these
183 ;;; features, but then 'bit-bash' will fail to cross-compile.
184 (unless (intersection '(:big-endian :little-endian) *shebang-features*)
185 (warn "You'll have bad time without either endian-ness defined"))
187 ;;; Some feature combinations simply don't work, and sometimes don't
188 ;;; fail until quite a ways into the build. Pick off the more obvious
189 ;;; combinations now, and provide a description of what the actual
190 ;;; failure is (not always obvious from when the build fails).
191 (let ((feature-compatibility-tests
192 '(("(and sb-thread (not gencgc))"
193 ":SB-THREAD requires :GENCGC")
194 ("(and sb-thread (not (or ppc x86 x86-64 arm64)))"
195 ":SB-THREAD not supported on selected architecture")
196 ("(and gencgc cheneygc)"
197 ":GENCGC and :CHENEYGC are incompatible")
198 ("(and cheneygc (not (or alpha arm hppa mips ppc sparc)))"
199 ":CHENEYGC not supported on selected architecture")
200 ("(and gencgc (not (or sparc ppc x86 x86-64 arm arm64)))"
201 ":GENCGC not supported on selected architecture")
202 ("(not (or gencgc cheneygc))"
203 "One of :GENCGC or :CHENEYGC must be enabled")
204 ("(and sb-dynamic-core (not linkage-table))"
205 ":SB-DYNAMIC-CORE requires :LINKAGE-TABLE")
206 ("(and sb-linkable-runtime (not sb-dynamic-core))"
207 ":SB-LINKABLE-RUNTIME requires :SB-DYNAMIC-CORE")
208 ("(and sb-linkable-runtime (not (or x86 x86-64)))"
209 ":SB-LINKABLE-RUNTIME not supported on selected architecture")
210 ("(and sb-linkable-runtime (not (or darwin linux win32)))"
211 ":SB-LINKABLE-RUNTIME not supported on selected operating system")
212 ("(and sb-eval sb-fasteval)"
213 ;; It sorta kinda works to have both, but there should be no need,
214 ;; and it's not really supported.
215 "At most one interpreter can be selected")
216 ("(and immobile-space (not x86-64))"
217 ":IMMOBILE-SPACE is supported only on x86-64")
218 ("(and compact-instance-header (not immobile-space))"
219 ":COMPACT-INSTANCE-HEADER requires :IMMOBILE-SPACE feature")
220 ("(and immobile-code (not immobile-space))"
221 ":IMMOBILE-CODE requires :IMMOBILE-SPACE feature")
222 ("(and immobile-symbols (not immobile-space))"
223 ":IMMOBILE-SYMBOLS requires :IMMOBILE-SPACE feature")
224 ;; There is still hope to make multithreading on DragonFly x86-64
225 ("(and sb-thread x86 dragonfly)"
226 ":SB-THREAD not supported on selected architecture")))
227 (failed-test-descriptions nil))
228 (dolist (test feature-compatibility-tests)
229 (let ((*features* *shebang-features*))
230 (when (read-from-string (concatenate 'string "#+" (first test) "T NIL"))
231 (push (second test) failed-test-descriptions))))
232 (when failed-test-descriptions
233 (error "Feature compatibility check failed, ~S"
234 failed-test-descriptions)))
236 ;;;; cold-init-related PACKAGE and SYMBOL tools
238 ;;; Once we're done with possibly ANSIfying the COMMON-LISP package,
239 ;;; it's probably a mistake if we change it (beyond changing the
240 ;;; values of special variables such as *** and +, anyway). Set up
241 ;;; machinery to warn us when/if we change it.
243 ;;; All code depending on this is itself dependent on #!+SB-SHOW.
244 #!+sb-show
245 (progn
246 (load "src/cold/snapshot.lisp")
247 (defvar *cl-snapshot* (take-snapshot "COMMON-LISP")))
249 ;;;; master list of source files and their properties
251 ;;; flags which can be used to describe properties of source files
252 (defparameter
253 *expected-stem-flags*
254 '(;; meaning: This file is not to be compiled when building the
255 ;; cross-compiler which runs on the host ANSI Lisp. ("not host
256 ;; code", i.e. does not execute on host -- but may still be
257 ;; cross-compiled by the host, so that it executes on the target)
258 :not-host
259 ;; meaning: This file is not to be compiled as part of the target
260 ;; SBCL. ("not target code" -- but still presumably host code,
261 ;; used to support the cross-compilation process)
262 :not-target
263 ;; meaning: This file must always be compiled by 'slam.lisp' even if
264 ;; the object is not out of date with respect to its source.
265 ;; Necessary if there are compile-time-too effects that are not
266 ;; reflected into make-host-2 by load-time actions of make-host-1.
267 :slam-forcibly
268 ;; meaning: The #'COMPILE-STEM argument :TRACE-FILE should be T.
269 ;; When the compiler is SBCL's COMPILE-FILE or something like it,
270 ;; compiling "foo.lisp" will generate "foo.trace" which contains lots
271 ;; of exciting low-level information about representation selection,
272 ;; VOPs used by the compiler, and bits of assembly.
273 :trace-file
274 ;; meaning: This file is to be processed with the SBCL assembler,
275 ;; not COMPILE-FILE. (Note that this doesn't make sense unless
276 ;; :NOT-HOST is also set, since the SBCL assembler doesn't exist
277 ;; while the cross-compiler is being built in the host ANSI Lisp.)
278 :assem
279 ;; meaning: The #'COMPILE-STEM argument called :IGNORE-FAILURE-P
280 ;; should be true. (This is a KLUDGE: I'd like to get rid of it.
281 ;; For now, it exists so that compilation can proceed through the
282 ;; legacy warnings in src/compiler/x86/array.lisp, which I've
283 ;; never figured out but which were apparently acceptable in CMU
284 ;; CL. Eventually, it would be great to just get rid of all
285 ;; warnings and remove support for this flag. -- WHN 19990323)
286 :ignore-failure-p
287 ;; meaning: Build this file, but don't put it on the list for
288 ;; genesis to include in the cold core.
289 :not-genesis))
291 (defparameter *stems-and-flags* (read-from-file "build-order.lisp-expr"))
293 (defvar *array-to-specialization* (make-hash-table :test #'eq))
295 (defmacro do-stems-and-flags ((stem flags) &body body)
296 (let ((stem-and-flags (gensym "STEM-AND-FLAGS")))
297 `(dolist (,stem-and-flags *stems-and-flags*)
298 (let ((,stem (first ,stem-and-flags))
299 (,flags (rest ,stem-and-flags)))
300 ,@body
301 (clrhash *array-to-specialization*)))))
303 ;;; Given a STEM, remap the path component "/target/" to a suitable
304 ;;; target directory.
305 (defun stem-remap-target (stem)
306 (let ((position (search "/target/" stem)))
307 (if position
308 (concatenate 'string
309 (subseq stem 0 (1+ position))
310 (target-platform-name)
311 (subseq stem (+ position 7)))
312 stem)))
313 (compile 'stem-remap-target)
315 ;;; Determine the source path for a stem.
316 (defun stem-source-path (stem)
317 (concatenate 'string "" (stem-remap-target stem) ".lisp"))
318 (compile 'stem-source-path)
320 ;;; Determine the object path for a stem/flags/mode combination.
321 (defun stem-object-path (stem flags mode)
322 (multiple-value-bind
323 (obj-prefix obj-suffix)
324 (ecase mode
325 (:host-compile
326 ;; On some xc hosts, it's impossible to LOAD a fasl file unless it
327 ;; has the same extension that the host uses for COMPILE-FILE
328 ;; output, so we have to be careful to use the xc host's preferred
329 ;; extension.
330 (values *host-obj-prefix*
331 (concatenate 'string "."
332 (pathname-type (compile-file-pathname stem)))))
333 (:target-compile (values *target-obj-prefix*
334 (if (find :assem flags)
335 *target-assem-obj-suffix*
336 *target-obj-suffix*))))
337 (concatenate 'string obj-prefix (stem-remap-target stem) obj-suffix)))
338 (compile 'stem-object-path)
340 ;;; Check for stupid typos in FLAGS list keywords.
341 (let ((stems (make-hash-table :test 'equal)))
342 (do-stems-and-flags (stem flags)
343 ;; We do duplicate stem comparison based on the object path in
344 ;; order to cover the case of stems with an :assem flag, which
345 ;; have two entries but separate object paths for each. KLUDGE:
346 ;; We have to bind *target-obj-prefix* here because it's normally
347 ;; set up later in the build process and we don't actually care
348 ;; what it is so long as it doesn't change while we're checking
349 ;; for duplicate stems.
350 (let* ((*target-obj-prefix* "")
351 (object-path (stem-object-path stem flags :target-compile)))
352 (if (gethash object-path stems)
353 (error "duplicate stem ~S in *STEMS-AND-FLAGS*" stem)
354 (setf (gethash object-path stems) t)))
355 ;; FIXME: We should make sure that the :assem flag is only used
356 ;; when paired with :not-host.
357 (let ((set-difference (set-difference flags *expected-stem-flags*)))
358 (when set-difference
359 (error "found unexpected flag(s) in *STEMS-AND-FLAGS*: ~S"
360 set-difference)))))
362 ;;;; tools to compile SBCL sources to create the cross-compiler
364 ;;; a wrapper for compilation/assembly, used mostly to centralize
365 ;;; the procedure for finding full filenames from "stems"
367 ;;; Compile the source file whose basic name is STEM, using some
368 ;;; standard-for-the-SBCL-build-process procedures to generate the
369 ;;; full pathnames of source file and object file. Return the pathname
370 ;;; of the object file for STEM.
372 ;;; STEM and FLAGS are as per DO-STEMS-AND-FLAGS. MODE is one of
373 ;;; :HOST-COMPILE and :TARGET-COMPILE.
374 (defun compile-stem (stem flags mode)
376 (let* (;; KLUDGE: Note that this CONCATENATE 'STRING stuff is not The Common
377 ;; Lisp Way, although it works just fine for common UNIX environments.
378 ;; Should it come to pass that the system is ported to environments
379 ;; where version numbers and so forth become an issue, it might become
380 ;; urgent to rewrite this using the fancy Common Lisp PATHNAME
381 ;; machinery instead of just using strings. In the absence of such a
382 ;; port, it might or might be a good idea to do the rewrite.
383 ;; -- WHN 19990815
384 (src (stem-source-path stem))
385 (obj (stem-object-path stem flags mode))
386 ;; Compile-for-effect happens simultaneously with a forked compile,
387 ;; so we need the for-effect output not to stomp on the real output.
388 (tmp-obj
389 (concatenate 'string obj
390 (if *compile-for-effect-only* "-scratch" "-tmp")))
392 (compile-file (ecase mode
393 (:host-compile #'compile-file)
394 (:target-compile (if (find :assem flags)
395 *target-assemble-file*
396 *target-compile-file*))))
397 (trace-file (find :trace-file flags))
398 (ignore-failure-p (find :ignore-failure-p flags)))
399 (declare (type function compile-file))
401 (ensure-directories-exist obj :verbose t)
403 ;; We're about to set about building a new object file. First, we
404 ;; delete any preexisting object file in order to avoid confusing
405 ;; ourselves later should we happen to bail out of compilation
406 ;; with an error.
407 (when (and (not *compile-for-effect-only*) (probe-file obj))
408 (delete-file obj))
410 ;; Original comment:
412 ;; Work around a bug in CLISP 1999-01-08 #'COMPILE-FILE: CLISP
413 ;; mangles relative pathnames passed as :OUTPUT-FILE arguments,
414 ;; but works OK with absolute pathnames.
416 ;; following discussion on cmucl-imp 2002-07
417 ;; "COMPILE-FILE-PATHNAME", it would seem safer to deal with
418 ;; absolute pathnames all the time; it is no longer clear that the
419 ;; original behaviour in CLISP was wrong or that the current
420 ;; behaviour is right; and in any case absolutifying the pathname
421 ;; insulates us against changes of behaviour. -- CSR, 2002-08-09
422 (setf tmp-obj
423 ;; (Note that this idiom is taken from the ANSI
424 ;; documentation for TRUENAME.)
425 (with-open-file (stream tmp-obj
426 :direction :output
427 ;; Compilation would overwrite the
428 ;; temporary object anyway and overly
429 ;; strict implementations default
430 ;; to :ERROR.
431 :if-exists :supersede)
432 (close stream)
433 (truename stream)))
434 ;; and some compilers (e.g. OpenMCL) will complain if they're
435 ;; asked to write over a file that exists already (and isn't
436 ;; recognizeably a fasl file), so
437 (when (probe-file tmp-obj)
438 (delete-file tmp-obj))
440 ;; Try to use the compiler to generate a new temporary object file.
441 (flet ((report-recompile-restart (stream)
442 (format stream "Recompile file ~S" src))
443 (report-continue-restart (stream)
444 (format stream "Continue, using possibly bogus file ~S" obj)))
445 (tagbody
446 retry-compile-file
447 (multiple-value-bind (output-truename warnings-p failure-p)
448 (restart-case
449 (if trace-file
450 (funcall compile-file src :output-file tmp-obj
451 :trace-file t :allow-other-keys t)
452 (funcall compile-file src :output-file tmp-obj))
453 (recompile ()
454 :report report-recompile-restart
455 (go retry-compile-file)))
456 (declare (ignore warnings-p))
457 (cond ((not output-truename)
458 (error "couldn't compile ~S" src))
459 (failure-p
460 (if ignore-failure-p
461 (warn "ignoring FAILURE-P return value from compilation of ~S"
462 src)
463 (unwind-protect
464 (restart-case
465 (error "FAILURE-P was set when creating ~S."
466 obj)
467 (recompile ()
468 :report report-recompile-restart
469 (go retry-compile-file))
470 (continue ()
471 :report report-continue-restart
472 (setf failure-p nil)))
473 ;; Don't leave failed object files lying around.
474 (when (and failure-p (probe-file tmp-obj))
475 (delete-file tmp-obj)
476 (format t "~&deleted ~S~%" tmp-obj)))))
477 ;; Otherwise: success, just fall through.
478 (t nil)))))
480 ;; If we get to here, compilation succeeded, so it's OK to rename
481 ;; the temporary output file to the permanent object file.
482 (cond ((not *compile-for-effect-only*)
483 (rename-file-a-la-unix tmp-obj obj))
484 ((probe-file tmp-obj)
485 (delete-file tmp-obj))) ; clean up the trash
487 ;; nice friendly traditional return value
488 (pathname obj)))
489 (compile 'compile-stem)
491 ;;; Execute function FN in an environment appropriate for compiling the
492 ;;; cross-compiler's source code in the cross-compilation host.
493 (defun in-host-compilation-mode (fn)
494 (declare (type function fn))
495 (let ((*features* (cons :sb-xc-host *features*)))
496 (with-additional-nickname ("SB-XC" "SB!XC")
497 (funcall fn))))
498 (compile 'in-host-compilation-mode)
500 ;;; Process a file as source code for the cross-compiler, compiling it
501 ;;; (if necessary) in the appropriate environment, then loading it
502 ;;; into the cross-compilation host Common lisp.
503 (defun host-cload-stem (stem flags)
504 (loop
505 (with-simple-restart (recompile "Recompile")
506 (let ((compiled-filename (in-host-compilation-mode
507 (lambda ()
508 (compile-stem stem flags :host-compile)))))
509 (return
510 (load compiled-filename))))))
511 (compile 'host-cload-stem)
513 ;;; like HOST-CLOAD-STEM, except that we don't bother to compile
514 (defun host-load-stem (stem flags)
515 (loop
516 (with-simple-restart (recompile "Reload")
517 (return (load (stem-object-path stem flags :host-compile))))))
518 (compile 'host-load-stem)
520 ;;;; tools to compile SBCL sources to create object files which will
521 ;;;; be used to create the target SBCL .core file
523 ;;; Run the cross-compiler on a file in the source directory tree to
524 ;;; produce a corresponding file in the target object directory tree.
525 (defun target-compile-stem (stem flags)
526 (funcall *in-target-compilation-mode-fn*
527 (lambda ()
528 (compile-stem stem flags :target-compile))))
529 (compile 'target-compile-stem)
531 ;;; (This function is not used by the build process, but is intended
532 ;;; for interactive use when experimenting with the system. It runs
533 ;;; the cross-compiler on test files with arbitrary filenames, not
534 ;;; necessarily in the source tree, e.g. in "/tmp".)
535 (defun target-compile-file (filename)
536 (funcall *in-target-compilation-mode-fn*
537 (lambda ()
538 (funcall *target-compile-file* filename))))
539 (compile 'target-compile-file)