Makefile.am: Drop `.fasl' files in build directory when making images.
[runlisp] / Makefile.am
index 7dcce91..b13d107 100644 (file)
-## Process this file with Automake to generate `Makefile.in'
-## -*-Makefile-*-
-##
-## Building the distribution
-##
-## (c) 1997 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.
-## 
-## 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.
-
-## --- What needs building ---
-
-bin_SCRIPTS = mklinks findlinks mdw-setup
-
-## --- Files to install in the repository ---
-
-pkgdata_DATA = \
-       COPYING COPYING.LIB INSTALL \
-       gpl.tex lgpl.tex gpl.texi lgpl.texi texinice.tex \
-       mdwopt.c mdwopt.h \
-       getdate.y getdate.h
-
-EXTRA_DIST = \
-       aclocal.glob \
-       $(pkgdata_DATA) $(pkgdata_SCRIPTS) mdw-setup \
-       debian/control debian/copyright debian/rules debian/changelog
-
-pkgdata_SCRIPTS = \
-       install-ac maninst
-
-dist-hook:
-       echo $(VERSION) >$(distdir)/RELEASE
+### -*-makefile-*-
+###
+### Build script for `runlisp'
+###
+### (c) 2020 Mark Wooding
+###
+
+###----- Licensing notice ---------------------------------------------------
+###
+### 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 Runlisp.  If not, see <https://www.gnu.org/licenses/>.
+
+include $(top_srcdir)/vars.am
+
+SUBDIRS                         =
+
+image_DATA              =
+image_SCRIPTS           =
+
+SUBDIRS                        += .
+
+ACLOCAL_AMFLAGS                 = -Im4
+
+###--------------------------------------------------------------------------
+### A library of common code.
+
+noinst_LIBRARIES       += librunlisp.a
+librunlisp_a_SOURCES    =
+
+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
+
+###--------------------------------------------------------------------------
+### The main driver program.
+
+bin_PROGRAMS           += runlisp
+runlisp_SOURCES                 = runlisp.c
+runlisp_LDADD           = librunlisp.a
+man_MANS               += runlisp.1
+doc_DATA               += runlisp.pdf
+EXTRA_DIST             += runlisp.1.in
+
+###--------------------------------------------------------------------------
+### Additional machinery.
+
+pkgdata_DATA           += eval.lisp
+EXTRA_DIST             += eval.lisp
+
+pkgdata_SCRIPTS                += dump-ecl
+EXTRA_DIST             += dump-ecl
+
+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
+
+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)$(pkgconfdir)/runlisp.d
+       cp $(srcdir)/runlisp-base.conf \
+               $(DESTDIR)$(pkgconfdir)/runlisp.d/0base.conf
+uninstall-hook::
+       rm -f $(DESTDIR)$(pkgconfdir)/runlisp.d/0base.conf
 
-install-data-hook:
-       $(mkinstalldirs) $(DESTDIR)$(aclocaldir)
-       $(srcdir)/install-ac install \
-                $(srcdir)/aclocal.glob $(DESTDIR)$(aclocaldir)
-uninstall-hook:
-       $(srcdir)/install-ac rm \
-               $(srcdir)/aclocal.glob $(DESTDIR)$(aclocaldir)
+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::
+       rm -f $(DESTDIR)$(pkgconfdir)/runlisp.conf
 
-## --- Documentation ---
+###--------------------------------------------------------------------------
+### Image dumping.
 
-info_TEXINFOS = common.texi
+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
+
+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 subdirectories.
+
+## Documentation.
+SUBDIRS                        += doc
+EXTRA_DIST             += README.org
+
+## Testing.
+SUBDIRS                        += t
+
+## Benchmarking.
+if BENCHMARK
+SUBDIRS                        += bench
+endif
+
+###--------------------------------------------------------------------------
+### Distribution.
+
+## Release number.
+dist-hook::
+       echo $(VERSION) >$(distdir)/RELEASE
 
-## --- Cleaning up ---
+## Additional build tools.
+EXTRA_DIST             += config/auto-version
+EXTRA_DIST             += config/confsubst
 
-CLEANFILES = $(bin_SCRIPTS)
+###----- That's all, folks --------------------------------------------------