1## Lisp normally uses ASDF for compiling big projects, an extensible make-like utility.
2## ASDF also allows to build maxima on systems that don't contain autotools.
3## It therefore is natural to use make only for initiating the build process
4## and to use the autotools for setting up all files, but to use the standard lisp
5## tools for the actual build.
6##
7## The ASDF equivalent of a makefile is named maxima.system.
8## For details about its syntax see
9## https://common-lisp.net/project/asdf/asdf/The-defsystem-form.html
10
11include $(top_srcdir)/common.mk
12
13if WIN32
14bin_SCRIPTS = maxima-command.ico maxima.bat set_lang.vbs
15else
16bin_SCRIPTS = maxima rmaxima
17endif
18
19## In instsrcdir, we install the lisp source files in src/ (including
20## the numerical subdirectories).
21## TODO: Should we also be installing the .system and .asd files here?
22real_lisp_sources := $(shell echo *.lisp $(srcdir)/numerical/*.lisp $(srcdir)/numerical/slatec/*.lisp)
23nobase_dist_instsrc_DATA = $(real_lisp_sources)
24EXTRA_DIST = \
25  maxima.asd maxima.system \
26  numerical/slatec/fortran \
27  maxima-build.lisp maxima-command.ico set_lang.vbs \
28  lisp \
29  share-subdirs.lisp
30
31## If we can, we use Automake's blah_SCRIPTS targets to install
32## stuff. When doing this, we have to populate EXTRA_SCRIPTS, so we
33## use += and initialise here.
34EXTRA_SCRIPTS =
35
36## A debugging tool. If you're trying to understand the value of the
37## variable $(foo) when make runs, call "make echo_foo" and it will be
38## printed.
39echo_%:
40	@echo "$(subst echo_,,$@)=$($(subst echo_,,$@))"
41	@echo "origin $(subst echo_,,$@) returns $(origin $(subst echo_,,$@))"
42
43## "all" depends on sharefiles.mk and whatever files we choose to
44## build. These are listed in BUILT_FILES, which is populated in the
45## implementation-dependent sections below.
46##
47## The special treatment of share-subdirs.lisp is necessary due to the
48## following requirements:
49##  - We want to autogenerate this file so it changes if source files are
50##    added or deleted.
51##  - We want to ship the file with maxima.
52##  - And we don't want to tell the autotools that we autogenerate this
53##    file. Else "make distclean" would delete the file causing
54##    "make distcleancheck" to fail.
55BUILT_FILES =
56all-local: $(BUILT_FILES) share-subdirs_autogenerated.lisp
57	if test share-subdirs_autogenerated.lisp -nt share-subdirs.lisp; then cp share-subdirs_autogenerated.lisp share-subdirs.lisp; fi
58DISTCLEAN_FILES=$(DISTCLEAN_EXTRA_SRC_FILES)
59
60## The "clean" rule always just deletes some files and they are
61## specified in the conditional sections by adding
62## implementation-specific targets to the list CLEAN_TARGETS.
63CLEAN_TARGETS =
64clean-local: $(CLEAN_TARGETS)
65
66## Tell make clean to delete all the <foo>-depends.mk files.
67DEPENDS_FILES = \
68  clisp-depends.mk cmucl-depends.mk scl-depends.mk acl-depends.mk \
69  sbcl-depends.mk gcl-depends.mk openmcl-depends.mk ecl-depends.mk abcl-depends.mk
70CLEANFILES = $(DEPENDS_FILES) tools/sys-proclaim.lisp
71
72## Similarly, we do something hacky with the install rule. Most of the
73## time, we can actually use Automake's tools for this, but for the
74## crazy "install another copy of the implementation" approach that we
75## use with SCL and CLISP, we need to do it by hand.
76WEIRD_INSTALL_TARGETS =
77WEIRD_UNINSTALL_TARGETS =
78install-exec-local: $(WEIRD_INSTALL_TARGETS)
79uninstall-hook: $(WEIRD_UNINSTALL_TARGETS)
80
81## A rule to build binary directories of the form binary-<lispname>
82## and subdirectories ./numerical and ./numerical/slatec
83binary_subdirs = / /numerical /numerical/slatec
84lisps_enabled = @lisps_enabled@
85.PHONY: bd
86bd:
87	for l in $(lisps_enabled); do for d in $(binary_subdirs); do $(MKDIR_P) binary-$$l$$d; done; done
88
89## Some hunks of lisp that get used by more than one implementation
90LOADDEFSYSTEM = (load "$(top_srcdir)/lisp-utils/defsystem.lisp") (mk:add-registry-location "$(top_srcdir)/src/")
91LOADMAKEDEPENDS = (load "$(top_srcdir)/lisp-utils/make-depends.lisp")
92DS_OOS = funcall (intern (symbol-name :operate-on-system) :mk) "maxima"
93if QUIET_BUILD
94QUIET="(setf *compile-print* nil) (setq *compile-verbose* nil)"
95DEFSYSTEMCOMPILE = ($(DS_OOS) :compile :verbose nil)
96DEFSYSTEMLOAD = ($(DS_OOS) :load :verbose nil )
97else
98DEFSYSTEMCOMPILE = ($(DS_OOS) :compile :verbose t)
99DEFSYSTEMLOAD = ($(DS_OOS) :load :verbose t)
100endif
101DEFSYSTEMTESTLOAD = ($(DS_OOS) :load :verbose t :test t)
102
103## A function that takes: $(1) = the target name or names (either a
104## string or a list of strings); $(2) = <foo>-depends.mk; $(3) = any
105## postscript that should be added. It outputs lisp code
106## that, when run, should create the dependency Makefile fragments.
107MAKE_DEPENDS = '$(LOADDEFSYSTEM) $(LOADMAKEDEPENDS) (funcall (intern "CREATE-DEPENDENCY-FILE" :mk) $(1) "$(2)") $(3)'
108
109## CLISP #######################################################################
110if CLISP
111
112EXTRA_SCRIPTS += $(CLISP_MAXIMA)
113
114if CLISP_EXEC
115CLISP_MAXIMA = binary-clisp/maxima$(EXEEXT)
116clisplib_SCRIPTS = $(CLISP_MAXIMA)
117clispexeflag = :EXECUTABLE t
118else
119CLISP_MAXIMA = binary-clisp/maxima.mem
120clisplib_DATA = $(CLISP_MAXIMA)
121clispexeflag =
122## Rather crazily, we install an extra copy of clisp. Maybe there's a
123## more sensible approach than this?!
124WEIRD_INSTALL_TARGETS += install-clisp-copy
125WEIRD_UNINSTALL_TARGETS += uninstall-clisp-copy
126install-clisp-copy:
127	$(mkinstalldirs) $(DESTDIR)$(clisplibdir)
128	$(INSTALL_PROGRAM) @CLISP_RUNTIME_PATH@ "$(DESTDIR)$(clisplibdir)/@CLISP_RUNTIME@"
129uninstall-clisp-copy:
130	rm -f "$(DESTDIR)$(clisplibdir)/@CLISP_RUNTIME@"
131endif
132
133EXECUTECLISP = $(CLISP_NAME) -norc -q
134clisplibdir = $(verpkglibdir)/binary-clisp
135
136BUILT_FILES += $(CLISP_MAXIMA)
137
138clisp: $(CLISP_MAXIMA)
139
140$(CLISP_MAXIMA):
141	$(MAKE) bd
142	echo '$(QUIET) $(LOADDEFSYSTEM) $(DEFSYSTEMCOMPILE)' > clisp-command.lisp
143	$(EXECUTECLISP) clisp-command.lisp
144	echo '$(LOADDEFSYSTEM) $(DEFSYSTEMLOAD) (ext:saveinitmem "$@" :init-function (function cl-user::run) $(clispexeflag))' > clisp-command.lisp
145	$(EXECUTECLISP) clisp-command.lisp
146	rm clisp-command.lisp
147
148clisp-depends.mk: maxima.system Makefile *.lisp
149	echo $(call MAKE_DEPENDS,"$(CLISP_MAXIMA)",clisp-depends.mk.tmp) > clisp-command2.lisp
150	$(EXECUTECLISP) clisp-command2.lisp
151	cat clisp-depends.mk.tmp | sed -e "s#\\\\#/#g" > clisp-depends.mk
152
153-include clisp-depends.mk
154endif CLISP
155
156clean-clisp:
157	rm -rf binary-clisp clisp-command.lisp clisp-command2.lisp
158CLEAN_TARGETS += clean-clisp
159
160## CMUCL #######################################################################
161if CMUCL
162
163EXTRA_SCRIPTS += $(CMU_MAXIMA) lisp
164
165if CMUCL_EXEC
166CMU_MAXIMA = binary-cmucl/maxima
167cmucllib_SCRIPTS = $(CMU_MAXIMA)
168cmuflag = :executable t :init-function '\''cl-user::run
169else
170CMU_MAXIMA = binary-cmucl/maxima_core
171cmucllib_SCRIPTS = lisp
172cmucllib_DATA = $(CMU_MAXIMA)
173cmuflag =
174endif
175
176# Newer versions of CMUCL have an INTL package that is compatible with
177# maxima's.  We just bind intl::*default-domain* here so that when we
178# compile the files, we will get appropriate translations.  (Otherwise
179# we have to put (intl:textdomain "maxima") in each Lisp file.
180INITINTL = (when (find-package "INTL") (set (find-symbol "*DEFAULT-DOMAIN*" "INTL") "maxima"))
181CMU_COMPILE = echo '$(QUIET) $(INITINTL) $(LOADDEFSYSTEM) $(DEFSYSTEMCOMPILE)' | $(EXECUTECMUCL)
182CMU_WRITE = echo '$(LOADDEFSYSTEM) $(DEFSYSTEMLOAD) (ext:save-lisp "$(CMU_MAXIMA)" $(cmuflag))' | $(EXECUTECMUCL)
183CMU_BUILD = ($(CMU_COMPILE)) && ($(CMU_WRITE))
184EXECUTECMUCL = $(CMUCL_NAME) -noinit -batch
185
186cmucllibdir = $(verpkglibdir)/binary-cmucl
187BUILT_FILES += $(CMU_MAXIMA)
188
189cmucl: $(CMU_MAXIMA)
190
191$(CMU_MAXIMA):
192	$(MAKE) bd
193	$(CMU_BUILD)
194
195cmucl-depends.mk: maxima.system Makefile *.lisp
196	echo $(call MAKE_DEPENDS,"$(CMU_MAXIMA)",cmucl-depends.mk.tmp) | $(EXECUTECMUCL)
197	cat cmucl-depends.mk.tmp | sed -e "s#\\\\#/#g" > cmucl-depends.mk
198
199-include cmucl-depends.mk
200endif
201
202clean-cmucl:
203	rm -rf binary-cmucl
204CLEAN_TARGETS += clean-cmucl
205
206## SCL #########################################################################
207if SCL
208
209scllibdir = $(verpkglibdir)/binary-scl
210
211EXECUTESCL = $(SCL_NAME) -noinit -batch
212BUILT_FILES += binary-scl/maxima_core
213scllib_DATA = binary-scl/maxima_core
214
215scl: binary-scl/maxima_core
216
217binary-scl/maxima_core:
218	$(MAKE) bd
219	(echo '$(QUIET) $(LOADDEFSYSTEM) $(DEFSYSTEMCOMPILE)' | $(EXECUTESCL)) && \
220	(echo '$(LOADDEFSYSTEM) $(DEFSYSTEMLOAD) (ext:save-lisp "binary-scl/maxima_core")' | $(EXECUTESCL))
221
222## Just like with clisp, we install an extra copy of SCL. No, I don't
223## understand either. Also, I just read the SCL license agreement. Is
224## the user even allowed to do this?!
225WEIRD_INSTALL_TARGETS += install-scl-copy
226WEIRD_UNINSTALL_TARGETS += uninstall-scl-copy
227install-scl-copy:
228	$(mkinstalldirs) $(DESTDIR)$(scllibdir)
229	$(INSTALL_PROGRAM) @SCL_RUNTIME_PATH@ "$(DESTDIR)$(scllibdir)/@SCL_RUNTIME@"
230uninstall-scl-copy:
231	rm -f "$(DESTDIR)$(scllibdir)/@SCL_RUNTIME@"
232
233scl-depends.mk: maxima.system Makefile *.lisp
234	echo $(call MAKE_DEPENDS,"binary-scl/maxima_core",scl-depends.mk.tmp) | $(EXECUTESCL)
235	cat scl-depends.mk.tmp | sed -e "s#\\\\#/#g" > scl-depends.mk
236
237-include scl-depends.mk
238
239endif
240
241clean-scl:
242	rm -rf binary-scl
243CLEAN_TARGETS += clean-scl
244
245## ACL #########################################################################
246if ACL
247
248acllibdir = $(verpkglibdir)/binary-acl
249
250EXECUTEACL = $(ACL_NAME) -batch
251BUILT_FILES += binary-acl/maxima.dxl
252
253acllib_DATA = binary-acl/maxima.dxl
254
255acl: binary-acl/maxima.dxl
256
257binary-acl/maxima.dxl:
258	$(MAKE) bd
259	(echo '$(QUIET) $(LOADDEFSYSTEM) $(DEFSYSTEMCOMPILE)' | $(EXECUTEACL)) && \
260	(echo '$(LOADDEFSYSTEM) $(DEFSYSTEMLOAD) (excl:dumplisp :name "binary-acl/maxima.dxl")' | $(EXECUTEACL))
261
262acl-depends.mk: maxima.system Makefile *.lisp
263	echo $(call MAKE_DEPENDS,"binary-acl/maxima.dxl",acl-depends.mk.tmp) | $(EXECUTEACL)
264	cat acl-depends.mk.tmp | sed -e "s#\\\\#/#g" > acl-depends.mk
265
266-include acl-depends.mk
267endif
268
269clean-acl:
270	rm -rf binary-acl
271CLEAN_TARGETS += clean-acl
272
273## SBCL ########################################################################
274if SBCL
275
276sbcllibdir = $(verpkglibdir)/binary-sbcl
277
278EXTRA_SCRIPTS += $(SBCL_MAXIMA)
279
280if SBCL_EXEC
281SBCL_MAXIMA = binary-sbcl/maxima$(EXEEXT)
282sbcllib_SCRIPTS = $(SBCL_MAXIMA)
283sb_slad = (sb-ext:save-lisp-and-die "$@" :executable t)
284else
285SBCL_MAXIMA = binary-sbcl/maxima_core
286sbcllib_DATA = $(SBCL_MAXIMA)
287sb_slad = (sb-ext:save-lisp-and-die "$@")
288endif
289
290EXECUTESBCL = "$(SBCL_NAME)" --noinform --noprint $(SBCL_EXTRA_ARGS)
291BUILT_FILES += $(SBCL_MAXIMA)
292
293COMPILE_SBCL = echo '$(QUIET) $(LOADDEFSYSTEM) $(DEFSYSTEMCOMPILE) (sb-ext:quit)' | $(EXECUTESBCL)
294WRITE_SBCL = echo '$(LOADDEFSYSTEM) $(DEFSYSTEMLOAD) $(sb_slad) (sb-ext:quit)' | $(EXECUTESBCL)
295BUILD_SBCL = $(COMPILE_SBCL) && $(WRITE_SBCL)
296
297sbcl: $(SBCL_MAXIMA)
298
299$(SBCL_MAXIMA):
300	$(MAKE) bd
301	$(BUILD_SBCL)
302
303sbcl-depends.mk: maxima.system Makefile *.lisp
304	echo $(call MAKE_DEPENDS,"$(SBCL_MAXIMA)",sbcl-depends.mk.tmp,(sb-ext:quit)) | $(EXECUTESBCL)
305	cat sbcl-depends.mk.tmp | sed -e "s#\\\\#/#g" > sbcl-depends.mk
306
307-include sbcl-depends.mk
308
309endif
310
311clean-sbcl:
312	rm -rf binary-sbcl numerical/binary-sbcl numerical/slatec/binary-sbcl
313CLEAN_TARGETS += clean-sbcl
314
315## GCL #########################################################################
316#
317# For gcl we execute all commands from a temp file for the following motive:
318#
319# Some versions of GCL 2.6.12 don't automatically close at the end of a lisp
320# file that contains the commands needed for compiling maxima and crash if
321# they reach a (quit). In newer versions of 2.6.12 sending the (quit) from the
322# command-line causes a crash.
323# GCL's --eval switch adds an implicit (progn) that breaks defsystem's
324# (mk:add-registry-location).
325# And when executing commands from stdin some GCL versions get the
326# end-of-file from the end of the command list too early and therefore close
327# before the last command has been processed.
328# Providing all commands from the command-line and ending them with a
329# (quit) so it doesn't matter if lisp automatically closes at the last
330# or the second last command seems to work, though.
331
332if GCL
333
334gcllibdir = $(verpkglibdir)/binary-gcl
335
336EXTRA_SCRIPTS += binary-gcl/maxima
337gcllib_SCRIPTS = binary-gcl/maxima
338
339EXECUTEGCL = $(GCL_NAME)
340BUILT_FILES += binary-gcl/maxima
341
342sys_proc_dependency = tools/sys-proclaim.lisp
343gcl_depends_targets = (list "binary-gcl/maxima" "tools/sys-proclaim.lisp")
344
345tools/sys-proclaim.lisp: maxima.system *.lisp
346	rm -rf binary-gcl
347	touch sys-proclaim.lisp
348	$(MAKE) bd
349	echo '(load "generate-sys-proclaim.lisp") (system::quit)' | $(EXECUTEGCL)
350	rm -rf binary-gcl
351	mkdir -p tools
352	mv sys-proclaim.lisp tools
353
354gcl: binary-gcl/maxima
355
356binary-gcl/maxima: $(sys_proc_dependency) gcl-depends.mk
357	$(MAKE) bd
358if GCL_ALT_LINK
359	echo '$(QUIET) $(LOADDEFSYSTEM) $(DEFSYSTEMCOMPILE) (system::quit)' | $(EXECUTEGCL)
360	echo '(let ((com (quote (progn (defvar compiler::*gazonk-prefix* "gazonk") (defun compiler::gazonk-name (&aux tem)(dotimes (i 1000) (unless (probe-file (setq tem (merge-pathnames (format nil "~d~d.lsp" compiler::*gazonk-prefix* i))))(return-from compiler::gazonk-name (pathname tem))))(error "1000 gazonk names used already!"))(let ((compiler::*gazonk-prefix* "maxima_gazonk")(compiler::*keep-gaz* t))$(LOADDEFSYSTEM)$(DEFSYSTEMLOAD))))))(let ((si::*collect-binary-modules* t))(eval com)(let ((compiler::*default-system-p* t))(dolist (l (directory "maxima_gazonk*.lsp")) (compile-file l) (delete-file l)))(compiler::link si::*binary-modules* "binary-gcl/maxima" (format nil "~S" com) "" nil)(dolist (l (directory "maxima_gazonk*.lsp")) (delete-file l)))) (system::quit)' | $(EXECUTEGCL)
361else
362	echo '$(LOADDEFSYSTEM) $(DEFSYSTEMCOMPILE) (system::quit)' | $(EXECUTEGCL)
363	echo '$(LOADDEFSYSTEM) $(DEFSYSTEMLOAD) (when (fboundp (quote si::sgc-on))(si::sgc-on t)) (si:save-system "binary-gcl/maxima") (system::quit)'  | $(EXECUTEGCL)
364endif
365
366gcl-depends.mk: maxima.system Makefile *.lisp
367	echo $(call MAKE_DEPENDS,$(gcl_depends_targets),gcl-depends.mk.tmp) '(system::quit)' | $(EXECUTEGCL)
368	cat gcl-depends.mk.tmp | sed -e "s#\\\\#/#g" > gcl-depends.mk
369-include gcl-depends.mk
370
371endif
372
373clean-gcl:
374	rm -rf binary-gcl
375CLEAN_TARGETS += clean-gcl
376
377## OPENMCL / CCL ###############################################################
378if OPENMCL
379
380openmcllibdir = $(verpkglibdir)/binary-openmcl
381EXTRA_SCRIPTS += $(OPENMCL_MAXIMA)
382
383if OPENMCL_EXEC
384OPENMCL_MAXIMA = binary-openmcl/maxima$(EXEEXT)
385openmcllib_SCRIPTS = $(OPENMCL_MAXIMA)
386omcl_flag = :prepend-kernel t
387else
388OPENMCL_MAXIMA = binary-openmcl/maxima.image
389openmcllib_DATA = $(OPENMCL_MAXIMA)
390omcl_flag =
391endif
392
393EXECUTEOPENMCL = $(OPENMCL_NAME)
394BUILT_FILES += $(OPENMCL_MAXIMA)
395
396COMPILE_OMCL = echo '$(QUIET) (require :defsystem) (mk:add-registry-location "$(top_srcdir)/src/") $(DEFSYSTEMCOMPILE) (ccl::quit)' | $(EXECUTEOPENMCL)
397WRITE_OMCL = echo '(require :defsystem) (mk:add-registry-location "$(top_srcdir)/src/") $(DEFSYSTEMLOAD) (ccl:save-application "$@") (ccl::quit)' | $(EXECUTEOPENMCL)
398BUILD_OMCL = $(COMPILE_OMCL) && $(WRITE_OMCL)
399
400openmcl: $(OPENMCL_MAXIMA)
401
402$(OPENMCL_MAXIMA):
403	$(BUILD_OMCL)
404	echo '(require :defsystem)  $(DEFSYSTEMCOMPILE) (ccl::quit)' | $(EXECUTEOPENMCL) \
405	   && \
406	echo '(require :defsystem) $(DEFSYSTEMLOAD) (ccl:save-application "$@" $(omcl_flag)) (ccl::quit)' | $(EXECUTEOPENMCL)
407
408openmcl-depends.mk: maxima.system Makefile *.lisp
409	echo $(call MAKE_DEPENDS,"$(OPENMCL_MAXIMA)",openmcl-depends.mk.tmp,(ccl:quit)) | $(EXECUTEOPENMCL)
410	cat openmcl-depends.mk.tmp | sed -e "s#\\\\#/#g" > openmcl-depends.mk
411
412-include openmcl-depends.mk
413
414endif
415
416clean-openmcl:
417	rm -rf binary-openmcl
418CLEAN_TARGETS += clean-openmcl
419
420## CCL64 #######################################################################
421
422if CCL64
423
424ccl64libdir = $(verpkglibdir)/binary-ccl64
425EXTRA_SCRIPTS += $(OPENMCL_MAXIMA)
426
427if CCL64_EXEC
428CCL64_MAXIMA = binary-ccl64/maxima$(EXEEXT)
429ccl64lib_SCRIPTS = $(CCL64_MAXIMA)
430omcl_flag = :prepend-kernel t
431else
432CCL64_MAXIMA = binary-ccl64/maxima.image
433ccl64lib_DATA = $(CCL64_MAXIMA)
434omcl_flag =
435endif
436
437EXECUTECCL64 = $(CCL64_NAME)
438BUILT_FILES += $(CCL64_MAXIMA)
439
440COMPILE_CCL64 = echo '$(QUIET) (require :defsystem) (mk:add-registry-location "$(top_srcdir)/src/") $(DEFSYSTEMCOMPILE) (ccl::quit)' | $(EXECUTECCL64)
441WRITE_CCL64 = echo '(require :defsystem) (mk:add-registry-location "$(top_srcdir)/src/") $(DEFSYSTEMLOAD) (ccl:save-application "$@") (ccl::quit)' | $(EXECUTECCL64)
442BUILD_CCL64 = $(COMPILE_CCL64) && $(WRITE_CCL64)
443
444ccl64: $(CCL64_MAXIMA)
445
446$(CCL64_MAXIMA):
447	$(BUILD_CCL64)
448	echo '(require :defsystem)  $(DEFSYSTEMCOMPILE) (ccl::quit)' | $(EXECUTECCL64) \
449	   && \
450	echo '(require :defsystem) $(DEFSYSTEMLOAD) (ccl:save-application "$@" $(omcl_flag)) (ccl::quit)' | $(EXECUTECCL64)
451
452ccl64-depends.mk: maxima.system Makefile *.lisp
453	echo $(call MAKE_DEPENDS,"$(CCL64_MAXIMA)",ccl64-depends.mk.tmp,(ccl:quit)) | $(EXECUTECCL64)
454	cat ccl64-depends.mk.tmp | sed -e "s#\\\\#/#g" > ccl64-depends.mk
455
456-include ccl64-depends.mk
457
458
459endif
460
461clean-ccl64:
462	rm -rf binary-ccl64
463CLEAN_TARGETS += clean-ccl64
464
465## ECL #########################################################################
466if ECL
467
468ecllibdir = $(verpkglibdir)/binary-ecl
469EXTRA_SCRIPTS += binary-ecl/maxima
470ecllib_SCRIPTS = binary-ecl/maxima
471
472EXECUTEECL = $(ECL_NAME) -norc
473BUILT_FILES += binary-ecl/maxima
474
475ecl:binary-ecl/maxima
476
477binary-ecl/maxima:
478	$(MAKE) bd
479	echo '$(QUIET) $(LOADDEFSYSTEM) $(DEFSYSTEMCOMPILE) (build-maxima-lib) (ext:quit)' | $(EXECUTEECL)
480
481ecl-depends.mk: maxima.system Makefile *.lisp
482	echo $(call MAKE_DEPENDS,"binary-ecl/maxima",ecl-depends.mk.tmp,(quit)) | $(EXECUTEECL)
483	cat ecl-depends.mk.tmp | sed -e "s#\\\\#/#g" > ecl-depends.mk
484
485-include ecl-depends.mk
486endif
487
488clean-ecl:
489	rm -rf binary-ecl libmaxima.a
490CLEAN_TARGETS += clean-ecl
491
492## ABCL ########################################################################
493if ABCL
494
495# ABCL compiles the individual files maxima is comprised of. But they aren't
496# compiled into a single .jar archive, but need to be loaded by abcl in the
497# right order => We need to copy all the stuff defsystem needs into the binary
498# folder and need to use defsystem for loading all the files in the Right Order.
499
500abcllibdir = $(verpkglibdir)/binary-abcl
501EXTRA_SCRIPTS += binary-abcl/maxima
502abcllib_SCRIPTS = binary-abcl/maxima
503
504EXECUTEABCL = $(JRE) -jar $(ABCL_JAR) --noinit
505BUILT_FILES += binary-abcl/maxima
506
507WEIRD_INSTALL_TARGETS += install-abcl-folder
508WEIRD_UNINSTALL_TARGETS += uninstall-abcl-folder
509
510install-abcl-folder:
511	$(mkinstalldirs) $(DESTDIR)$(abcllibdir)
512	cp -r binary-abcl/* "$(DESTDIR)$(abcllibdir)"
513	chmod +x $(DESTDIR)$(abcllibdir)/maxima
514uninstall-abcl-folder:
515	if test x"$(abcllibdir)" = x"" ; then echo "Error: No known maxima version"; exit -1; else rm -f "$(DESTDIR)$(abcllibdir)/*"; fi
516
517abcl:binary-abcl/maxima
518
519
520binary-abcl/maxima: Makefile.am startmaxima_abcl.sh
521	$(MAKE) bd
522if QUIET_BUILD
523	$(EXECUTEABCL) --eval '(setq *compile-verbose* nil)' --eval '(setf *compile-print* nil)' --eval '(load "$(top_srcdir)/lisp-utils/defsystem.lisp")' --eval '(mk:add-registry-location "$(top_srcdir)/src/")' --eval '($(DS_OOS) :compile :verbose nil)' --eval '(quit)'
524else
525	$(EXECUTEABCL) --eval '(load "$(top_srcdir)/lisp-utils/defsystem.lisp")' --eval '(mk:add-registry-location "$(top_srcdir)/src/")' --eval '($(DS_OOS) :compile :verbose t)' --eval '(quit)'
526endif
527	cat $(srcdir)/maxima.system | sed -e 's#"binary-abcl"#(ext:getenv "MAXIMA_IMAGESDIR_BIN")#g' > binary-abcl/maxima.system
528	cp $(srcdir)/maxima-package.lisp binary-abcl
529	cp $(srcdir)/autol.lisp binary-abcl
530	cp $(srcdir)/init-cl.lisp binary-abcl
531	cp $(srcdir)/max_ext.lisp binary-abcl
532	cp share-subdirs.lisp binary-abcl
533	cp autoconf-variables.lisp binary-abcl
534	cp $(ABCL_JAR) binary-abcl/abcl.jar
535	cp $(srcdir)/../lisp-utils/defsystem.lisp binary-abcl
536	cp -a startmaxima_abcl.sh binary-abcl/maxima
537	touch binary-abcl/maxima
538	chmod +x binary-abcl/maxima
539
540abcl-depends.mk: maxima.system Makefile *.lisp
541	echo $(call MAKE_DEPENDS,"binary-abcl/maxima",abcl-depends.mk.tmp,(quit)) | $(EXECUTEABCL)
542	cat abcl-depends.mk.tmp | sed -e "s#\\\\#/#g" > abcl-depends.mk
543
544-include abcl-depends.mk
545endif
546
547clean-abcl:
548	rm -rf binary-abcl libmaxima.a
549CLEAN_TARGETS += clean-abcl
550