Eliminate spurious redefinition of derivabbrev in Ctensor, fix documentation of diagm...
[maxima/cygwin.git] / src / Makefile.am
bloba7b1fa2d6643b7e23fb8e31613d5cdb3e91a80f7
1 include $(top_srcdir)/common.mk
3 if WIN32
4 bin_SCRIPTS = maxima maxima-command.ico maxima.bat set_lang.vbs
5 else
6 bin_SCRIPTS = maxima rmaxima
7 endif
9 ## In instsrcdir, we install the lisp source files in src/ (including
10 ## the numerical subdirectories).
11 ## TODO: Should we also be installing the .system and .asd files here?
12 real_lisp_sources := $(shell echo *.lisp numerical/*.lisp numerical/slatec/*.lisp)
13 nobase_dist_instsrc_DATA = $(real_lisp_sources)
14 EXTRA_DIST = \
15   maxima.asd maxima.system \
16   numerical/slatec/fortran \
17   maxima-build.lisp maxima-command.ico set_lang.vbs \
18   lisp \
19   share-subdirs.lisp \
20   sharefiles.mk
22 ## If we can, we use Automake's blah_SCRIPTS targets to install
23 ## stuff. When doing this, we have to populate EXTRA_SCRIPTS, so we
24 ## use += and initialise here.
25 EXTRA_SCRIPTS =
27 ## A debugging tool. If you're trying to understand the value of the
28 ## variable $(foo) when make runs, call "make echo_foo" and it will be
29 ## printed.
30 echo_%:
31         @echo "$(subst echo_,,$@)=$($(subst echo_,,$@))"
32         @echo "origin $(subst echo_,,$@) returns $(origin $(subst echo_,,$@))"
34 ## Create the list of files that will be installed from share. The
35 ## make_share_list script outputs to a temporary file and only
36 ## overwrites sharefiles.mk if there is a change. As such,
37 ## share/Makefile is only updated (and share rebuilt) when something
38 ## changes.
40 ## TODO: Why is this in src/ not in share/ ?
41 .PHONY: sharefiles.mk
42 sharefiles.mk:
43         ../admin/make_share_list
45 ## "all" depends on sharefiles.mk and whatever files we choose to
46 ## build. These are listed in BUILT_FILES, which is populated in the
47 ## implementation-dependent sections below.
48 BUILT_FILES =
49 all-local: sharefiles.mk $(BUILT_FILES)
51 ## The "clean" rule always just deletes some files and they are
52 ## specified in the conditional sections by adding
53 ## implementation-specific targets to the list CLEAN_TARGETS.
54 CLEAN_TARGETS =
55 clean-local: $(CLEAN_TARGETS)
57 ## Tell make clean to delete all the <foo>-depends.mk files.
58 DEPENDS_FILES = \
59   clisp-depends.mk cmucl-depends.mk scl-depends.mk acl-depends.mk \
60   sbcl-depends.mk gcl-depends.mk openmcl-depends.mk ecl-depends.mk
61 CLEANFILES = $(DEPENDS_FILES) sys-proclaim.lisp
63 ## Similarly, we do something hacky with the install rule. Most of the
64 ## time, we can actually use Automake's tools for this, but for the
65 ## crazy "install another copy of the implementation" approach that we
66 ## use with SCL and CLISP, we need to do it by hand.
67 WEIRD_INSTALL_TARGETS =
68 WEIRD_UNINSTALL_TARGETS =
69 install-exec-local: $(WEIRD_INSTALL_TARGETS)
70 uninstall-hook: $(WEIRD_UNINSTALL_TARGETS)
72 ## A rule to build binary directories of the form binary-<lispname>
73 ## and subdirectories ./numerical and ./numerical/slatec
74 binary_subdirs = / /numerical /numerical/slatec
75 lisps_enabled = @lisps_enabled@
76 .PHONY: bd
77 bd:
78         for l in $(lisps_enabled); do for d in $(binary_subdirs); do $(MKDIR_P) binary-$$l$$d; done; done
80 ## Some hunks of lisp that get used by more than one implementation
81 LOADDEFSYSTEM = (load "$(top_srcdir)/lisp-utils/defsystem.lisp")
82 LOADMAKEDEPENDS = (load "$(top_srcdir)/lisp-utils/make-depends.lisp")
83 DS_OOS = funcall (intern (symbol-name :operate-on-system) :mk) "maxima"
84 DEFSYSTEMCOMPILE = ($(DS_OOS) :compile :verbose t)
85 DEFSYSTEMLOAD = ($(DS_OOS) :load :verbose t)
86 DEFSYSTEMTESTLOAD = ($(DS_OOS) :load :verbose t :test t)
88 ## A function that takes: $(1) = the target name or names (either a
89 ## string or a list of strings); $(2) = <foo>-depends.mk; $(3) = any
90 ## postscript that should be added in the progn. It outputs lisp code
91 ## that, when run, should create the dependency Makefile fragments.
92 MAKE_DEPENDS = '(progn $(LOADDEFSYSTEM) $(LOADMAKEDEPENDS) (funcall (intern "CREATE-DEPENDENCY-FILE" :mk) $(1) "$(2)") $(3))'
94 ## CLISP #######################################################################
95 if CLISP
97 EXTRA_SCRIPTS += $(CLISP_MAXIMA)
99 if CLISP_EXEC
100 CLISP_MAXIMA = binary-clisp/maxima$(EXEEXT)
101 clisplib_SCRIPTS = $(CLISP_MAXIMA)
102 clispexeflag = :EXECUTABLE t
103 else
104 CLISP_MAXIMA = binary-clisp/maxima.mem
105 clisplib_DATA = $(CLISP_MAXIMA)
106 clispexeflag =
107 ## Rather crazily, we install an extra copy of clisp. Maybe there's a
108 ## more sensible approach than this?!
109 WEIRD_INSTALL_TARGETS += install-clisp-copy
110 WEIRD_UNINSTALL_TARGETS += uninstall-clisp-copy
111 install-clisp-copy:
112         $(mkinstalldirs) $(DESTDIR)$(clisplibdir)
113         $(INSTALL_PROGRAM) @CLISP_RUNTIME_PATH@ "$(DESTDIR)$(clisplibdir)/@CLISP_RUNTIME@"
114 uninstall-clisp-copy:
115         rm -f "$(DESTDIR)$(clisplibdir)/@CLISP_RUNTIME@"
116 endif
118 EXECUTECLISP = $(CLISP_NAME) -norc -q -x
119 clisplibdir = $(verpkglibdir)/binary-clisp
121 BUILT_FILES += $(CLISP_MAXIMA)
122 CLEAN_TARGETS += clean-clisp
124 clisp: $(CLISP_MAXIMA)
126 $(CLISP_MAXIMA):
127         $(MAKE) bd
128         $(EXECUTECLISP) '(progn $(LOADDEFSYSTEM) $(DEFSYSTEMCOMPILE))' && \
129         $(EXECUTECLISP) '(progn $(LOADDEFSYSTEM) $(DEFSYSTEMLOAD) (ext:saveinitmem "$@" :init-function (function cl-user::run) $(clispexeflag)))'
131 clean-clisp:
132         rm -rf binary-clisp
134 clisp-depends.mk: maxima.system
135         $(EXECUTECLISP) $(call MAKE_DEPENDS,"$(CLISP_MAXIMA)",clisp-depends.mk)
137 -include clisp-depends.mk
138 endif CLISP
140 ## CMUCL #######################################################################
141 if CMUCL
143 EXTRA_SCRIPTS += $(CMU_MAXIMA) lisp
145 if CMUCL_EXEC
146 CMU_MAXIMA = binary-cmucl/maxima
147 cmucllib_SCRIPTS = $(CMU_MAXIMA)
148 cmuflag = :executable t :init-function '\''cl-user::run
149 else
150 CMU_MAXIMA = binary-cmucl/maxima.core
151 cmucllib_SCRIPTS = lisp
152 cmucllib_DATA = $(CMU_MAXIMA)
153 cmuflag =
154 endif
156 # Newer versions of CMUCL have an INTL package that is compatible with
157 # maxima's.  We just bind intl::*default-domain* here so that when we
158 # compile the files, we will get appropriate translations.  (Otherwise
159 # we have to put (intl:textdomain "maxima") in each Lisp file.
160 INITINTL = (when (find-package "INTL") (set (find-symbol "*DEFAULT-DOMAIN*" "INTL") "maxima"))
161 CMU_COMPILE = echo '(progn $(INITINTL) $(LOADDEFSYSTEM) $(DEFSYSTEMCOMPILE))' | $(EXECUTECMUCL)
162 CMU_WRITE = echo '(progn $(LOADDEFSYSTEM) $(DEFSYSTEMLOAD) (ext:save-lisp "$(CMU_MAXIMA)" $(cmuflag)))' | $(EXECUTECMUCL)
163 CMU_BUILD = ($(CMU_COMPILE)) && ($(CMU_WRITE))
164 EXECUTECMUCL = $(CMUCL_NAME) -noinit -batch
166 cmucllibdir = $(verpkglibdir)/binary-cmucl
167 BUILT_FILES += $(CMU_MAXIMA)
168 CLEAN_TARGETS += clean-cmucl
170 cmucl: $(CMU_MAXIMA)
172 $(CMU_MAXIMA):
173         $(MAKE) bd
174         $(CMU_BUILD)
176 clean-cmucl:
177         rm -rf binary-cmucl
179 cmucl-depends.mk: maxima.system
180         echo $(call MAKE_DEPENDS,"$(CMU_MAXIMA)",cmucl-depends.mk) | $(EXECUTECMUCL)
182 -include cmucl-depends.mk
183 endif
185 ## SCL #########################################################################
186 if SCL
188 scllibdir = $(verpkglibdir)/binary-scl
190 EXECUTESCL = $(SCL_NAME) -noinit -batch
191 BUILT_FILES += binary-scl/maxima.core
192 CLEAN_TARGETS += clean-scl
193 scllib_DATA = binary-scl/maxima.core
195 scl: binary-scl/maxima.core
197 binary-scl/maxima.core:
198         $(MAKE) bd
199         (echo '(progn $(LOADDEFSYSTEM) $(DEFSYSTEMCOMPILE))' | $(EXECUTESCL)) && \
200         (echo '(progn $(LOADDEFSYSTEM) $(DEFSYSTEMLOAD) (ext:save-lisp "binary-scl/maxima.core"))' | $(EXECUTESCL))
202 ## Just like with clisp, we install an extra copy of SCL. No, I don't
203 ## understand either. Also, I just read the SCL license agreement. Is
204 ## the user even allowed to do this?!
205 WEIRD_INSTALL_TARGETS += install-scl-copy
206 WEIRD_UNINSTALL_TARGETS += uninstall-scl-copy
207 install-scl-copy:
208         $(mkinstalldirs) $(DESTDIR)$(scllibdir)
209         $(INSTALL_PROGRAM) @SCL_RUNTIME_PATH@ "$(DESTDIR)$(scllibdir)/@SCL_RUNTIME@"
210 uninstall-scl-copy:
211         rm -f "$(DESTDIR)$(scllibdir)/@SCL_RUNTIME@"
213 clean-scl:
214         rm -rf binary-scl
216 scl-depends.mk: maxima.system
217         echo $(call MAKE_DEPENDS,"binary-scl/maxima.core",scl-depends.mk) | $(EXECUTESCL)
219 -include scl-depends.mk
221 endif
223 ## ACL #########################################################################
224 if ACL
226 acllibdir = $(verpkglibdir)/binary-acl
228 EXECUTEACL = $(ACL_NAME) -batch
229 BUILT_FILES += binary-acl/maxima.dxl
230 CLEAN_TARGETS += clean-acl
232 acllib_DATA = binary-acl/maxima.dxl
234 acl: binary-acl/maxima.dxl
236 binary-acl/maxima.dxl:
237         $(MAKE) bd
238         (echo '(progn $(LOADDEFSYSTEM) $(DEFSYSTEMCOMPILE))' | $(EXECUTEACL)) && \
239         (echo '(progn $(LOADDEFSYSTEM) $(DEFSYSTEMLOAD) (excl:dumplisp :name "binary-acl/maxima.dxl"))' | $(EXECUTEACL))
241 clean-acl:
242         rm -rf binary-acl
244 acl-depends.mk: maxima.system
245         echo $(call MAKE_DEPENDS,"binary-acl/maxima.dxl",acl-depends.mk) | $(EXECUTEACL)
247 -include acl-depends.mk
248 endif
250 ## SBCL ########################################################################
251 if SBCL
253 sbcllibdir = $(verpkglibdir)/binary-sbcl
255 EXTRA_SCRIPTS += $(SBCL_MAXIMA)
257 if SBCL_EXEC
258 SBCL_MAXIMA = binary-sbcl/maxima$(EXEEXT)
259 sbcllib_SCRIPTS = $(SBCL_MAXIMA)
260 sb_slad = (sb-ext:save-lisp-and-die "$@" :executable t)
261 else
262 SBCL_MAXIMA = binary-sbcl/maxima.core
263 sbcllib_DATA = $(SBCL_MAXIMA)
264 sb_slad = (sb-ext:save-lisp-and-die "$@")
265 endif
267 EXECUTESBCL = "$(SBCL_NAME)" --noinform --noprint --eval
268 BUILT_FILES += $(SBCL_MAXIMA)
269 CLEAN_TARGETS += clean-sbcl
271 COMPILE_SBCL = $(EXECUTESBCL) '(progn $(LOADDEFSYSTEM) $(DEFSYSTEMCOMPILE) (sb-ext:quit))'
272 WRITE_SBCL = $(EXECUTESBCL) '(progn $(LOADDEFSYSTEM) $(DEFSYSTEMLOAD) $(sb_slad) (sb-ext:quit))'
273 BUILD_SBCL = $(COMPILE_SBCL) && $(WRITE_SBCL)
275 sbcl: $(SBCL_MAXIMA)
277 $(SBCL_MAXIMA):
278         $(MAKE) bd
279         $(BUILD_SBCL)
281 clean-sbcl:
282         rm -rf binary-sbcl numerical/binary-sbcl numerical/slatec/binary-sbcl
284 sbcl-depends.mk: maxima.system
285         $(EXECUTESBCL) $(call MAKE_DEPENDS,"$(SBCL_MAXIMA)",sbcl-depends.mk,(sb-ext:quit))
287 -include sbcl-depends.mk
289 endif
291 ## GCL #########################################################################
292 if GCL
294 gcllibdir = $(verpkglibdir)/binary-gcl
296 EXTRA_SCRIPTS += binary-gcl/maxima
297 gcllib_SCRIPTS = binary-gcl/maxima
299 EXECUTEGCL = $(GCL_NAME) -batch -eval
300 BUILT_FILES += binary-gcl/maxima
301 CLEAN_TARGETS += clean-gcl
303 sys_proc_dependency = sys-proclaim.lisp
304 gcl_depends_targets = (list "binary-gcl/maxima" "sys-proclaim.lisp")
306 sys-proclaim.lisp:
307         rm -rf binary-gcl
308         touch sys-proclaim.lisp
309         $(MAKE) bd
310         $(EXECUTEGCL) '(progn (load "generate-sys-proclaim.lisp"))'
311         rm -rf binary-gcl
313 gcl: binary-gcl/maxima
315 binary-gcl/maxima: $(sys_proc_dependency)
316         $(MAKE) bd
317 if GCL_ALT_LINK
318         $(EXECUTEGCL) '(progn $(LOADDEFSYSTEM) $(DEFSYSTEMCOMPILE))' && \
319         $(EXECUTEGCL) '(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))))'
320 else
321         $(EXECUTEGCL) '(progn $(LOADDEFSYSTEM) $(DEFSYSTEMCOMPILE))' && \
322         $(EXECUTEGCL) '(progn $(LOADDEFSYSTEM) $(DEFSYSTEMLOAD) (when (fboundp (quote si::sgc-on))(si::sgc-on t)) (si:save-system "binary-gcl/maxima"))'
323 endif
325 clean-gcl:
326         rm -rf binary-gcl
328 gcl-depends.mk: maxima.system
329         $(EXECUTEGCL) $(call MAKE_DEPENDS,$(gcl_depends_targets),gcl-depends.mk)
331 -include gcl-depends.mk
333 endif
335 ## OPENMCL / CCL ###############################################################
336 if OPENMCL
338 openmcllibdir = $(verpkglibdir)/binary-openmcl
339 EXTRA_SCRIPTS += $(OPENMCL_MAXIMA)
341 if OPENMCL_EXEC
342 OPENMCL_MAXIMA = binary-openmcl/maxima$(EXEEXT)
343 openmcllib_SCRIPTS = $(OPENMCL_MAXIMA)
344 omcl_flag = :prepend-kernel t
345 else
346 OPENMCL_MAXIMA = binary-openmcl/maxima.image
347 openmcllib_DATA = $(OPENMCL_MAXIMA)
348 omcl_flag =
349 endif
351 EXECUTEOPENMCL = $(OPENMCL_NAME) -e
352 BUILT_FILES += $(OPENMCL_MAXIMA)
353 CLEAN_TARGETS += clean-openmcl
355 COMPILE_OMCL = $(EXECUTEOPENMCL) \
356  '(progn (require :defsystem)  $(DEFSYSTEMCOMPILE) (ccl::quit))'
357 WRITE_OMCL = $(EXECUTEOPENMCL) \
358  '(progn (require :defsystem) $(DEFSYSTEMLOAD) (ccl:save-application "$@") (ccl::quit))'
359 BUILD_OMCL = $(COMPILE_OMCL) && $(WRITE_OMCL)
361 openmcl: $(OPENMCL_MAXIMA)
363 $(OPENMCL_MAXIMA):
364         $(BUILD_OMCL)
365         $(EXECUTEOPENMCL) \
366           '(progn (require :defsystem)  $(DEFSYSTEMCOMPILE) (ccl::quit))' && \
367         $(EXECUTEOPENMCL) \
368           '(progn (require :defsystem) $(DEFSYSTEMLOAD) (ccl:save-application "$@" $(opcl_flag)) (ccl::quit))'
370 clean-openmcl:
371         rm -rf binary-openmcl
373 openmcl-depends.mk: maxima.system
374         $(EXECUTEOPENMCL) $(call MAKE_DEPENDS,"$(OPENMCL_MAXIMA)",openmcl-depends.mk,(ccl:quit))
376 -include openmcl-depends.mk
378 endif
380 ## ECL #########################################################################
381 if ECL
383 ecllibdir = $(verpkglibdir)/binary-ecl
384 EXTRA_SCRIPTS += binary-ecl/maxima
385 ecllib_SCRIPTS = binary-ecl/maxima
387 EXECUTEECL = $(ECL_NAME) -norc
388 BUILT_FILES += binary-ecl/maxima
389 CLEAN_TARGETS += clean-ecl
391 ecl:binary-ecl/maxima
393 binary-ecl/maxima:
394         $(MAKE) bd
395         $(EXECUTEECL) \
396            -eval '(progn $(LOADDEFSYSTEM) $(DEFSYSTEMCOMPILE) (build-maxima-lib))' \
397            -eval '(ext:quit)'
399 clean-ecl:
400         rm -rf binary-ecl libmaxima.a
402 ecl-depends.mk: maxima.system
403         $(EXECUTEECL) -eval $(call MAKE_DEPENDS,"binary-ecl/maxima",ecl-depends.mk,(quit))
405 -include ecl-depends.mk
407 endif