X-Git-Url: https://git.distorted.org.uk/~mdw/sod/blobdiff_plain/1d7528b63ae429e01f097b831aba50c060c4ea7e..fddbedf7b1b4b19add30eeb62281748cc77e6955:/src/Makefile.am diff --git a/src/Makefile.am b/src/Makefile.am index 5b8aa21..30ba76e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,7 +7,7 @@ ###----- 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 @@ -25,91 +25,113 @@ include $(top_srcdir)/vars.am -dist_pkglispsrc_DATA = +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. -dist_pkglispsrc_DATA += sod.asd - ## The package definition file. -dist_pkglispsrc_DATA += package.lisp +LISP_SOURCES += package.lisp ## General utilities. -dist_pkglispsrc_DATA += utilities.lisp +LISP_SOURCES += utilities.lisp ## The parser library. -dist_pkglispsrc_DATA += parser/floc-proto.lisp parser/floc-impl.lisp -dist_pkglispsrc_DATA += parser/streams-proto.lisp parser/streams-impl.lisp -dist_pkglispsrc_DATA += parser/scanner-proto.lisp parser/scanner-impl.lisp -dist_pkglispsrc_DATA += parser/scanner-charbuf-impl.lisp -dist_pkglispsrc_DATA += parser/scanner-token-impl.lisp -dist_pkglispsrc_DATA += parser/parser-proto.lisp parser/parser-impl.lisp -dist_pkglispsrc_DATA += parser/parser-expr-proto.lisp \ +LISP_SOURCES += parser/package.lisp +LISP_SOURCES += parser/floc-proto.lisp parser/floc-impl.lisp +LISP_SOURCES += parser/streams-proto.lisp parser/streams-impl.lisp +LISP_SOURCES += parser/scanner-proto.lisp parser/scanner-impl.lisp +LISP_SOURCES += parser/scanner-charbuf-impl.lisp +LISP_SOURCES += parser/scanner-token-impl.lisp +LISP_SOURCES += parser/parser-proto.lisp parser/parser-impl.lisp +LISP_SOURCES += parser/parser-expr-proto.lisp \ parser/parser-expr-impl.lisp -dist_pkglispsrc_DATA += parser/scanner-context-impl.lisp +LISP_SOURCES += parser/scanner-context-impl.lisp ## Lexical analysis and translator-specific parser utilities. -dist_pkglispsrc_DATA += lexer-proto.lisp lexer-impl.lisp -dist_pkglispsrc_DATA += fragment-parse.lisp +LISP_SOURCES += lexer-proto.lisp lexer-impl.lisp +LISP_SOURCES += fragment-parse.lisp ## C type representation. -dist_pkglispsrc_DATA += c-types-proto.lisp c-types-impl.lisp \ +LISP_SOURCES += c-types-proto.lisp c-types-impl.lisp \ c-types-parse.lisp ## Property sets. -dist_pkglispsrc_DATA += pset-proto.lisp pset-impl.lisp pset-parse.lisp +LISP_SOURCES += pset-proto.lisp pset-impl.lisp pset-parse.lisp ## Code generation. -dist_pkglispsrc_DATA += codegen-proto.lisp codegen-impl.lisp +LISP_SOURCES += codegen-proto.lisp codegen-impl.lisp ## Output machinery. -dist_pkglispsrc_DATA += output-proto.lisp output-impl.lisp +LISP_SOURCES += output-proto.lisp output-impl.lisp ## Modules. -dist_pkglispsrc_DATA += module-proto.lisp module-impl.lisp -dist_pkglispsrc_DATA += module-parse.lisp module-output.lisp -dist_pkglispsrc_DATA += builtin.lisp +LISP_SOURCES += module-proto.lisp module-impl.lisp +LISP_SOURCES += module-parse.lisp module-output.lisp +LISP_SOURCES += builtin.lisp ## Class representation and layout. -dist_pkglispsrc_DATA += classes.lisp c-types-class-impl.lisp -dist_pkglispsrc_DATA += class-utilities.lisp -dist_pkglispsrc_DATA += class-make-proto.lisp class-make-impl.lisp -dist_pkglispsrc_DATA += class-layout-proto.lisp class-layout-impl.lisp -dist_pkglispsrc_DATA += class-finalize-proto.lisp class-finalize-impl.lisp -dist_pkglispsrc_DATA += class-output.lisp +LISP_SOURCES += classes.lisp c-types-class-impl.lisp +LISP_SOURCES += class-utilities.lisp +LISP_SOURCES += class-make-proto.lisp class-make-impl.lisp +LISP_SOURCES += class-layout-proto.lisp class-layout-impl.lisp +LISP_SOURCES += class-finalize-proto.lisp class-finalize-impl.lisp +LISP_SOURCES += class-output.lisp ## Method generation. -dist_pkglispsrc_DATA += method-proto.lisp method-impl.lisp -dist_pkglispsrc_DATA += method-aggregate.lisp +LISP_SOURCES += method-proto.lisp method-impl.lisp +LISP_SOURCES += method-aggregate.lisp ## User interface. -dist_pkglispsrc_DATA += sod-frontend.asd -dist_pkglispsrc_DATA += frontend.lisp optparse.lisp +LISP_SOURCES += frontend.lisp optparse.lisp -## Interactive testing. -dist_pkglispsrc_DATA += debug.lisp +## Finishing touches. +LISP_SOURCES += final.lisp ###-------------------------------------------------------------------------- ### Constructing an output image. 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: $(dist_pkglispsrc_DATA) - $(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 @@ -123,16 +145,30 @@ 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/: \ +check-local: sod sod-test.asd + $(V_TEST)$(ASDF_ENV) $(CL_LAUNCH) -l $(LISPSYS) \ + -s sod-frontend +I \ -i '(handler-case ;\ - (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. @@ -144,9 +180,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 \ @@ -159,8 +195,35 @@ 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 + +###-------------------------------------------------------------------------- +### Additional random things useful during development. + +## ASDF hacking for finding the system definitions. +EXTRA_DIST += asdf-hack.lisp.in +noinst_DATA += asdf-hack.lisp +asdf-hack.lisp: asdf-hack.lisp.in Makefile + $(SUBST) $(srcdir)/asdf-hack.lisp.in >$@.new $(SUBSTITUTIONS) && \ + mv $@.new $@ +CLEANFILES += asdf-hack.lisp + +## Emacs hacking for indentation. +EXTRA_DIST += emacs-hacks.el ###----- That's all, folks --------------------------------------------------