forked from fricas/fricas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makenotes.tex
887 lines (658 loc) · 27.5 KB
/
Makenotes.tex
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
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
%% Oh Emacs, this is a -*- Makefile -*-, so give me tabs.
\documentclass{article}
\usepackage{axiom}
\title{The Top Level \File{Makefile}}
\author{Timothy Daly \and Gabriel Dos~Reis}
\begin{document}
\maketitle
\begin{abstract}
\end{abstract}
\eject
\tableofcontents
\eject
\section{General Makefile Structure}
\label{sec:general-structure}
All the Makefiles in the \Tool{Axiom} build system are structured in very
similar ways. First, they have to build all of the files
in their own directory. Second, they have to invoke \Tool{Make} on each
of their subdirectories. This forms a natural recursive tree walk of
the Axiom source system directory structure. Third, they have to
explain all of the details about the directory, the files and the
target rules it manages and its subdirectories.
This section also serves as a reference for the meaning of the
general targets and variables within the \Tool{Axiom} build system.
\subsection{Standard targets}
\label{sec:general-structure:std-targets}
This section describes the meaning of \Tool{Make} targets present in every
Makefile of the \Tool{Axiom} build system. These are quite standard,
so that \Tool{Axiom} can be built just like most software using the
GNU build machinery. All of the targets discussed in this sub-section
are recursive.
\subsubsection{[[all]]}
\label{sec:general-structure:std-targets:all}
This target builds all of the \Tool{Axiom} sub-system controlled by the
specific \File{Makefile}. In particular, the [[all]] target in the
toplevel \File{Makefile} builds all the \Tool{Axiom} system.
According to GNU standard practice, the [[all]] target should not
build documentation files and those should be explicitly asked for.
However, \Tool{Axiom} uses the literate programming paradigm (which is
not mainstream in most GNU software). Consequently, some rules must
be broken somewhere. Which ones and where are questions not answered;
those would be subject to discussion.
\subsubsection{[[install]]}
\label{sec:general-structure:std-targets:install}
The purpose of this target is to build \Tool{Axiom} and install for
use. The build system is set up so that if [[make all]] just completed
then [[make install]] will not modify any file in the build directory,
Consequently it is possible to issue [[make all]] as one
user to build the whole system, and install it as another user. The typical
case is: on Unix-like system, build as ordinary user, then install as
superuser.
At the moment [[make install]] will create the sub-directory \File{axiom}
under the directory given [[$(prefix)]] --- default \File{/usr/local} ---
and install the \Tool{Axiom} system there. We don't use
[[$(exec_prefix)]] yet --- and we should.
\paragraph{Pre-installation commands.}
FIXME: To be written
\paragraph{Post-installation command.}
FIXME: To be written
\subsubsection{[[install-html]]}
\label{sec:general-structure:std-targets:install-html}
\subsubsection{[[install-dvi]]}
\label{sec:general-structure:std-targets:install-dvi}
\subsubsection{[[install-pdf]]}
\label{sec:general-structure:std-targets:install-pdf}
\subsubsection{[[install-ps]]}
\label{sec:general-structure:std-targets:install-ps}
\subsubsection{[[install-strip]]}
\label{sec:general-structure:std-targets:install-strip}
\subsubsection{[[uninstall]]}
\label{sec:general-structure:std-targets:uninstall}
\subsubsection{[[clean]]}
\label{sec:general-structure:std-targets:clean}
\subsubsection{[[mostlyclean]]}
\label{sec:general-structure:std-targets:mostlyclean}
\subsubsection{[[distclean]]}
\label{sec:general-structure:std-targets:distclean}
\subsubsection{[[maintainer-clean]]}
\label{sec:general-structure:std-targets:maintainer-clean}
\subsubsection{[[TAGS]]}
\label{sec:general-structure:std-targets:TAGS}
\subsubsection{[[pdf]]}
\label{sec:general-structure:std-targets:pdf}
\subsubsection{[[ps]]}
\label{sec:general-structure:std-targets:ps}
\subsubsection{[[dvi]]}
\label{sec:general-structure:std-targets:dvi}
\subsubsection{[[html]]}
\label{sec:general-structure:std-targets:html}
\subsubsection{[[info]]}
\label{sec:general-structure:std-targets:info}
\subsubsection{[[dist]]}
\label{sec:general-structure:std-targets:dist}
\subsubsection{[[check]]}
\label{sec:general-structure:std-targets:check}
\subsubsection{[[installcheck]]}
\label{sec:general-structure:std-targets:installcheck}
\subsubsection{[[installdirs]]}
\label{sec:general-structure:std-targets:installdirs}
\subsection{Standard installation variables}
\label{sec:general-structure:std-install}
\subsubsection{[[prefix]]}
\label{sec:general-structure:std-vars:prefix}
\subsubsection{[[exec_prefix]]}
\label{sec:general-structure:std-vars:exec-prefix}
\subsubsection{[[bindir]]}
\label{sec:general-structure:std-vars:bindir}
\subsubsection{[[sbindir]]}
\label{sec:general-structure:std-vars:sbindir}
\subsubsection{[[libexec]]}
\label{sec:general-structure:std-vars:libexec}
\subsubsection{[[datarootdir]]}
\label{sec:general-structure:std-vars:datarootdir}
\subsubsection{[[datadir]]}
\label{sec:general-structure:std-vars:datadir}
\subsubsection{[[sysconfdir]]}
\label{sec:general-structure:std-vars:sysconfdir}
\subsubsection{[[sharedstatedir]]}
\label{sec:general-structure:std-vars:sharedstatedir}
\subsubsection{[[localstatedir]]}
\label{sec:general-structure:std-vars:localstatedir}
\subsubsection{[[includedir]]}
\label{sec:general-structure:std-vars:includedir}
\subsubsection{[[oldincludedir]]}
\label{sec:general-structure:std-vars:oldincludedir}
\subsubsection{[[docdir]]}
\label{sec:general-structure:std-vars:docdir}
\subsubsection{[[infodir]]}
\label{sec:general-structure:std-vars:infodir}
\subsubsection{[[htmldir]]}
\label{sec:general-structure:std-vars:htmldir}
\subsubsection{[[dvidir]]}
\label{sec:general-structure:std-vars:dvidir}
\subsubsection{[[pdfdir]]}
\label{sec:general-structure:std-vars:pdfdir}
\subsubsection{[[psdir]]}
\label{sec:general-structure:std-vars:psdir}
\subsubsection{[[libdir]]}
\label{sec:general-structure:std-vars:libdir}
\subsubsection{[[lispdir]]}
\label{sec:general-structure:std-vars:lispdir}
\subsubsection{[[localedir]]}
\label{sec:general-structure:std-vars:localedir}
\subsubsection{[[mandir]]}
\label{sec:general-structure:std-vars:mandir}
\subsubsection{[[man1dir]]}
\label{sec:general-structure:std-vars:man1dir}
\subsubsection{[[man2dir]]}
\label{sec:general-structure:std-vars:man2dir}
\subsubsection{[[manext]]}
\label{sec:general-structure:std-vars:manext}
\subsubsection{[[man1ext]]}
\label{sec:general-structure:std-vars:man1ext}
\subsubsection{[[man2ext]]}
\label{sec:general-structure:std-vars:man2ext}
\subsection{Standard build variables}
\label{sec:general-structure:std-build}
\subsection{Standard source variables}
\label{sec:general-structure:std-source}
\subsubsection{[[srcdir]]}
\label{sec:general-structure:std-source:srcdir}
\section{The Build Flow}
\label{sec:build-flow}
The build flow of \Tool{Axiom} seems, first, a bit intricate to describe.
This description is STILL IN WORK IN PROGRESS. Therefore it is
incorrekt, incomplet, and iNconSiStenT.
First of all \Tool{noweb} is needed to extract source codes from the
documentation. Almost everything depends on \Tool{noweb} --- the exception
being possible build of \Tool{GCL}.
Second, we need a Lisp runtime system. If one is available from
the build environment, we are done. In fact, currently we do insist that
the Lisp runtime system is \Tool{GCL}. Otherwise, we have to build one.
Third, we have to make the subdirectory \File{src/} where all the
work actually happens. Part of \Tool{Axiom} is written in Boot, part
in Common Lisp, part in C, and the rest in SPAD. The SPAD compiler
is written partly in Boot, therefore \File{src/algebra/},
\File{src/input/}, \File{src/interp/} depend on \File{src/boot/}. The rest
is mostly written in C and depends only on \File{src/lib/}. The
interpreter and the compiler also depend on \File{src/lib/} for interface
with C (sockets and all that).
\begin{verbatim}
DRAW a DIAGRAM!
\end{verbatim}
The \File{src/} directory looks like this:
\begin{verbatim}
src/
algebra/
booklets/
boot/
clef/
doc/
etc/
graph/
hyper/
include/
input/
interp/
lib/
lisp/
script/
share/
sman/
\end{verbatim}
\File{src/algebra/}, \File{src/input/} depend on \File{src/interp},
\File{src/interp/} depend on \File{src/boot}.
Hue. This discussion is better done in src/Makefile. Move it there.
\subsection{Build components}
Building \Tool{Axiom} consists of building several logical components.
These loosely correspond to the sub-directories of \File{src/} shown in
the previous section. They can be built individually by invoking
[[make all-xxx]] where [[xxx]] is one of
\begin{verbatim}
algebra asq axiomsys book boot clef doc graph hyper
input interpsys lib lisp sman src
\end{verbatim}
\section{The Top Level \File{Makefile}}
<<*>>=
<<environment>>
subdir =
SUBDIRS = src
build_srcdir = $(builddir)/src
AXIOM_SRC_TARGETS = all-algebra all-asq all-axiomsys all-book all-boot \
all-clef all-doc all-graph all-hyper all-input all-interpsys \
all-lib all-lisp all-sman all-src
.PHONY: all $(AXIOM_SRC_TARGETS)
all: all-ax
all-ax: all-src
@echo finished system build on `date` | tee >lastBuildDate
all-src: stamp-rootdirs @axiom_all_prerequisites@
$(AXIOM_SRC_TARGETS):
cd $(build_srcdir) && $(MAKE) $@
<<rootdirs>>
<<noweb>>
<<gcl>>
<<book>>
<<install>>
mostlyclean-local:
@-rm -f lastBuildDate
clean-local: mostlyclean-local
@ rm -f stamp-*
@ rm -rf int
@ rm -rf obj
distclean-local: clean-local
@-rm -rf build
@-rm -rf $(axiom_targetdir)
@-rm -f config.status config.log
@-rm -f Makefile
$(top_builddir)/config.status: $(top_srcdir)/configure
$(SHELL) ./config.status --recheck
$(RECURSIVE_TARGETS): stamp-rootdirs @axiom_all_prerequisites@
@
\subsection{[[pamphlets]]}
The [[pamphlets]] variable is to be defined by every Makefile. It shall
contain the list of all pamphlet files of interest in the directory. The
value of this variable is used to build documentation files.
At the moment, the toplevel directory contains only two pamphlet files
of interest:
<<pamphlets>>=
pamphlets = configure.ac.pamphlet Makefile.pamphlet
@
\subsection{Environment}
\subsubsection{VERSION}
The [[VERSION]] variable is a unique string intended to show up
in the banner at startup time. I can be anything but is intended
to be a unique way of identifying the SVN version so we can
reference bug reports to versions.
The [[VERSION]] variable is used in the [[src/interp/Makefile]]
to set a lisp variable [[boot::*build-version*]]. This variable
is used by the [[yearweek]] function to construct the banner.
The banner also contains a build timestamp so we can determine
when the image is compiled. We touch the file
called [[$(axiom_targetdir)/timestamp]] and using a formatted form
of its file information. See the [[YEARWEEK]] variable in the
[[src/interp/Makefile.pamphlet]] and the [[yearweek]] function in
[[src/interp/util.lisp.pamphlet]].
\subsubsection{SPAD}
The [[SPAD]] variable is normally specified in the environment.
It is expected to be a path to the top level directory of the
shipped system. For example, if we want to build a linux system
the [[SPAD]] variable should look like:
`pwd`/target/i686-pc-linux
\subsubsection{SYS}
From the [[SPAD]] variable we look at the last directory name
and create a version of Axiom for that system. The [[SYS]]
environment variable is the last directory name in the [[SPAD]]
variable.
\subsubsection{SPD}
The [[SPD]] variable is taken to be the current working directory
where this Makefile lives. This is obviously the root of the whole
system source tree. All Makefiles form environment variables based
on this value.
Next we see the six top-level directories discussed above being
defined using the [[SPD]] variable.
\subsubsection{AXIOM\_X11\_CFLAGS}
The variable [[AXIOM_X11_CFLAGS]] holds the C compiler flags necessary
to compile part of Axiom that depends on the X Window System. It is
computed at configure-time, based on the characteristics of the target
platform.
\subsubsection{AXIOM\_X11\_LDFLAGS}
The variable [[AXIOM_X11_LDFLAGS]] holds the linker flags necessary
for parts of Axiom that depends on the X Window System. It is
computed at configure-time, based on the characteristics of the target
platform.
\subsubsection{SRC}
The [[SRC]] subdirectory is a hand-generated, read-only top level
directory containing the source code. This is assumed to be completely
system-independent and, in general, it can reside on a CD or NFS
mounted file system. This is useful for building several different
kinds of systems (as specified by the [[SYS]] variable from a single
source tree.
\subsubsection{INT, MNT and OBJ}
Obsolete directories, not used anymore.
\subsubsection{MNT}
The [[MNT]] subdirectory is a complete, working copy of Axiom.
This directory contains everything that is needed to run Axiom and
can be copied anywhere. Everything in this directory takes its required
information from the [[$AXIOM]] shell variable. Once this directory is
copied the [[SRC]], [[INT]], and [[OBJ]] subdirectories can be erased.
\subsubsection{ZIPS}
The [[ZIPS]] subdirectory contains particular versions of subsystems
that Axiom needs in tar-gzip format. The Makefiles will unpack them.
It also contains patch files to these subsystems. The Makefile will
apply those patches. Then it will configure and build the required
subsystems.
\subsubsection{TMP}
The [[TMP]] directory is used in place of [[/tmp]] in order to
avoid writing outside of our build tree.
Note that TMP is a workspace in the [[obj]] directory. It is
working space for temporary files since we cannot assume that
we can write outside our own tree. Output from commands like
the [[document]] command will generally be written to the
[[TMP/trace]] file. If the build seems to hang while making a
document file then check this file. It will contain the output
of the latex command and the likely error in the tex file.
\subsubsection{SPADBIN}
The [[SPADBIN]] directory is the path to the executable
binary directory of the shipped system. The directory contains
all of the executable commands, such as the [[document]]
command. The [[document]] command lives in the [[src/scripts]]
subdirectory and will be copied to [[SPADBIN]] before we start
walking the build subtree.
\subsubsection{INC}
The [[INC]] directory contains all the include files for the C
programs.
\subsubsection{CCLBASE}
The [[CCLBASE]] subdirectory contains the path to the [[CCL]]
version of lisp. This was the original lisp used by NAG.
\subsubsection{The [[NOISE]] variable }
Unused.
\subsubsection{PART and SUBPART}
Because of the size of this build we do everything possible to
minimize the work necessary to rebuild. In order to allow
finer control of the build we have two options that can be
specified. The first is the [[PART]] variable. The second
is the [[SUBPART]] variable. The [[PART]] variable basically
specifies which directory we wish to build.
Setting the PART as:
PART=foo
will look for a stanza in the Makefile as:
\${PART}dir
which expands to:
foodir
Variable PART can be specified (environment or command-line) as
one of:
\begin{verbatim}
(all | lib | install | lisp | interp | comp | graph | hyper
| clef | input | sman | boot | include | doc | algebra )
\end{verbatim}
It is possible to be more specific with a directory.
<<part>>=
PART= cprogs
SUBPART= everything
@
\subsubsection{[[subdir]]}
This variable should be defined every Makefile. It shall contain the
relative path (ending with a slash) from the toplevel source directory
to the directory containing that Makefile. For the toplevel directory, it
is empty.
[[subdir]] is used to instruct [[config.status]] --- created at
configuration time --- to recreate a particular Makefile if needed.
\subsubsection{DESTDIR and COMMAND}
The install directory is [[/usr/local/axiom]] by default
but this can be changed on the command line by typing:
\begin{verbatim}
make DESTDIR=/yourabsolutepath COMMAND=fullPathAndCommand install
\end{verbatim}
The [[COMMAND]] string has been modified to use the [[DESTDIR]]
variable so we can properly find the axiom command.
The [[DOCUMENT]] variable is now set to replace the direct call
to the [[$SPADBIN/document]] command. This will allow it to be
changed on the command line.
<<environment>>=
## ----------------------------------------
## -- Old-style Axiom makefile variables --
## ----------------------------------------
## CCLBASE=${OBJ}/${SYS}/ccl/ccllisp
COMMAND=$(DESTDIR)$(libdir)/axiom/target/$(target)/bin/axiom
GCLOPTS=@GCLOPTS@
<<pamphlets>>
<<part>>
@
\subsection{rootdirs}
Note that the -p (parent) option to mkdir will make all intermediate
directories as well if they don't exist.
<<rootdirs>>=
stamp-rootdirs: $(axiom_build_document)
mkdir -p $(axiom_build_bindir)
mkdir -p $(axiom_build_libdir)
mkdir -p $(axiom_target_bindir)
mkdir -p $(axiom_target_libdir)
mkdir -p $(axiom_target_docdir)
mkdir -p $(axiom_target_datadir)
mkdir -p $(axiom_target_texdir)
mkdir -p $(axiom_targetdir)/algebra/
mkdir -p $(axiom_target_srcdir)/algebra
mkdir -p ${TMP}
$(STAMP) stamp-rootdirs
@
\subsection{book}
This stanza constructs the book from the original pamphlet file.
At this time there is no difference between the pamphlet file
and straight latex (intentionally). Thus we just need to make
sure the correct directories are in place, copy the files, and
run latex over the pamphlet file.
<<book>>=
book:
@ echo 79 building the book as $(axiom_target_docdir)/book.dvi
mkdir -p ${TMP}
mkdir -p $(axiom_target_docdir)/ps
$(INSTALL) $(axiom_src_srcdir)/doc/book.pamphlet $(axiom_target_docdir)
cp $(axiom_src_srcdir)/doc/ps/* $(axiom_target_docdir)/ps
(cd $(axiom_target_docdir) ; \
latex book.pamphlet --interaction nonstopmode && \
latex book.pamphlet --interaction nonstopmode ; \
rm book.pamphlet ; \
rm book.toc ; \
rm book.log ; \
rm book.aux )
@ echo 80 The book is at $(axiom_target_docdir)/book.dvi
@
\subsection{noweb}
Note that this stanza echos a line into a file called noweb.
Makefile semantics says that when this file exists we will
skip this stanza. So in a clean system where the noweb file
does not exist we will execute this once and never again
(unless someone deletes the noweb file).
Never add anything after the colon otherwise the noweb
build will depend on it rather than the noweb flag file
in the current directory.
Patch the use of [[make]] to use [[${MAKE}]]. BSD style
systems use [[gmake]] rather than [[make]] so we need to pass this
information from above for the build to succeed.
<<noweb>>=
.PHONY: all-noweb
all-noweb: stamp-noweb
stamp-noweb:
@echo Making in noweb
( mkdir noweb && \
cd noweb && \
$(TAR) -zxf $(axiom_optional_srcdir)/noweb-2.10a.tgz && \
cd src && \
cat Makefile \
| sed -e "s|^BIN=.*|BIN=$(axiom_build_bindir)|" \
-e "s|^LIB=.*|LIB=$(axiom_build_libdir)|" \
-e "s|^MAN=.*|MAN=$(axiom_build_mandir)|" \
-e "s|^TEXINPUTS=.*|TEXINPUTS=$(axiom_target_texdir)|" \
-e 's/ make / $$\(MAKE\) /' \
-e "s,c/nt,c/nt$(EXEEXT)," \
-e "s,c/markup,c/markup$(EXEEXT)," \
-e "s,c/mnt,c/mnt$(EXEEXT)," \
-e "s,c/finduses,c/finduses$(EXEEXT)," \
> Makefile.tmp && mv Makefile.tmp Makefile && \
./awkname $(AWK) && $(MAKE) all install )
$(STAMP) stamp-noweb
@
\subsection{\File{gcl/}}
At the moment, \Tool{Axiom} uses \Tool{GCL} as its Lisp platform.
\Tool{GCL} may not be available for a given host. In that case,
we must build a running image.
We delegate the details of constructing common lisp to the Makefiles in
the subtree. We need only ensure that the Makefiles are up to date.
If and when we build GCL, it is ``installed'' in [[$(axiom_builddir)]].
The \File{gcl} binary will be accessible as
[[$(axiom_build_bindir)/gcl$(EXEEXT)]].
The augmented fresh Lisp image is also accessible as
[[$(axiom_build_bindir)/lisp$(EXEEXT)]] for use to build Boot translators
and the \Tool{Axiom} interpreter and compiler.
\subsubsection{[[lsp]]}
The [[obj/sys/lsp]] dir is necessary to keep collectfn and sys-proclaims.
The collectfn.lsp file is a special extension to GCL to collect type
information during a compile-file. This information gets written out
to a [[.fn]] file. These [[.fn]] files can be loaded and written out
as a file containing proclaims information. If this proclaims information
is available at compile time then the resulting function calls are much
more efficient. The [[sys-proclaims]] file contains type information
about standard common lisp function calls.
<<gcl>>=
.PHONY: all-gcl
all-gcl: $(axiom_build_bindir)/gcl$(EXEEXT)
$(axiom_build_bindir)/gcl$(EXEEXT):
if test "$(srcdir)" != "$(builddir)"; then \
cp -r $(srcdir)/gcl $(builddir); \
fi && cd gcl && \
./configure --prefix=$(axiom_builddir) ${GCLOPTS} && \
$(MAKE) && $(MAKE) install
@
\subsection{install}
<<install>>=
install:
@echo Installing Axiom in $(prefix)
rm -rf $(DESTDIR)$(libdir)/axiom
@mkdir -p $(DESTDIR)$(libdir)/axiom
@cp -pr $(builddir)/target $(DESTDIR)$(libdir)/axiom
@echo '#!/bin/sh -' > ${COMMAND}
@echo AXIOM=$(libdir)/axiom/target/$(target) >> ${COMMAND}
@echo export AXIOM >> ${COMMAND}
@echo PATH='$${AXIOM}/bin':'$${PATH}' >> ${COMMAND}
@echo export PATH >> ${COMMAND}
@cat $(axiom_src_srcdir)/etc/axiom >> ${COMMAND}
@chmod +x ${COMMAND}
@rm -f $(DESTDIR)$(bindir)/axiom
@mkdir -p $(DESTDIR)$(bindir)
@ $(INSTALL_PROGRAM) $(COMMAND) $(DESTDIR)$(bindir)/axiom
@echo 79 Axiom installation finished.
@
Until now, pamphlet files are also \LaTeX{}ed as part of a normal build.
We are moving to more standard build process where the documentation
is made as a separate rule. Please, this does not go against the
literate programming movement. The new build machinery has a general
make target [[dvi]] that builds DVI files of the corresponding pamphlet
files. It does so by consulting the value of the variable [[pamphlets]]
--- which should be defined by every Makefile.
\section{The Platform Makefiles}
The Top Level Makefile examines the SPAD variable to determine
the target build platform. It sets up the general structure
of the world. Then it invokes one of these platform Makefiles.
Each of these Makefiles sets several
environment variables that are specific to this platform.
\subsubsection{The [[PLF]] variable }
\subsubsection{The [[CCF]] variable }
\subsubsection{The [[LDF]] variable }
The LDF variable is the generic loader flags. This gives information
about where various libraries are located on specific platforms. On
linux, for instance, the library [[libXpm.a]] is used by the graphics
routines. This library is usually found in [[/usr/X11R6/bin/libXpm.a]].
Thus, on the linux platform LDF is defined as
\begin{verbatim}
LDF= -L/usr/X11R6/lib
\end{verbatim}
\subsubsection{The [[CC]] variable }
\subsubsection{The [[AWK]] variable }
On most systems the gnu toolset is the default. Thus we can just use
'awk' and the program works. However, on some systems we need to
specify that we are using the gnu toolset, and we need to use
[[gawk]] instead of [[awk]].
\subsubsection{The [[PATCH]] variable }
On most systems the gnu toolset is the default. Thus we can just use
'patch' and the program works. However, on some systems we need to
specify that we are using the gnu toolset, and we need to use
[[gpatch]] instead of [[patch]].
\subsubsection{The [[RANLIB]] variable }
\subsubsection{The [[TOUCH]] variable }
\subsubsection{The [[TAR]] variable }
\subsubsection{The [[AXIOMXLROOT]] variable }
\subsubsection{The [[O]] variable }
Various Common Lisp systems prefer certain filename extensions.
This defaults to ``o'' so a compile of foo.lisp becomes foo.o
but other systems prefer .fasl so a compile of foo.lisp becomes
foo.fasl. Change this based on the target lisp.
\subsubsection{The [[BYE]] variable }
\subsubsection{The [[LISP]] variable }
\subsubsection{The [[DAASE]] variable}
Axiom uses 5 files, the *.daase files, which are called ``the
databases''. They contain cross-reference, signatures,
and other information needed by the interpreter and compiler.
When the system is being built from scratch these databases
need to exist. However, they get dynamically rebuilt after
the algebra files are compiled. The bootstrap versions of these
databases live in the [[src/share]] subdirectory. Axiom will
use the value of the shell variable [[DAASE]] to find its
databases. If this variable is unbound it uses the standard
[[$(axiom_targetdir)]] path. Note that Axiom will append the string
[[/algebra]] to the value of [[DAASE]]. The default value setting
given here is:
[[DAASE=$(axiom_src_datadir)]]
so [[${SRC}/share/algebra/*.daase]] will be the
Axiom bootstrap database files.
\subsection{Makefile.MACOSX}
On the MAC OSX someone decided (probably a BSDism) to rename the
[[SIGCLD]] signal to [[SIGCHLD]]. In order to handle this in the
low level C socket code (in particular, in [[src/lib/fnct_key.c]])
we change the platform variable to be [[MACOSXplatform]] and create
this new stanza.
We need to add [[-I/usr/include/sys]] because [[malloc.h]] has been
moved on this platform.
We need to explicitly put [[-I/usr/include]] before
[[-I/usr/include/sys]] because the MAC seems to search in a
different order than linux systems. The [[sys]] versions of
the include files are broken, at least for Axiom use.
\section{Cleanup}
Following the standard practice of GNU build machinery, there are
three [[make]] rules for cleanup:
\begin{enumerate}
\item [[mostlyclean]]
\item [[clean]]
\item [[distclean]]
\end{enumerate}
[[mostlyclean]] acts almost like [[clean]] except that it does not
delete some files that are time-consuming to make (if remaking is
not needed), e.g. [[libspad.a]] or [[lisp]].
[[clean]] deletes any file created by running [[make]].
[[distclean]] cleans up the build directory to the point where it almost
reverts to the state of the build directory before the initial build.
In summary [[clean]] can be interpreted as a prerequisite of [[distclean]],
and [[mostlyclean]] a prerequisite of [[clean]].
To ease the process of writing rules to clean up directories, the new
build machinery has divided each general rule cleanup rule into two
categories
\begin{itemize}
\item [[\%-generic]]
\item [[\%-local]]
\end{itemize}
The stem [[\%]] standards for [[mostlyclean]], [[clean]], and
[[distclean]]. The [[\%-generic]] rules are defined by the
build machinery. Only the tree rules [[\%-local]] need to be defined
by Makefiles. The intent is that they do directory-specific cleanup.
\subsection{[[generic cleanups]]}
There are many cleanup tasks that are common to almost all directories.
They are handled by generic cleanup rules
\begin{itemize}
\item [[mostlyclean-generic]]
\item [[clean-generic]]
\item [[distclean-generic]]
\end{itemize}
For instances, they delete intermediate files produced by \LaTeX{}.
If you're writing a new Makefile for Axiom, you do not have to
define these rules.
\subsection{[[local cleanups]]}
Some Makefiles have specific needs about cleanups. For example, the
directory [[src/lib]] that contains mostly C codes would need to delete
intermediate files for C codes weaved from pamphlets. They must
handle those through
\begin{itemize}
\item [[mostlyclean-local]]
\item [[clean-local]]
\item [[distclean-local]]
\end{itemize}
Notice that each Makefile should define those targets, even if they do
nothing.
\eject
\begin{thebibliography}{99}
\bibitem{1} CMUCL {\bf http://www.cons.org/cmucl}
\bibitem{2} GCL {\bf http://savannah.gnu.org/projects/gcl}
\bibitem{3} Codemist Ltd, ``Alta'', Horsecombe Vale Combs Down
Bath BA2 5QR UK Tel. +44-1225-837430
{\bf http://www.codemist.co.uk}
\bibitem{5} \$SPAD/zips/advi-1.2.0.tar.gz, the advi source tree
\end{thebibliography}
\end{document}