chiark / gitweb /
Eliminate the separately maintained Lisp system version number.
[sod] / src / Makefile.am
index c7779f9604389e43688aaeb46696a2f28394fef2..7b23dd8c84f3c783cdb36438765e6ccf8b67dd10 100644 (file)
@@ -27,13 +27,11 @@ include     $(top_srcdir)/vars.am
 
 nobase_dist_pkglispsrc_DATA = $(LISP_SOURCES)
 LISP_SOURCES            =
+SYSDEFS                         =
 
 ###--------------------------------------------------------------------------
 ### The source files.
 
-## The system definition file.
-LISP_SOURCES           += sod.asd
-
 ## The package definition file.
 LISP_SOURCES           += package.lisp
 
@@ -87,7 +85,6 @@ LISP_SOURCES          += method-proto.lisp method-impl.lisp
 LISP_SOURCES           += method-aggregate.lisp
 
 ## User interface.
-LISP_SOURCES           += sod-frontend.asd
 LISP_SOURCES           += frontend.lisp optparse.lisp
 
 ## Finishing touches.
@@ -98,20 +95,39 @@ LISP_SOURCES                += final.lisp
 
 CLEANFILES             += *.$(fasl) parser/*.$(fasl)
 
+## Autodetected configuration.
+EXTRA_DIST             += auto.lisp.in
+CLEANFILES             += auto.lisp
+auto.lisp: auto.lisp.in Makefile
+       $(SUBST) $(srcdir)/auto.lisp.in >$@.new $(SUBSTITUTIONS) && \
+               grep '^[^;]' $@.new >$@.strip && \
+               rm -f $@.new && mv $@.strip $@
+
+## Building a working-tree system definition.
+EXTRA_DIST             += sod.asd.in
+CLEANFILES             += sod.asd
+sod.asd: sod.asd.in Makefile
+       $(SUBST) $(srcdir)/sod.asd.in >$@.new $(SUBSTITUTIONS) && \
+               mv $@.new $@
+
+EXTRA_DIST             += sod-frontend.asd.in
+CLEANFILES             += sod-frontend.asd
+sod-frontend.asd: sod-frontend.asd.in Makefile
+       $(SUBST) $(srcdir)/sod-frontend.asd.in >$@.new $(SUBSTITUTIONS) && \
+               mv $@.new $@
+
 ## Building the executable image.
 bin_PROGRAMS           += sod
 sod_SOURCES             =
-sod: $(LISP_SOURCES)
-       $(V_DUMP)true_srcdir=$$(cd $(srcdir); pwd); \
-       ASDF_OUTPUT_TRANSLATIONS=$$true_srcdir:$(abs_builddir): \
-       $(CL_LAUNCH) -o sod -d ! -l $(LISPSYS) +I -S $$true_srcdir/: \
+sod: $(LISP_SOURCES) sod.asd sod-frontend.asd auto.lisp
+       $(V_DUMP)$(CL_LAUNCH) -o sod -d ! -l $(LISPSYS) +I \
                -s sod-frontend -r sod-frontend:main
 
 ###--------------------------------------------------------------------------
 ### Unit testing.
 
 ## The system definition.
-EXTRA_DIST             += sod-test.asd
+EXTRA_DIST             += sod-test.asd.in
 
 ## Basic utilities.
 EXTRA_DIST             += test-base.lisp
@@ -125,15 +141,17 @@ EXTRA_DIST                += c-types-test.lisp
 EXTRA_DIST             += codegen-test.lisp
 EXTRA_DIST             += lexer-test.lisp
 
+## The system definition.
+EXTRA_DIST             += sod-test.asd.in
+CLEANFILES             += sod-test.asd
+sod-test.asd: sod-test.asd.in Makefile
+       $(SUBST) $(srcdir)/sod-test.asd.in >$@.new $(SUBSTITUTIONS) && \
+               mv $@.new $@
+
 ## Running the Lisp tests.
-check-local:
-       $(V_TEST)true_srcdir=$$(cd $(srcdir); pwd); \
-       ASDF_OUTPUT_TRANSLATIONS=$$true_srcdir:$(abs_builddir): \
-       $(CL_LAUNCH) -l $(LISPSYS) -s sod-test +I -S $$true_srcdir/: \
-               -i '(handler-case ;\
-                     (progn ;\
-                       (setf sod-test:*build-version* "$(VERSION)") ;\
-                       (asdf:test-system "sod")) ;\
+check-local: sod sod-test.asd
+       $(V_TEST)$(CL_LAUNCH) -l $(LISPSYS) -s sod-test +I \
+               -i '(handler-case (asdf:test-system "sod") ;\
                      (error (cond) ;\
                        (format *error-output* "ERR: ~A~%" cond) ;\
                        (cl-launch:quit 1)))'
@@ -148,9 +166,9 @@ check-local:
 ## don't have spaces in them; but that's generally a bad idea in Makefiles
 ## anyway.
 install-data-local:
-       $(MKDIR_P) $(DESTDIR)$(lispsysdir)
+       $(MKDIR_P) $(DESTDIR)$(lispsysdir) $(DESTDIR)$(pkglispsrcdir)
        @set -e; \
-       from=$(lispsysdir) to=$(pkglispsrcdir)/sod.asd; \
+       from=$(lispsysdir) to=$(pkglispsrcdir); \
        set -- $$(echo $$from | tr "/" " "); fwd=$$*; \
        set -- $$(echo $$to | tr "/" " "); twd=$$*; \
        while :; do \
@@ -163,8 +181,21 @@ install-data-local:
        done; \
        dots=$$(echo $$fwd | sed 's/[^ ][^ ]*/../g'); \
        rel=$$(echo $$dots $$twd | tr " " "/"); \
-       echo >&2 "ln -s $$rel $$to"; \
-       ln -s $$rel $(DESTDIR)$$from/sod.asd.new; \
-       mv $(DESTDIR)$$from/sod.asd.new $(DESTDIR)$$from/sod.asd
+       for i in sod.asd sod-frontend.asd; do \
+         echo >&2 "CREATE $$to/$$i"; \
+         sed -e '/#|@-auto-@|#/ { r auto.lisp' -e ' d; }' \
+             -e '/#|@-path-@|#/ d' \
+               $(srcdir)/$$i.in >$(DESTDIR)$(pkglispsrcdir)/$$i.new; \
+         mv $(DESTDIR)$(pkglispsrcdir)/$$i.new \
+               $(DESTDIR)$(pkglispsrcdir)/$$i; \
+         echo >&2 "LINK $$rel/$$i $$to/$$i"; \
+         ln -s $$rel/$$i $(DESTDIR)$$from/$$i.new; \
+         mv $(DESTDIR)$$from/$$i.new $(DESTDIR)$$from/$$i; \
+       done
+
+uninstall-local:
+       for i in sod.asd sod-frontend.asd; do \
+         rm -f $(DESTDIR)$(pkglispsrcdir)/$$i $(DESTDIR)$(lispsysdir)/$$i; \
+       done
 
 ###----- That's all, folks --------------------------------------------------