LispWorks User Guide and Reference Manual > 32 The HCL Package

NextPrevUpTopContentsIndex

compile-file-if-needed

Function
Summary

Compiles a Lisp source file if it is newer than the corresponding fasl file.

Package

hcl

Signature

compile-file-if-needed input-pathname &key output-file load &allow-other-keys => output-truename , warnings-p , failure-p

Arguments

input-pathname

A pathname designator.

output-file

A pathname designator.

load

A generalized boolean.

Values

output-truename

A pathname or nil .

warnings-p

A generalized boolean.

failure-p

A generalized boolean.

Description

The function compile-file-if-needed compares the file-write-date of the source file named by input-pathname with the file-write-date of the appropriate fasl file (as computed by compile-file-pathname from input-pathname and output-file ).

If the fasl file does not exist or is older than input-pathname , then compile-file is called with input-pathname , output-file , load and any other arguments passed., and the values returned are those returned from compile-file .

Otherwise, if load is true compile-file-if-needed loads the fasl file and returns nil , and if load is nil it simply returns nil .

Example
CL-USER 19 > (compile-file-if-needed "H:/tmp/foo.lisp"
                                     :output-file
                                     "C:/temp/")
;;; Compiling file H:/tmp/foo.lisp ...
;;; Safety = 3, Speed = 1, Space = 1, Float = 1, Interruptible = 0
;;; Compilation speed = 1, Debug = 2, Fixnum safety = 3
;;; Source level debugging is off 
;;; Source file recording is  on 
;;; Cross referencing is off
; (TOP-LEVEL-FORM 1)
; (TOP-LEVEL-FORM 2)
; (TOP-LEVEL-FORM 3)
; FOO
; BAR
#P"C:/temp/foo.ofasl"
NIL
NIL
 
CL-USER 20 > (compile-file-if-needed "H:/tmp/foo.lisp"
                                     :output-file
                                     "C:/temp/"
                                     :load t)
; Loading fasl file C:\temp\foo.ofasl
NIL
See also

compile-file


LispWorks User Guide and Reference Manual - 22 Dec 2009

NextPrevUpTopContentsIndex