1
2subdir = src/interp/
3
4DOC=$(fricas_target_docdir)/src/interp
5
6fricas_debug_compiler=@fricas_debug_compiler@
7
8# Command to translate Boot to Common Lisp
9BOOT_TO_LISP = $(fricas_build_helper) \
10	       --translate_boot --debug=$(fricas_debug_compiler) \
11	       --use=$(BOOTSYS) --output=$@ $<
12
13# Command to translate Common Lisp to native object code
14COMPILE_LISP = $(fricas_build_helper) \
15	       --compile_lisp --debug=$(fricas_debug_compiler) \
16	       --use=$(LOADSYS) --output=$@ $<
17
18BOOTSYS= $(fricas_build_bindir)/bootsys
19
20LOADSYS= $(fricas_build_bindir)/lisp$(EXEEXT)
21SAVESYS= $(fricas_build_bindir)/interpsys$(EXEEXT)
22FRICASSYS= $(fricas_target_bindir)/FRICASsys$(EXEEXT)
23
24OBJ_files= macros setq \
25	buildom cattable clam clammed \
26	compat compress cparse cstream database \
27	format g-boot g-cndata g-error g-opt \
28	g-timer	g-util hypertex i-analy \
29	i-coerce i-coerfn i-eval i-funsel i-intern \
30	i-map i-output i-resolv	i-spec1 i-spec2 i-syscmd \
31	i-toplev incl interop int-top lisplib macex match \
32	msg msgdb nlib nrunfast \
33	nrungo nrunopt pathname pf2sex pile \
34	posit property ptrees rulesets scan \
35	serror server setvars sfsfun simpbool slam \
36	spad termrw trace \
37	daase ncomp parsing \
38	parse postpar setvart s-parser scwrap2 spaderror
39
40OCOBJ_files= apply c-doc c-util category compiler \
41	define functor info iterator modemap nruncomp \
42	package	htcheck
43
44BROBJ_files= bc-matrix bc-misc bc-solve ht-util htsetvar \
45	ht-root br-con br-data showimp br-op1 br-op2 \
46	br-search br-util br-saturn
47
48ASCOMP_files= hashcode as foam_l
49
50# hashcode must be before interop
51ALL_OBJ_files = vmlisp ${ASCOMP_files} ${OBJ_files} ax ${BROBJ_files} \
52                ${OCOBJ_files}
53
54ALL_OBJS = $(patsubst %, %.$(LISPOBJEXT), $(ALL_OBJ_files))
55
56.PRECIOUS:	${SAVESYS}
57.PRECIOUS:	${FRICASSYS}
58
59PROCLAIMS=(progn (load "$(srcdir)/interp-proclaims.lisp"))
60
61.SUFFIXES:
62.SUFFIXES: .boot .clisp .lisp
63
64.PHONY: all all-ax all-interpsys all-fricassys
65
66all: all-ax
67
68all-ax: stamp
69	@echo finished $(srcdir)
70
71stamp:  remove-stamp build-images
72	$(STAMP) stamp
73
74.PHONY: remove-stamp
75remove-stamp:
76	-rm -f stamp
77
78.PHONY: build-images
79build-images: remove-stamp all-interpsys
80
81all-interpsys: $(SAVESYS)
82
83clean:
84	@echo 619 cleaning $(builddir)
85
86.PRECIOUS: %.clisp
87%.clisp: $(srcdir)/%.boot
88	$(BOOT_TO_LISP)
89
90.PRECIOUS: %.$(LISPOBJEXT)
91%.$(LISPOBJEXT): %.clisp
92	$(COMPILE_LISP)
93
94# Compile the part of the interpreter written in Common Lisp
95.PRECIOUS: %.lisp
96%.$(LISPOBJEXT): $(srcdir)/%.lisp
97	$(COMPILE_LISP)
98
99mostlyclean-local:
100	rm -f *.fn *.data *.lib *.$(LISPOBJEXT)
101
102clean-local: mostlyclean-local
103	rm -f *.clisp \
104	  makedep.lisp makedep2.lisp makedep2.lst makeint.lisp \
105	  exposed.lsp database.date
106
107distclean-local: clean-local
108
109${SAVESYS} ${FRICASSYS}: makeint.lisp \
110    ${ALL_OBJS} util.$(LISPOBJEXT) \
111    database.date ${LOADSYS} \
112    $(fricas_targetdir)/algebra/exposed.$(FASLEXT) \
113    $(fricas_src_datadir)/doc/msgs/s2-us.msgs
114
115makeint.lisp: ../boot/lobj_lst
116	@ echo 5 invoking make in `pwd` with parms:
117	@ echo SRC= $(fricas_src_srcdir)
118	@ echo BYE=${BYE}
119	cp $(fricas_src_datadir)/doc/msgs/s2-us.msgs \
120		 $(fricas_target_datadir)/msgs/s2-us.msgs
121	@ echo '${PROCLAIMS}' > makeint.lisp
122	echo '(load #-:ecl "util" #+:ecl "$(srcdir)/util.lisp")' >> makeint.lisp
123	@ echo '(in-package "BOOT")' >> makeint.lisp
124	@ echo '(progn (setq boot::|$$build_date|    "${BUILD_DATE}")' \
125	       '       (setq boot::|$$build_version| "${VERSION}"))' \
126	     >> makeint.lisp
127	echo '#+:ecl(setf fricas-lisp::*fricas-initial-lisp-objects*' \
128             '(append fricas-lisp::*fricas-initial-lisp-objects*' \
129             ' (quote (' >> makeint.lisp
130	cat ../boot/lobj_lst >> makeint.lisp
131	echo '))))' >> makeint.lisp
132	echo '(build-interpsys' \
133	  '(quote ($(patsubst %, "%", ${ALL_OBJS})))' \
134	  '"${FRICAS}")' >> makeint.lisp
135	@ echo '(in-package "BOOT")' >> makeint.lisp
136	echo '#-:ecl(|clearClams|)' >> makeint.lisp
137	@ echo '#+:GCL (setq compiler::*suppress-compiler-notes* t)' >> makeint.lisp
138	@ echo '#+:GCL (si::gbc-time 0)' >> makeint.lisp
139
140${SAVESYS}:
141	echo '(load "makeint.lisp") #-:ecl(BOOT::reclaim)' \
142             '#+:ecl(FRICAS-LISP::make-program "$(BASE)$@" nil)' \
143             '#-:ecl(BOOT::spad-save "$(BASE)$@" t)' | \
144           DAASE='$(fricas_src_datadir)' ${BOOTSYS}
145	ls $@
146	@ echo 6 ${SAVESYS} created
147
148.PHONY: all-fricassys
149
150all-fricassys: ${FRICASSYS}
151
152${FRICASSYS}: ../etc/stamp-databases
153	echo '(defparameter FRICAS-LISP::*building-fricassys* t)' \
154	   '(load "makeint.lisp") #-:ecl(BOOT::reclaim)' \
155	   '#+:cmu (setf (ext:search-list "libspad:")' \
156	   '(list "${FRICAS}/lib/" "${libdir}/fricas/target/${target}/lib/"))' \
157	   '#+:cmu (setq ext:*top-level-auto-declare* t)' \
158	   '#+:cmu (setq *compile-verbose* nil)' \
159	   '#+:cmu (setq *compile-print* nil)' \
160	   '#+:cmu (declaim (optimize (ext:inhibit-warnings 3)))' \
161	   '#+:ecl(FRICAS-LISP::make-program "$(BASE)$@" nil)' \
162	   '#-:ecl(BOOT::spad-save "$(BASE)$@" t)' \
163             | DAASE="$(BASE)$(fricas_targetdir)" ${BOOTSYS}
164	@ echo 6a ${FRICASSYS} created
165
166exposed.lsp: $(fricas_src_algdir)/exposed.lsp
167	@ echo 615 making $@ from $<
168	cp $< $@
169
170$(fricas_targetdir)/algebra/exposed.$(FASLEXT) : exposed.lsp
171	@ echo 616 making $@ from exposed.lsp
172	echo '(progn  (compile-file "exposed.lsp" :output-file' \
173	      ' "$(BASE)$(fricas_targetdir)/algebra/exposed.$(FASLEXT)") (${BYE}))' \
174		| ${LOADSYS}
175
176database.date:
177	@ echo 617 the database was updated...remaking interpsys
178	touch database.date
179
180clammed.clisp: $(srcdir)/clammed.boot
181	echo '(progn (boottran::bootclam "$<" "$@") (${BYE}))' | ${BOOTSYS}
182