File: readme.lisp

package info (click to toggle)
ecl 0.9i-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 22,424 kB
  • ctags: 28,771
  • sloc: ansic: 115,594; lisp: 63,241; asm: 45,930; sh: 15,564; cpp: 9,729; perl: 2,886; makefile: 2,751; yacc: 226; lex: 94; fortran: 24
file content (101 lines) | stat: -rw-r--r-- 2,184 bytes parent folder | download
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
;;; Copyright (c) 2005, Juan Jose Garcia-Ripoll
;;;
;;;   This program is free software; you can redistribute it and/or
;;;   modify it under the terms of the GNU Library General Public
;;;   License as published by the Free Software Foundation; either
;;;   version 2 of the License, or (at your option) any later version.
;;;
;;;   See file '../../Copyright' for full details.
;;;
;;; This an extremely simple example of how to build standalone programs and
;;; unified fasl files from a system definition file.  You should peruse this
;;; file and also test it by loading it on your copy of ECL.
;;;

;;;
;;; First of all, we need to include the ASDF module and the compiler
;;;

(require 'asdf)
(require 'cmp)
(use-package :asdf)

(setf *load-verbose* nil)
(setf c::*compile-verbose* nil)
(setf c::*suppress-compiler-warnings* t)
(setf c::*suppress-compiler-notes* t)

;;;
;;; This will show you what is running behind the walls of ASDF. Everything
;;; is built on top of the powerful C::BUILDER routine, which allows one
;;; to build anything from executables to shared libraries.
;;;
;;(trace c::builder)

;;;
;;; Next we create a definition containing the files in our project.
;;; Notice that file2.lisp depends on file1.lisp, hence the ":serial t"
;;;
(princ "

Loading definition file.

")

(defsystem #:example
    :serial t
    :components ((:file "file1")
		 (:file "file2")))

;;;
;;; Now we attempt building a single FASL file containing all those files.
;;; Notice that we remove any previous fasl file.
;;;

(princ "

Building FASL file 'example.fas'

")
(asdf:make-build :example :type :fasl)

;;;
;;; Now we load the previous file!
;;;

(princ "

Loading FASL file example.fas

")
(load "example.fas")

;;;
;;; Now that it worked, we attempt building a single program file with everything.
;;;

(princ "

Building standalone executable 'example' ('example.exe' in Windows)

")
(asdf:make-build :example :type :program)

;;;
;;; Test the program
;;;

(princ "

Executing standalone file 'example'

")
(ext:system "./example")

;;;
;;; Clean up everything
;;;

(mapc #'delete-file (append (directory "*.o")
			    (directory "*.obj")
			    (directory "example.*")))