Makefile.am: Drop `.fasl' files in build directory when making images.
[runlisp] / Makefile.am
index 7ca039d..b13d107 100644 (file)
 ### -*-makefile-*-
 ###
-### Building the distribution
+### Build script for `runlisp'
 ###
-### (c) 1997 Mark Wooding
+### (c) 2020 Mark Wooding
 ###
 
 ###----- Licensing notice ---------------------------------------------------
 ###
-### This file is part of the Common Files Distribution (`common')
-### 
-### `Common' is free software; you can redistribute it and/or modify
-### it under the terms of the GNU General Public License as published by
-### the Free Software Foundation; either version 2 of the License, or
-### (at your option) any later version.
-### 
-### `Common' is distributed in the hope that it will be useful,
-### but WITHOUT ANY WARRANTY; without even the implied warranty of
-### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-### GNU General Public License for more details.
-### 
+### This file is part of Runlisp, a tool for invoking Common Lisp scripts.
+###
+### Runlisp is free software: you can redistribute it and/or modify it
+### under the terms of the GNU General Public License as published by the
+### Free Software Foundation; either version 3 of the License, or (at your
+### option) any later version.
+###
+### Runlisp is distributed in the hope that it will be useful, but WITHOUT
+### ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+### FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+### for more details.
+###
 ### You should have received a copy of the GNU General Public License
-### along with `common'; if not, write to the Free Software Foundation,
-### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+### along with Runlisp.  If not, see <https://www.gnu.org/licenses/>.
 
-bin_SCRIPTS             =
-pkgdata_SCRIPTS                 =
-pkgdata_DATA            =
+include $(top_srcdir)/vars.am
 
-EXTRA_DIST              =
-CLEANFILES              =
+SUBDIRS                         =
 
-###--------------------------------------------------------------------------
-### Handy variables.
+image_DATA              =
+image_SCRIPTS           =
 
-confsubst = $(srcdir)/confsubst.in
-mkdir_p = $(srcdir)/config/install-sh -d
+SUBDIRS                        += .
 
-###--------------------------------------------------------------------------
-### Main scripts.
-
-## mklinks
-bin_SCRIPTS            += mklinks
-CLEANFILES             += mklinks
-EXTRA_DIST             += mklinks.in
-
-mklinks: mklinks.in Makefile
-       $(confsubst) $(srcdir)/mklinks.in >$@.new \
-               pkgdatadir=$(pkgdatadir) VERSION=$(VERSION)
-       chmod +x $@.new
-       mv $@.new $@
-
-## findlinks
-bin_SCRIPTS            += findlinks
-CLEANFILES             += findlinks
-EXTRA_DIST             += findlinks.in
-
-findlinks: findlinks.in Makefile
-       $(confsubst) $(srcdir)/findlinks.in >$@.new \
-               pkgdatadir=$(pkgdatadir) VERSION=$(VERSION)
-       chmod +x $@.new
-       mv $@.new $@
-
-## mdw-setup
-bin_SCRIPTS            += mdw-setup
-EXTRA_DIST             += mdw-setup
+ACLOCAL_AMFLAGS                 = -Im4
 
 ###--------------------------------------------------------------------------
-### Files to install.
+### A library of common code.
 
-## Licences.
-pkgdata_DATA           += COPYING COPYING.LIB
-pkgdata_DATA           += gpl.tex lgpl.tex gpl.texi lgpl.texi
+noinst_LIBRARIES       += librunlisp.a
+librunlisp_a_SOURCES    =
 
-## Documentation.
-pkgdata_DATA           += INSTALL
-pkgdata_DATA           += texinice.tex
+librunlisp_a_SOURCES   += common.c common.h
+librunlisp_a_SOURCES   += lib.c lib.h
+librunlisp_a_SOURCES   += mdwopt.c mdwopt.h
+librunlisp_a_SOURCES   += sha256.c sha256.h
 
-## Useful code.
-pkgdata_DATA           += mdwopt.c mdwopt.h
-pkgdata_DATA           += getdate.y getdate.h
+###--------------------------------------------------------------------------
+### The main driver program.
 
-## Scripts.
-pkgdata_SCRIPTS                += install-ac
-pkgdata_SCRIPTS                += maninst
+bin_PROGRAMS           += runlisp
+runlisp_SOURCES                 = runlisp.c
+runlisp_LDADD           = librunlisp.a
+man_MANS               += runlisp.1
+doc_DATA               += runlisp.pdf
+EXTRA_DIST             += runlisp.1.in
 
-## confsubst
-pkgdata_SCRIPTS                += confsubst
-CLEANFILES             += confsubst
-EXTRA_DIST             += confsubst.in
+###--------------------------------------------------------------------------
+### Additional machinery.
 
-confsubst: confsubst.in Makefile
-       $(confsubst) $(srcdir)/confsubst.in >$@.new \
-               VERSION=$(VERSION)
-       chmod +x $@.new
-       mv $@.new $@
+pkgdata_DATA           += eval.lisp
+EXTRA_DIST             += eval.lisp
 
-## Testsuites.
-pkgdata_DATA           += autotest.am
-pkgdata_DATA           += testsuite.at
+pkgdata_SCRIPTS                += dump-ecl
+EXTRA_DIST             += dump-ecl
 
-EXTRA_DIST             += $(pkgdata_DATA)
-EXTRA_DIST             += $(pkgdata_SCRIPTS)
+bin_PROGRAMS           += query-runlisp-config
+query_runlisp_config_SOURCES = query-runlisp-config.c
+query_runlisp_config_LDADD = librunlisp.a
+man_MANS               += query-runlisp-config.1
+doc_DATA               += query-runlisp-config.pdf
+EXTRA_DIST             += query-runlisp-config.1.in
 
-## Autoconf snippets.
-EXTRA_DIST             += aclocal.glob
+man_MANS               += runlisp.conf.5
+doc_DATA               += runlisp.conf.pdf
+EXTRA_DIST             += runlisp.conf.5.in
 
+EXTRA_DIST             += runlisp-base.conf
 install-data-hook::
-       $(mkdir_p) $(DESTDIR)$(aclocaldir)
-       $(srcdir)/install-ac install \
-                $(srcdir)/aclocal.glob $(DESTDIR)$(aclocaldir)
+       $(MKDIR_P) $(DESTDIR)$(pkgconfdir)/runlisp.d
+       cp $(srcdir)/runlisp-base.conf \
+               $(DESTDIR)$(pkgconfdir)/runlisp.d/0base.conf
+uninstall-hook::
+       rm -f $(DESTDIR)$(pkgconfdir)/runlisp.d/0base.conf
 
+EXTRA_DIST             += runlisp.conf
+install-data-hook::
+       $(MKDIR_P) $(DESTDIR)$(pkgconfdir)
+       if ! [ -f $(DESTDIR)$(pkgconfdir)/runlisp.conf ]; then \
+         cp $(srcdir)/runlisp.conf $(DESTDIR)$(pkgconfdir)/; \
+       fi
 uninstall-hook::
-       $(srcdir)/install-ac rm \
-               $(srcdir)/aclocal.glob $(DESTDIR)$(aclocaldir)
+       rm -f $(DESTDIR)$(pkgconfdir)/runlisp.conf
 
 ###--------------------------------------------------------------------------
-### Documentation.
+### Image dumping.
+
+bin_PROGRAMS           += dump-runlisp-image
+dump_runlisp_image_SOURCES  = dump-runlisp-image.c
+dump_runlisp_image_LDADD = librunlisp.a
+man_MANS               += dump-runlisp-image.1
+doc_DATA               += dump-runlisp-image.pdf
+EXTRA_DIST             += dump-runlisp-image.1.in
+
+DUMP_RUNLISP_IMAGE      = $(v_dump)\
+                          ASDF_OUTPUT_TRANSLATIONS='( \
+                               :output-translations \
+                               :ignore-inherited-configuration \
+                               (t ("$(abs_builddir)/" "fasl/" \
+                                       :implementation-type :**/ :*.*.*)))' \
+                          ./dump-runlisp-image -f -O$@ \
+                               -c$(srcdir)/runlisp-base.conf \
+                               -odata-dir=$(srcdir)
+clean-local::; rm -fr fasl
+
+v_dump                  = $(v_dump_@AM_V@)
+v_dump_                         = $(v_dump_@AM_DEFAULT_V@)
+v_dump_0                = @echo "  DUMP     $@";
+
+IMAGES                  =
+noinst_DATA            += $(IMAGES)
+
+if DUMP_SBCL
+IMAGES                 += sbcl+asdf.core
+CLEANFILES             += sbcl+asdf.core sbcl+asdf.core-*
+sbcl+asdf.core: dump-runlisp-image runlisp-base.conf
+       $(DUMP_RUNLISP_IMAGE) sbcl
+endif
+
+if DUMP_CCL
+IMAGES                 += ccl+asdf.image
+CLEANFILES             += ccl+asdf.image ccl+asdf.image-*
+ccl+asdf.image: dump-runlisp-image runlisp-base.conf
+       $(DUMP_RUNLISP_IMAGE) ccl
+endif
+
+if DUMP_CLISP
+IMAGES                 += clisp+asdf.mem
+CLEANFILES             += clisp+asdf.mem clisp+asdf.mem-*
+clisp+asdf.mem: dump-runlisp-image runlisp-base.conf
+       $(DUMP_RUNLISP_IMAGE) clisp
+endif
+
+if DUMP_ECL
+IMAGES                 += ecl+asdf
+CLEANFILES             += ecl+asdf ecl+asdf-*
+ecl+asdf: dump-runlisp-image runlisp-base.conf dump-ecl
+       $(DUMP_RUNLISP_IMAGE) -odata-dir=$(srcdir) ecl
+endif
+
+if DUMP_CMUCL
+IMAGES                 += cmucl+asdf.core
+CLEANFILES             += cmucl+asdf.core cmucl+asdf.core-*
+cmucl+asdf.core: dump-runlisp-image runlisp-base.conf
+       $(DUMP_RUNLISP_IMAGE) cmucl
+endif
 
-info_TEXINFOS = common.texi
+install-data-hook::
+       mkdir -p $(DESTDIR)$(imagedir)
+       set -e; for i in $(IMAGES); do \
+         j=$$(readlink $$i); \
+         cp $$j $(DESTDIR)$(imagedir)/$$j.new && \
+               mv $(DESTDIR)$(imagedir)/$$j.new \
+                       $(DESTDIR)$(imagedir)/$$j; \
+         ln -sf $$j $(DESTDIR)$(imagedir)/$$i; \
+       done
+
+uninstall-hook::
+       set -e; for i in $(IMAGES); do \
+         if j=$$(readlink $(DESTDIR)$(imagedir)/$$i); then \
+           case $$j in \
+             $$i-*[!0-9a-f]) ;; \
+             $$i-*) rm -f $(DESTDIR)$(imagedir)/$$j ;; \
+           esac; \
+         fi; \
+         rm -f $(DESTDIR)$(imagedir)/$$i; \
+       done
 
 ###--------------------------------------------------------------------------
-### Other special tweaks.
+### Other subdirectories.
 
-## Make `make distcheck' work.
-DISTCHECK_CONFIGURE_FLAGS = \
-       --with-aclocaldir='$${prefix}/share/aclocal'
+## Documentation.
+SUBDIRS                        += doc
+EXTRA_DIST             += README.org
 
-## Distribute the release number.
-dist-hook::
-       echo $(VERSION) >$(distdir)/RELEASE
+## Testing.
+SUBDIRS                        += t
+
+## Benchmarking.
+if BENCHMARK
+SUBDIRS                        += bench
+endif
 
 ###--------------------------------------------------------------------------
-### Debian.
+### Distribution.
+
+## Release number.
+dist-hook::
+       echo $(VERSION) >$(distdir)/RELEASE
 
-EXTRA_DIST             += debian/control
-EXTRA_DIST             += debian/copyright
-EXTRA_DIST             += debian/rules
-EXTRA_DIST             += debian/changelog
+## Additional build tools.
+EXTRA_DIST             += config/auto-version
+EXTRA_DIST             += config/confsubst
 
 ###----- That's all, folks --------------------------------------------------