aboutsummaryrefslogtreecommitdiff
path: root/src/lisp/Makefile.pamphlet
blob: 4fe2bacd5c37896883102148ee8779361e5da2ae (plain)
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
%% Oh Emacs, this is a -*- Makefile -*-, so give me tabs.
\documentclass{article}
\usepackage{axiom}

\title{\File{src/lisp/Makefile} Pamphlet}
\author{The Axiom Team}

\begin{document}
\maketitle

\begin{abstract}
\end{abstract}
\eject

\tableofcontents
\eject

\section{The Makefile}

The purpose of this Makefile is to create a fresh Lisp image, [[$(OUT)/lisp]],
for use to make \Tool{interpsys} and \Tool{AXIOMsys}.  To that end, 
it augments an existing Lisp image, at the moment \Tool{GCL}, with 
some specific C-routines. 

\section{The Makefile}

<<build augmented lisp>>=
## Create a fresh image for building interpsys and AXIOMsys
## These objects files are the C runtime support
## and must be compiled into the Lisp image,
## as they must be present in the final interpreter
## and image.
lisp_c_objects = \
		$(build_libdir)/bsdsignal.$(COBJEXT) \
		$(build_libdir)/cfuns-c.$(COBJEXT) \
		$(build_libdir)/sockio-c.$(COBJEXT)

$(OUT)/lisp$(EXEEXT): base-lisp$(EXEEXT)
ifeq (@axiom_lisp_flavor@,gcl)
	@axiom_gcl_rsym_hack@
	echo '(let* ((sys-cc compiler::*cc*) ' \
	     '      (sys-ld compiler::*ld*) ' \
	     '      (compiler::*cc* (concatenate (quote string) ' \
	     '                                   $(GCL_LTCC)    ' \
	     '                                   sys-cc))       ' \
	     '      (compiler::*ld* (concatenate (quote string) ' \
	     '                                   $(GCL_LTLD)    ' \
	     '                                   sys-ld)))       ' \
             '(compiler::link (quote ($(FASLS))) "lisp$(EXEEXT)" ' \
             ' (format nil "(progn (let ((*load-path* (cons ~S *load-path*))'\
                                        ' (si::*load-types* ~S))' \
                                       ' (compiler::emit-fn t))' \
                                  ' (when (fboundp (quote si::sgc-on))' \
                                        ' (si::sgc-on nil))' \
				  ' (setq si::*top-level-hook* (read-from-string \"|AxiomCore|::|topLevel|\")))"' \
                      ' si::*system-directory* (quote (list ".lsp")))' \
               '  "$(lisp_c_objects) @axiom_c_runtime_extra@"))' \
            | ./base-lisp$(EXEEXT)
	$(mkinstalldirs) $(OUT)
	$(INSTALL_PROGRAM) lisp$(EXEEXT) $(OUT)
endif

ifeq (@axiom_lisp_flavor@,ecl)
base_lisp_objects = ("core.$(OBJEXT)")
else
base_lisp_objects = nil
endif


base-lisp$(EXEEXT): core.$(FASLEXT)
	$(AXIOM_LISP) \
		$(eval_flags) '(load "core")' \
		$(eval_flags) '(|AxiomCore|::|link| "$@" (quote $(base_lisp_objects)) (quote |AxiomCore|::|topLevel|))'


axiom_optimize_options = @axiom_optimize_options@

edit = sed \
	-e 's|@open_axiom_installdir[@]|$(open_axiom_installdir)|g' \
	-e 's|@axiom_optimize_options[@]|$(axiom_optimize_options)|g' \
	-e 's|@host[@]|$(host)|g' \
	-e 's|@build[@]|$(build)|g' \
	-e 's|@target[@]|$(target)|g'

core.lisp: $(srcdir)/core.lisp.in
	$(edit) $< > $@.tmp
	$(top_srcdir)/config/move-if-change $@.tmp $@

core.$(FASLEXT): core.lisp
ifeq (@axiom_lisp_flavor@,ecl)
	$(AXIOM_LISP) $(quiet_flags) \
		$(eval_flags) '(require (quote cmp))' \
		$(eval_flags) '(compile-file "$<" :system-p t)' \
		$(eval_flags) '(c::build-fasl "$@" :lisp-files (quote ("core.$(OBJEXT)")))' \
		$(eval_flags) '(quit)'
else
	$(AXIOM_LISP) $(quiet_flags) \
		$(eval_flags) '(progn (compile-file "$<") (quit))'
endif

@

<<*>>=
OUT = $(axiom_build_bindir)

subdir = src/lisp/

pamphlets = Makefile.pamphlet

build_libdir = ./$(top_builddir)/src/lib

lisp_DEPENDENCIES = $(build_libdir)/cfuns-c.lo \
		    $(build_libdir)/sockio-c.lo \
		    $(build_libdir)/libspad.la


## Ideally, we would like to use Libtool for producing, and linking with,
## object files from C codes.  That means any C source code
## explicitly included in OpenAxiom, or produced internally by a Lisp
## compiler.  However, the SYSTEM calls by GCL on Windows is very tricky
## to convince to properly resolve path names to executables.
## Consequently we temporarily give up here, e.g., we don't
## instruct GCL to use Libtool on Windows.
GCL_LTCC = $(if $(findstring mingw, $(target)),"","$(LIBTOOL) --mode=compile ")
GCL_LTLD = $(if $(findstring mingw, $(target)),"","$(LIBTOOL) --mode=link ")
COBJEXT = $(if $(findstring mingw, $(target)),$(OBJEXT),lo)

## Again, ideally, we would like GCL to link with the compiled Lisp
## code from core.lisp.  However, the general interface compiler::link
## that GCL provides for that task is unsupported on Windows platforms.
## So, we instruct GCL so load the source file instead.
fasl_ext = $(if $(findstring mingw, $(target)),.lisp,.$(FASLEXT))
FASLS = $(patsubst %,"%", $(addsuffix $(fasl_ext),core))

.PHONY: all all-lisp
all: all-ax all-lisp

all-ax all-lisp: stamp

stamp: $(OUT)/lisp$(EXEEXT)
	@rm -f stamp
	$(STAMP) $@

<<build augmented lisp>>

mostlyclean-local:
	rm -f *.$(FASLEXT)
	@rm -f $(OUT)/lisp$(EXEEXT) lisp$(EXEEXT)
	@rm -f stamp

clean-local: mostlyclean

distclean-local: clean-local
	@rm -f Makefile
@

\eject
\begin{thebibliography}{99}
\bibitem{1} nothing
\end{thebibliography}
\end{document}