### -*-makefile-*- ### ### Build script for the SOD translator ### ### (c) 2015 Straylight/Edgeware ### ###----- Licensing notice --------------------------------------------------- ### ### 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 ### the Free Software Foundation; either version 2 of the License, or ### (at your option) any later version. ### ### SOD 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 SOD; if not, write to the Free Software Foundation, ### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. include $(top_srcdir)/vars.am 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 package definition file. LISP_SOURCES += package.lisp ## General utilities. LISP_SOURCES += utilities.lisp ## The parser library. 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 LISP_SOURCES += parser/scanner-context-impl.lisp ## Lexical analysis and translator-specific parser utilities. LISP_SOURCES += lexer-proto.lisp lexer-impl.lisp LISP_SOURCES += fragment-parse.lisp ## C type representation. LISP_SOURCES += c-types-proto.lisp c-types-impl.lisp \ c-types-parse.lisp ## Property sets. LISP_SOURCES += pset-proto.lisp pset-impl.lisp pset-parse.lisp ## Code generation. LISP_SOURCES += codegen-proto.lisp codegen-impl.lisp ## Output machinery. LISP_SOURCES += output-proto.lisp output-impl.lisp ## Modules. LISP_SOURCES += module-proto.lisp module-impl.lisp LISP_SOURCES += module-parse.lisp module-output.lisp LISP_SOURCES += builtin.lisp ## Class representation and layout. 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. LISP_SOURCES += method-proto.lisp method-impl.lisp LISP_SOURCES += method-aggregate.lisp ## User interface. LISP_SOURCES += frontend.lisp optparse.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$(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.in ## Basic utilities. EXTRA_DIST += test-base.lisp ## Parser tests. EXTRA_DIST += parser/parser-test.lisp EXTRA_DIST += parser/scanner-charbuf-test.lisp ## Translator tests. 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: sod sod-test.asd $(V_TEST)$(ASDF_ENV) $(CL_LAUNCH) -l $(LISPSYS) \ -s sod-frontend +I \ -i '(handler-case ;\ (progn ;\ (asdf:load-system "sod-test") ;\ (asdf:test-system "sod")) ;\ (error (cond) ;\ (format *error-output* "ERR: ~A~%" cond) ;\ (optparse:exit 1)))' ###-------------------------------------------------------------------------- ### Manual pages. dist_man_MANS += sod.1 dist_man_MANS += sod-module.5 ###-------------------------------------------------------------------------- ### Installation. ## We want a symlink $(lispsysdir)/sod.asd -> $(lispsrcdir)/sod/sod.asd. It ## would be nice if this were a sane relative symlink, but that involves ## calculating the proper relative path from $(lispsrcdir)/sod to ## $(lispsysdir). Oh, well, here we go. This assumes that the path names ## don't have spaces in them; but that's generally a bad idea in Makefiles ## anyway. install-data-local: $(MKDIR_P) $(DESTDIR)$(lispsysdir) $(DESTDIR)$(pkglispsrcdir) @set -e; \ from=$(lispsysdir) to=$(pkglispsrcdir); \ set -- $$(echo $$from | tr "/" " "); fwd=$$*; \ set -- $$(echo $$to | tr "/" " "); twd=$$*; \ while :; do \ set -- $$fwd; fhd=$$1 fn=$$#; \ set -- $$twd; thd=$$1 tn=$$#; \ case :$$fn:$$tn: in *:0:*) break ;; esac; \ case "$$fhd" in "$$thd") ;; *) break ;; esac; \ set -- $$fwd; shift; fwd=$$*; \ set -- $$twd; shift; twd=$$*; \ done; \ dots=$$(echo $$fwd | sed 's/[^ ][^ ]*/../g'); \ rel=$$(echo $$dots $$twd | tr " " "/"); \ 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 --------------------------------------------------