forked from daly/axiom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.pamphlet
1748 lines (1493 loc) · 50.8 KB
/
Makefile.pamphlet
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
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\documentclass{article}
\usepackage{axiom}
\begin{document}
\title{The Top Level Makefile}
\author{Timothy Daly}
\maketitle
\begin{abstract}
\end{abstract}
\eject
\tableofcontents
\newpage
\section{The overall build process}
Makefiles are responsible for building all of their subdirectories
and then themselves. The system is built in the following order
\begin{enumerate}
\item books -- building pdf files
\item src/scripts -- building scripts
\item src/lib -- building lib files
\item lsp -- building gcl common lisp
\item src -- building src
\item src/interp -- building interpreter files
\item src/share -- building share files
\item src/algebra -- building help files
\item src/algebra -- building input files
\item src/algebra -- building xhtml files
\item src/algebra -- building algebra files
\begin{itemize}
\item algebra bootstrap complete
\item layer 0 of 24 complete
\item layer 1 of 24 complete
\item layer 2 of 24 complete
\item layer 3 of 24 complete
\item layer 4 of 24 complete
\item layer 5 of 24 complete
\item layer 6 of 24 complete
\item layer 7 of 24 complete
\item layer 8 of 24 complete
\item layer 9 of 24 complete
\item layer 10 of 24 complete
\item layer 11 of 24 complete
\item layer 12 of 24 complete
\item layer 13 of 24 complete
\item layer 14 of 24 complete
\item layer 15 of 24 complete
\item layer 16 of 24 complete
\item layer 17 of 24 complete
\item layer 18 of 24 complete
\item layer 19 of 24 complete
\item layer 20 of 24 complete
\item layer 21 of 24 complete
\item layer 22 of 24 complete
\item layer 23 of 24 complete
\item layer 0 copy complete
\end{itemize}
\item src/etc -- building etc
\item src/doc -- building doc files
\item src/input -- running regression tests
\end{enumerate}
\section{General Makefile Structure}
Makefiles are responsible for four things. First, they have to set up
the output directory structure so that all of the build machinery
can assume it exists. Second, they have to build all of the files
in their own directory. Third, they have to invoke Make on each
of their subdirectories. This forms a natural tree walk of the
directory structure. Fourth, they have to explain all of the details
about the directory, the files it manages and its subdirectories.
The clean stanza has been modified to be more effective. Previously
it walked the Makefile hierarchy trying to clean subdirectories. This
method often fails for various reasons (e.g. permissions, incomplete
builds, etc). Now we simply remove the created files directly.
\newpage
\subsection{The Top Level Makefile}
We have added a stanza to separate the build of documents from the build
of source files. As much as possible we would like to do the document
builds in parallel with the source builds. We kick off a make for the
documents in the background and then kick off a make in the foreground
for the source code. This is independent of using make in parallel and
instead uses the shell to fork the processes. We have not had much luck
getting make to build in parallel reliably.
Note that make cannot handle recursively calling itself in the same
directory so we have to expand the serial forms inline. Cheesy.
\begin{chunk}{parallel}
all: rootdirs axiom.sty tanglec libspad lspdir
@ echo 1 making a ${SYS} system, PART=${PART} SUBPART=${SUBPART}
@ echo 2 Environment ${ENV}
@ ${BOOKS}/tanglec Makefile.pamphlet "Makefile.${SYS}" >Makefile.${SYS}
@ cp ${BOOKS}/dvipdfm.def ${MNT}/${SYS}/doc
@ cp ${BOOKS}/changepage.sty ${MNT}/${SYS}/doc
@ ${EXTRACT} Makefile.pamphlet
@ cp Makefile.pdf ${MNT}/${SYS}/doc/src/root.Makefile.pdf
@ if [ "${RUNTYPE}" = "parallel" ] ; then \
( echo p4 starting parallel make of input files ; \
${ENV} ${MAKE} input ${NOISE} & ) ; \
else \
if [ "${BUILD}" = "full" ] ; then \
( echo s4 starting serial make of input files ; \
cd ${MNT}/${SYS}/doc/src/input ; \
cp ${BOOKS}/axiom.sty . ; \
cp ${SRC}/input/*.eps . ; \
for i in `ls ${SRC}/input/*.input.pamphlet` ; do \
if [ .${NOISE} = . ] ; \
then \
latex $$i ; \
else \
( echo p4a making $$i ; \
latex $$i >${TMP}/trace ) ; \
fi ; \
done ; \
rm -f *~ ; \
rm -f *.pamphlet~ ; \
rm -f *.log ; \
rm -f *.tex ; \
rm -f *.toc ; \
rm -f *.aux ) ; fi ; \
fi
@ if [ "${RUNTYPE}" = "parallel" ] ; then \
( echo s2 starting parallel make of books ; \
echo s3 ${SPD}/books/Makefile from \
${SPD}/books/Makefile.pamphlet ; \
cd ${SPD}/books ; \
${EXTRACT} Makefile ; \
cp Makefile.pdf ${MNT}/${SYS}/doc/src/books.Makefile.pdf ; \
${ENV} ${MAKE} & ) ; \
else \
( echo s2 starting serial make of books ; \
echo s3 ${SPD}/books/Makefile from \
${SPD}/books/Makefile.pamphlet ; \
cd ${SPD}/books ; \
${EXTRACT} Makefile ; \
cp Makefile.pdf ${MNT}/${SYS}/doc/src/books.Makefile.pdf ; \
if [ "${BUILD}" = "full" ] ; then \
${ENV} ${MAKE} ; fi ) ; \
fi
@ echo p7 starting make of src
@ ${ENV} $(MAKE) -f Makefile.${SYS}
@ echo 3 finished system build on `date` | tee >lastBuildDate
\getchunk{lsp}
libspad:
@ echo 11a making libspad
@ ( cd ${OBJ}/${SYS}/lib ; \
${BOOKS}/tanglec ${BOOKS}/bookvol8.pamphlet Makefile >Makefile ; \
${ENV} ${MAKE} libspad.a )
axiom.sty:
@ echo 11c copying books/axiom.sty
@ cp ${BOOKS}/axiom.sty .
rootdirs:
@ echo 11 checking directory structure
mkdir -p ${TMP}
mkdir -p ${INT}/algebra
mkdir -p ${INT}/hyper
mkdir -p ${INT}/input
mkdir -p ${INT}/interp
mkdir -p ${INT}/sman
mkdir -p ${OBJ}/${SYS}/bin
mkdir -p ${OBJ}/${SYS}/etc
mkdir -p ${OBJ}/${SYS}/graph
mkdir -p ${OBJ}/${SYS}/hyper/pages
mkdir -p ${OBJ}/${SYS}/interp
mkdir -p ${OBJ}/${SYS}/lib
mkdir -p ${OBJ}/${SYS}/sman
mkdir -p ${OBJ}/${SYS}/proofs
mkdir -p ${MNT}/doc
mkdir -p ${MNT}/${SYS}/algebra
mkdir -p ${MNT}/${SYS}/src/algebra
mkdir -p ${MNT}/${SYS}/autoload
mkdir -p ${MNT}/${SYS}/bin
mkdir -p ${MNT}/${SYS}/doc/axbook
mkdir -p ${MNT}/${SYS}/doc/bitmaps
mkdir -p ${MNT}/${SYS}/doc/hypertex/bitmaps
mkdir -p ${MNT}/${SYS}/doc/msgs
mkdir -p ${MNT}/${SYS}/doc/ps
mkdir -p ${MNT}/${SYS}/doc/cookbook
mkdir -p ${MNT}/${SYS}/doc/spadhelp
mkdir -p ${MNT}/${SYS}/doc/src/input
mkdir -p ${MNT}/${SYS}/graph/parabola.view
mkdir -p ${MNT}/${SYS}/input
mkdir -p ${MNT}/${SYS}/lib/graph
mkdir -p ${MNT}/${SYS}/lib/scripts
input:
@ echo p9 making input documents
@ if [ "${BUILD}" = "full" ] ; then \
( cd ${MNT}/${SYS}/doc/src/input ; \
cp ${BOOKS}/axiom.sty . ; \
for i in `ls ${SRC}/input/*.input.pamphlet` ; \
do latex $$i ; \
done ; \
rm -f *~ ; \
rm -f *.pamphlet~ ; \
rm -f *.log ; \
rm -f *.tex ; \
rm -f *.toc ; \
rm -f *.aux ) ; fi
\end{chunk}
\begin{chunk}{*}
\getchunk{ENVDEFAULTS}
\getchunk{ENVAR}
\getchunk{parallel}
\getchunk{book}
\getchunk{tanglec.c}
\getchunk{literate commands}
\getchunk{install}
document:
@ echo 4 making a ${SYS} system, PART=${PART} SUBPART=${SUBPART}
@ echo 5 Environment ${ENV}
@ ${BOOKS}/tanglec Makefile.pamphlet "Makefile.${SYS}" >Makefile.${SYS}
@ ${ENV} $(MAKE) -f Makefile.${SYS} document
@echo 6 finished system build on `date` | tee >lastBuildDate
clean:
@ echo 7 making a ${SYS} system, PART=${PART} SUBPART=${SUBPART}
@ echo 8 Environment ${ENV}
@ rm -f axiom.sty
@ rm -f Makefile.pdf
@ rm -f Makefile.dvi
@ rm -f Makefile.${SYS}
@ rm -f books/Makefile
@ rm -f books/Makefile.dvi
@ rm -f books/Makefile.pdf
@ rm -f books/axiom.bib
@ rm -f books/sortsig.lisp
@ rm -f lsp/axiom.sty
@ rm -f lsp/Makefile lsp/Makefile.dvi lsp/Makefile.pdf
@ rm -rf lsp/gcl*
@ rm -f src/axiom.sty
@ rm -f src/Makefile
@ rm -f src/Makefile.dvi
@ rm -f src/Makefile.pdf
@ rm -f src/algebra/book*pamphlet
@ rm -f src/algebra/*.spad
@ rm -f src/algebra/Makefile
@ rm -f src/etc/axiom.sty
@ rm -f src/etc/Makefile src/etc/Makefile.dvi src/etc/Makefile.pdf
@ rm -f src/interp/book*pamphlet
@ rm -f src/interp/axiom.sty
@ rm -f src/input/axiom.sty
@ rm -f src/share/axiom.sty
@ rm -f src/share/Makefile src/share/Makefile.dvi
@ rm -f src/share/Makefile.pdf
@ rm -rf int
@ rm -rf obj
@ rm -rf mnt
@ for i in `find . -name "*~"` ; do rm -f $$i ; done
@ rm -f lastBuildDate
@ rm -f books/tanglec
@ rm -f src/input/Makefile src/input/Makefile.dvi
@ rm -f src/input/Makefile.pdf
@ rm -f src/interp/Makefile src/interp/Makefile.dvi
@ rm -f src/interp/Makefile.pdf
@ rm -f src/share/Makefile src/share/Makefile.dvi
@ rm -f src/share/Makefile.pdf
@ rm -f Makefile.aux
@ rm -f Makefile.log
\end{chunk}
\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 CVS 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 {\tt 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 \verb|${MNT}/${SYS}/timestamp| and using a formatted form
of its file information. See the YEARWEEK variable in the
src/interp/Makefile.pamphlet and the {\tt yearweek} function in
src/interp/util.lisp.pamphlet.
\subsubsection{SPAD}
The SPAD environment variable is normally specified.
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:
\begin{verbatim}
`pwd`/new/mnt/{\bf linux}
\end{verbatim}
\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{LSP}
This variable specifies where the LSP subdirectory lives.
It is normally a directory at the top level of the system but
we do not assume that to be true. Other lisps might require it
to be elsewhere.
\subsubsection{GCLDIR}
This file contained the only mention of the AKCLDIR variable which
gives the path to the version of AKCL. Now that the system is running
on GCL this variable has been renamed to GCLDIR. This cannot be eliminated
entirely because the system uses this variable to look up a file
called collectfn.lsp which is part of the GCL distribution. This
file lookup is in conditional lisp code so other lisps will not
see the file load. The collectfn.lsp code is used by GCL to generate
the ``.fn'' files which are used to optimize function calling.
Also, lsp/sys-proclaims.lisp is a file generated
during the GCL build which contains type information about lisp
functions, allowing fast-function calling behavior.
When defining the environment, the SPD variable is defined as the
current directory. SYS is taken as the last non-directory part of
the environment variable \verb|$AXIOM| (e.g. if
\verb|$AXIOM=/(a-path)/mnt/linux|
then SYS=linux). It is {\bf mandatory} that \verb|$AXIOM| does
{\bf not} contain any trailing slash, because the {\tt notdir} function
will return the string following the final slash and would thus return
the empty string.
\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}
The INT subdirectory is a machine-generated, system-independent
top-level directory containing source code. Axiom builds from literate
sources. This work only needs to be done once at the first build. The
INT directory is a cache of work. It can be erased at will.
However steps such as generating lisp code from spad code, while
done by machine, are system-independent. Therefore this subdirectory,
once built, can reside with the SRC subdirectory on CD or NFS as a
read-only branch.
\subsubsection{OBJ}
The OBJ subdirectory is a machine-generated, system-dependent
top level directory containing things like compiler binaries. The
OBJ directory is a cache of work. It can be erased at will.
Because it is system-dependent it needs to be written at build
time by compilers for each specific system.
\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 \verb|$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 normal unix 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 {\tt 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 {\tt document}
command. The {\tt 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{The NOISE variable }
The NOISE variable is used in the calls to the document
command. In general, where the document command is called in
the Makefiles it is called with the following form:
\begin{verbatim}
${SPADBIN}/document ${NOISE} foo
\end{verbatim}
with the default value of NOISE being:
\begin{verbatim}
NOISE="-o ${TMP}/trace"
\end{verbatim}
The reason NOISE exists is that the latex command will
generate a page of output which is uninteresting during the
make. However if there is a latex syntax error in a pamphlet
file the make will continue past the error due to the nonstopmode
flag. To see the actual error message rerun the make as:
\begin{verbatim}
make NOISE=
\end{verbatim}
\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:
\begin{verbatim}
PART=foo
\end{verbatim}
will look for a stanza in the Makefile as:
\begin{verbatim}
\${PART}dir
\end{verbatim}
which expands to:
\begin{verbatim}
foodir
\end{verbatim}
Variable PART can be specified (environment or command-line) as
one of:
\begin{verbatim}
(all | lib | install | lisp | interp | comp | graph | hyper
| input | sman | boot | include | doc | algebra )
\end{verbatim}
It is possible to be more specific with a directory using SUBPART.
\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 document command. This will allow it to be
changed on the command line.
\section{The Environment}
\begin{chunk}{ENVDEFAULTS}
VERSION:="Axiom (May 2017)"
##### special paths
SPD:=$(shell pwd)
SRC:=${SPD}/src
LSP:=${SPD}/lsp
INT:=${SPD}/int
OBJ:=${SPD}/obj
MNT:=${SPD}/mnt
TMP:=${OBJ}/tmp
ZIPS:=${SPD}/zips
BOOKS:=${SPD}/books
SRCDIRS:="interpdir sharedir algebradir etcdir docdir \
graphdir smandir hyperdir browserdir inputdir"
SYS:=$(notdir $(AXIOM))
DAASE:=${SRC}/share
PROOFS:=${OBJ}/${SYS}/proofs
SPAD:=${SPD}/mnt/${SYS}
SPADBIN:=${MNT}/${SYS}/bin
DOCUMENT:=${SPADBIN}/document
EXTRACT:=${BOOKS}/extract
##### installation paths
DESTDIR:=/usr/local/axiom
COMMAND:=${DESTDIR}/mnt/${SYS}/bin/axiom
##### functions we need
AWK:=gawk
PATCH:=patch
RANLIB:=ranlib
TAR:=tar
TOUCH:=touch
UNCOMPRESS:=gunzip
####K C Related variables
PLF=${SYS}platform
CCF="-O2 -fno-strength-reduce -D_GNU_SOURCE -D${PLF} \
-I/usr/X11/include \
-Wno-absolute-value -std=gnu89 -w"
INC:=${SPD}/src/include
CC:=gcc
XLIB:=/usr/X11R6/lib
LDF="-L/usr/X11/lib -L/usr/X11R6/lib64 -L/usr/local/lib64 -L/usr/openwin/lib64 -L/usr/lib64 "
O:=o
##### lisp related variables
BYE:=bye
\getchunk{GCLVERSION}
GCLDIR:=${LSP}/${GCLVERSION}
\getchunk{GCLOPTS-LOCBFD}
LISP:=lsp
##### command line control
NOISE:="-o ${TMP}/trace"
PART:= cprogs
SUBPART:= everything
RUNTYPE:=serial
# can be richtests, catstests, regresstests (see src/input/Makefile)
# alltests, notests
TESTSET:=notests
BUILD:=full
ACL2:=
COQ:=
\end{chunk}
\subsection{The ENV variable}
\begin{chunk}{ENVAR}
ENV:= \
ACL2=${ACL2} \
AWK=${AWK} \
BOOKS=${BOOKS} \
BUILD=${BUILD} \
BYE=${BYE} \
CC=${CC} \
CCF=${CCF} \
COMMAND=${COMMAND} \
COQ=${COQ} \
DAASE=${DAASE} \
DESTDIR=${DESTDIR} \
DOCUMENT=${DOCUMENT} \
EXTRACT=${EXTRACT} \
GCLDIR=${GCLDIR} \
GCLOPTS=${GCLOPTS} \
GCLVERSION=${GCLVERSION} \
INC=${INC} \
INT=${INT} \
LDF=${LDF} \
LISP=${LISP} \
LSP=${LSP} \
MNT=${MNT} \
NOISE=${NOISE} \
O=${O} \
OBJ=${OBJ} \
PART=${PART} \
PATCH=${PATCH} \
PLF=${PLF} \
PROOFS=${PROOFS} \
RANLIB=${RANLIB} \
RUNTYPE=${RUNTYPE} \
SPAD=${SPAD} \
SPADBIN=${SPADBIN} \
SPD=${SPD} \
SRC=${SRC} \
SRCDIRS=${SRCDIRS} \
SUBPART=${SUBPART} \
SYS=${SYS} \
TANGLE=${TANGLE} \
TAR=${TAR} \
TESTSET=${TESTSET} \
TMP=${TMP} \
TOUCH=${TOUCH} \
UNCOMPRESS=${UNCOMPRESS} \
VERSION=${VERSION} \
WEAVE=${WEAVE} \
XLIB=${XLIB} \
ZIPS=${ZIPS}
\end{chunk}
\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.
\begin{chunk}{book}
book:
@ echo 79 building the book as ${MNT}/${SYS}/doc/book.dvi
@ cp ${SRC}/doc/book.pamphlet ${MNT}/${SYS}/doc
@ cp -pr ${SRC}/doc/ps ${MNT}/${SYS}/doc
@ (cd ${MNT}/${SYS}/doc ; \
if [ .${NOISE} = . ] ; then \
( latex book.pamphlet --interaction nonstopmode ; \
latex book.pamphlet --interaction nonstopmode ) ; \
else \
( latex book.pamphlet --interaction nonstopmode >${TMP}/trace ; \
latex book.pamphlet --interaction nonstopmode >${TMP}/trace ) ; \
fi ; \
rm book.pamphlet ; \
rm book.toc ; \
rm book.log ; \
rm book.aux )
@ echo 80 The book is at ${MNT}/${SYS}/doc/book.dvi
\end{chunk}
\subsection{tanglec.c}
\begin{chunk}{tanglec.c}
tanglec: books/tanglec.c
@echo t01 making tanglec from books/tanglec.c
@( cd books ; gcc -o tanglec tanglec.c )
\end{chunk}
\subsection{src}
We should recompile the world with the .fn information but not here.
\begin{verbatim}
( for i in `find . -name "*.lsp"` ; \
do echo $$i ; touch $$i ; done )
( for i in `find . -name "*.lisp"` ; \
do echo $$i ; touch $$i ; done )
@echo 15a remaking ${SRC}/interp for performance
@(cd src ; ${ENV} ${MAKE} )
\end{verbatim}
\begin{chunk}{src}
srcdir: ${SPD}/src/Makefile
@echo 15 making ${SPD}/src
@( cd src ; ${ENV} ${MAKE} )
${SPD}/src/Makefile: ${SPD}/src/Makefile.pamphlet
@echo 16 making ${SPD}/src/Makefile from ${SPD}/src/Makefile.pamphlet
( cd src ; \
${EXTRACT} Makefile ; \
cp Makefile.pdf ${MNT}/${SYS}/doc/src/src.Makefile.pdf )
libspadclean:
@echo 17 cleaning ${OBJ}/${SYS}/lib
@rm -rf ${OBJ}/${SYS}/lib
@( cd src ; ${EXTRACT} Makefile )
@( cd src ; ${ENV} ${MAKE} clean )
@rm -f ${SPD}/src/Makefile ${SPD}/src/Makefile.dvi
\end{chunk}
\subsection{src setup}
\begin{chunk}{srcsetup}
srcsetup: ${SPD}/src/Makefile
@echo 18 making ${SPD}/src
@( cd src ; ${ENV} ${MAKE} setup )
\end{chunk}
\subsection{lsp}
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.
When we first make GCL we the src/Makefile will create a marker file
called gcldir. This file has the same name as the stanza to create
GCL and thus will prevent GCL from rebuilding. We need to do this
since we have no control over the GCL makefiles.
The \verb|${OBJ}/${SYS}/bin| directory is where the lisps get built.
\subsubsection{LSPMakefile}
We need to specialize the Makefile stanza based on the version
of Lisp we plan to use. At the moment there are 3 GCL versions
which run Axiom: 2.4.1, 2.5, and 2.6 These are incompatible versions
so we have different patches against them. The details are in
the lsp/Makefile.pamphlet file. Here we just decide which section
to choose. The default is 2.4.1 but if the GCLVERSION is changed
then the Makefile is rewritten to extract the later version.
It looks for a chunk name that matches the version number.
\begin{chunk}{LSPMakefile}
${LSP}/Makefile: ${LSP}/Makefile.pamphlet
@echo 20 making ${LSP}/Makefile from ${LSP}/Makefile.pamphlet
@( cd lsp ; \
${EXTRACT} Makefile.pamphlet ; \
if [ "${GCLVERSION}" != "gcl-2.4.1" ] ; then \
${BOOKS}/tanglec Makefile.pamphlet ${GCLVERSION} >Makefile ; \
fi ; \
cp Makefile.pdf ${MNT}/${SYS}/doc/src/lsp.Makefile.pdf )
\end{chunk}
Here we add mkdir -p \verb|${OBJ}/${SYS}/lsp| because we need to rename the
\verb|gcl_collectfn.lsp| back to collectfn.lsp. We also start adding support
for sys-proclaim.lsp and other dynamically collected proclaim information.
The obj/sys/bin dir is necessary to keep the compiled lisp image.
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.
\begin{chunk}{lsp}
lspdir: ${LSP}/Makefile
@echo 19 making ${LSP}
@mkdir -p ${OBJ}/${SYS}/bin
@mkdir -p ${OBJ}/${SYS}/lsp
@echo =====================================
@echo lsp BUILDING GCL COMMON LISP
@echo =====================================
(cd lsp ; ${ENV} DESTDIR= ${MAKE} gcldir )
@(cp ${GCLDIR}/unixport/saved_gcl ${SPADBIN}/${GCLVERSION})
\getchunk{LSPMakefile}
lspclean:
@echo 21 cleaning ${OBJ}/${SYS}/ccl
@rm -rf ${LSP}/${GCLVERSION}
@rm -rf ${INT}/ccl
@rm -rf ${OBJ}/${SYS}/ccl
@rm -rf ${LSP}/gcldir
@rm -f ${LSP}/Makefile ${LSP}/Makefile.dvi
\end{chunk}
\subsection{install}
\begin{chunk}{install}
install:
@echo 78 installing Axiom in ${DESTDIR}
@mkdir -p ${DESTDIR}
@cp -pr ${MNT} ${DESTDIR}
@echo '#!/bin/sh -' >${COMMAND}
@echo AXIOM=${DESTDIR}/mnt/${SYS} >>${COMMAND}
@echo export AXIOM >>${COMMAND}
@echo PATH='$${AXIOM}/bin':'$${PATH}' >>${COMMAND}
@echo export PATH >>${COMMAND}
@cat ${INT}/sman/axiom >>${COMMAND}
@chmod +x ${COMMAND}
@echo 79 Axiom installation finished.
@echo
@echo Please add $(shell dirname ${COMMAND}) to your PATH variable
@echo Start Axiom with the command $(shell basename ${COMMAND})
@echo
\end{chunk}
\subsection{document}
Each file in the system is in pamphlet form. This stanza, which is not
executed by default, will walk the directories generating the
documentation for each file. These are dvi files and since they are
system-independent and machine-generated they live in the INT
subdirectory. In particular, we will build an INT/DOC subtree
mirroring the LSP and SRC subtrees. The INT/DOC
subtree can be removed with no ill effect. Since all of the pamphlet
files live in either the LSP or SRC subdirectories we make
sure the INT/DOC/LSP and INT/DOC/SRC directories exist.
\begin{chunk}{document}
document:
@echo 22 documenting files
@(cd lsp ; ${ENV} ${MAKE} document )
@(cd src ; ${ENV} ${MAKE} document )
\end{chunk}
\subsection{clean}
\begin{chunk}{clean}
clean:
@ echo 7 making a ${SYS} system, PART=${PART} SUBPART=${SUBPART}
@ echo 8 Environment ${ENV}
@ rm -f lsp/Makefile.dvi
@ rm -f lsp/Makefile
@ rm -f trace
@ rm -f *~
@ rm -f Makefile.${SYS}
@ rm -rf ${MNT}
@ rm -rf int
@ rm -rf obj
@ rm -rf mnt
@ for i in `find src -name "Makefile"` ; do rm -f $i ; done
@ for i in `find src -name "Makefile.dvi"` ; do rm -f $i ; done
\end{chunk}
\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 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 -L/usr/lib ${XLIB}/libXpm.a -lXpm"
\end{verbatim}
\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 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 LISP variable }
There are 3 kinds of "lisp" files in the Axiom build process.
The first are the "clisp" files. These are common lisp files
generated by the boot compiler. The second are the "lisp" files.
These are hand written common lisp code. The third are the "lsp"
files. These are files generated by GNU Common Lisp. The LISP
variable is used to name the third kind of files as this may
change when the underlying common lisp is changed.
\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
\verb|${MNT}/${SYS}| path. Note that Axiom will append the string
/algebra to the value of DAASE. The default value setting
given here is:
\verb|DAASE=${SRC}/share|
so \verb|${SRC}/share/algebra/*.daase| will be the
Axiom bootstrap database files.
\subsubsection{The XLIB variable}
The XLIB variable tells us where the X11 libraries live.
Axiom needs to use libXpm.a to build the graph subdirectory.
\subsubsection{The SRCDIRS variable}
The SRCDIRS variable is used in the src/Makefile.pamphlet
to decide what directories to build on a given platform. This is
needed at the moment because certain functions do not yet work on
all platforms.
\subsubsection{The GCLVERSION variable }
GCLVERSION is the name of the GCL version. The one we used to
build the original version of the system is gcl-2.4.1. The system
will attempt to untar a file in the ZIPS directory with the
name GCLVERSION.tgz, cd to the GCLVERSION subdirectory and
do a ./configure followed by a make.
The GCLVERSION variable is also used to make the GCLDIR variable.
GCLDIR tells depsys where GCL lives. The depsys image needs to
load a file from GCL (cmpnew/collectfn.lsp) which is used to generate
optimizations for function calling in Axiom. This is handled automatically
by changing this variable.
If GCLVERSION is ``gcl-system'', then GCL is not built locally,
and it is assumed that the ``gcl'' command is available off the path.
IF this GCL is unsuitable for building Axiom then very bad things
will happen.
NOTE WELL: IF YOU CHANGE THIS YOU SHOULD ERASE THE lsp/Makefile FILE.
This will cause the build to remake the lsp/Makefile from the
lsp/Makefile.pamphlet file and get the correct version. If you
forget to erase the lsp/Makefile the wrong patches will be applied.
\begin{chunk}{GCLVERSION}
#GCLVERSION=gcl-2.4.1
#GCLVERSION=gcl-2.5
#GCLVERSION=gcl-2.5.2
#GCLVERSION=gcl-2.6.1
#GCLVERSION=gcl-2.6.2
#GCLVERSION=gcl-2.6.2a
#GCLVERSION=gcl-2.6.3
#GCLVERSION=gcl-2.6.5
#GCLVERSION=gcl-2.6.6
#GCLVERSION=gcl-2.6.7pre
#GCLVERSION=gcl-2.6.7
#GCLVERSION=gcl-2.6.8pre
#GCLVERSION=gcl-2.6.8pre2
#GCLVERSION=gcl-2.6.8pre3
#GCLVERSION=gcl-2.6.8pre4
#GCLVERSION=gcl-2.6.8pre7
#GCLVERSION=gcl-cygwin
#GCLVERSION=gcl-2.6.9
#GCLVERSION=gcl-2.6.10
#GCLVERSION=gcl-2.6.11
GCLVERSION=gcl-2.6.12
#GCLVERSION=gcl-2.6.13pre
\end{chunk}
\subsubsection{The GCLOPTS configure variable}
The GCLOPTS lisp requires some parameters
for building which vary from system
to system. We create an environment variable here so we can add options
to the configure command in the lsp/Makefile.pamphlet.
\begin{chunk}{GCLOPTS}
GCLOPTS="--enable-vssize=65536*2 --disable-xgcl --disable-tkconfig"
\end{chunk}
It turns out that we can successfully build GCL on many more systems
if we set the GCLOPTS to build a local BFD.
We are failing during build because "directoryp is undefined" along
with the message
\begin{verbatim}
Error: Cannot get relocated section contents
\end{verbatim}
\begin{chunk}{GCLOPTS-LOCBFD}
GCLOPTS="--enable-vssize=65536*2 --disable-xgcl --disable-tkconfig"
\end{chunk}
For the gcl-2.6.8pre7 version we move to using the custreloc option.
\begin{chunk}{GCLOPTS-CUSTRELOC}
GCLOPTS="--enable-vssize=65536*2 --disable-xgcl --disable-tkconfig"
\end{chunk}
For the MACOSX port we need the following options. The ``--disable-nls'' means
that we will not be supporting natural language internationalization.
The ``--enable-maxpage'' has been eliminated because it causes build failures.
The ``--enable-machine'' parameter appears to be used by configure from the
setting of the ``canonical'' variable, which is in turn set by a shell script.
We need to add ``--enable-locbfd'' and ``--disable-dlopen'' due to the error
``unexec: not enough room for load commands for new \_\_DATA segments''.
\begin{chunk}{GCLOPTS-MACPORT}
GCLOPTS="--enable-vssize=65536*2 --disable-xgcl --disable-tkconfig"
\end{chunk}
\subsection{Makefile.freebsd}
\begin{chunk}{Makefile.freebsd}
\getchunk{ENVDEFAULTS}
####1 C related variables
INC:=${SPD}/src/include
PLF=BSDplatform
CCF="-O2 -pipe -fno-strength-reduce -D_GNU_SOURCE \
-D${PLF} -I/usr/X11R6/include -I/usr/local/include -std=gnu89 -w"
CC:=gcc
XLIB:=/usr/X11R6/lib
LDF="-L/usr/X11R6/lib -L/usr/local/lib"
O:=o
\getchunk{GCLOPTS-CUSTRELOC}
\getchunk{ENVAR}
all: srcsetup srcdir
@echo 45 Makefile.FreeBSD called
@echo 46 Environment : ${ENV}
@echo 47 finished system build on `date` | tee >lastBuildDate
@- if [ "${TESTSET}" != "notests" ] ; \
then grep "result FAILED" int/input/*.regress || true ; fi
\getchunk{literate commands}
\getchunk{srcsetup}
\getchunk{src}
\getchunk{lsp}
\getchunk{document}
\getchunk{clean}
\end{chunk}
\subsection{Makefile.windows}
This is for the Windows port. We assume that the build will be done
using GCC under MSYS.
We've modified the GCLOPTS variable from the standard config in
two ways. First we add --enable-debug so more information is
available for testing and second we removed --enable-statsysbfd.
\begin{chunk}{Makefile.windows}
\getchunk{ENVDEFAULTS}
AWK=awk
####2 C related variables
INC:=${SPD}/src/include