###----- Licensing notice ---------------------------------------------------
###
-### This file is part of the Sensble Object Design, an object system for C.
+### This file is part of the Sensible Object Design, an object system for C.
###
### SOD is free software; you can redistribute it and/or modify
### it under the terms of the GNU General Public License as published by
nobase_dist_pkglispsrc_DATA = $(LISP_SOURCES)
LISP_SOURCES =
+SYSDEFS =
+
+ASDF_ENV = \
+ CL_SOURCE_REGISTRY=$$(pwd): \
+ ASDF_OUTPUT_TRANSLATIONS=$$(cd $(srcdir); pwd):$(abs_builddir):
###--------------------------------------------------------------------------
### The source files.
-## The system definition file.
-LISP_SOURCES += sod.asd
-
## The package definition file.
LISP_SOURCES += package.lisp
LISP_SOURCES += method-aggregate.lisp
## User interface.
-LISP_SOURCES += sod-frontend.asd
LISP_SOURCES += frontend.lisp optparse.lisp
## Finishing touches.
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$(EXEEXT): $(LISP_SOURCES) sod.asd sod-frontend.asd auto.lisp
+ $(V_DUMP)$(ASDF_ENV) $(CL_LAUNCH) -o $@ -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
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/: \
+check-local: sod sod-test.asd
+ $(V_TEST)$(ASDF_ENV) $(CL_LAUNCH) -l $(LISPSYS) \
+ -s sod-frontend +I \
-i '(handler-case ;\
- (progn ;\
- (setf sod-test:*build-version* "$(VERSION)") ;\
- (asdf:test-system "sod")) ;\
+ (progn ;\
+ (asdf:load-system "sod-test") ;\
+ (asdf:test-system "sod")) ;\
(error (cond) ;\
(format *error-output* "ERR: ~A~%" cond) ;\
- (cl-launch:quit 1)))'
+ (optparse:exit 1)))'
+
+###--------------------------------------------------------------------------
+### Manual pages.
+
+dist_man_MANS += sod.1
+dist_man_MANS += sod-module.5
###--------------------------------------------------------------------------
### Installation.
## 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 \
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 --------------------------------------------------