3 ### Build script for the SOD translator
5 ### (c) 2015 Straylight/Edgeware
8 ###----- Licensing notice ---------------------------------------------------
10 ### This file is part of the Sensble Object Design, an object system for C.
12 ### SOD is free software; you can redistribute it and/or modify
13 ### it under the terms of the GNU General Public License as published by
14 ### the Free Software Foundation; either version 2 of the License, or
15 ### (at your option) any later version.
17 ### SOD is distributed in the hope that it will be useful,
18 ### but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ### GNU General Public License for more details.
22 ### You should have received a copy of the GNU General Public License
23 ### along with SOD; if not, write to the Free Software Foundation,
24 ### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 include $(top_srcdir)/vars.am
28 nobase_dist_pkglispsrc_DATA = $(LISP_SOURCES)
31 ###--------------------------------------------------------------------------
34 ## The system definition file.
35 LISP_SOURCES += sod.asd
37 ## The package definition file.
38 LISP_SOURCES += package.lisp
41 LISP_SOURCES += utilities.lisp
43 ## The parser library.
44 LISP_SOURCES += parser/package.lisp
45 LISP_SOURCES += parser/floc-proto.lisp parser/floc-impl.lisp
46 LISP_SOURCES += parser/streams-proto.lisp parser/streams-impl.lisp
47 LISP_SOURCES += parser/scanner-proto.lisp parser/scanner-impl.lisp
48 LISP_SOURCES += parser/scanner-charbuf-impl.lisp
49 LISP_SOURCES += parser/scanner-token-impl.lisp
50 LISP_SOURCES += parser/parser-proto.lisp parser/parser-impl.lisp
51 LISP_SOURCES += parser/parser-expr-proto.lisp \
52 parser/parser-expr-impl.lisp
53 LISP_SOURCES += parser/scanner-context-impl.lisp
55 ## Lexical analysis and translator-specific parser utilities.
56 LISP_SOURCES += lexer-proto.lisp lexer-impl.lisp
57 LISP_SOURCES += fragment-parse.lisp
59 ## C type representation.
60 LISP_SOURCES += c-types-proto.lisp c-types-impl.lisp \
64 LISP_SOURCES += pset-proto.lisp pset-impl.lisp pset-parse.lisp
67 LISP_SOURCES += codegen-proto.lisp codegen-impl.lisp
70 LISP_SOURCES += output-proto.lisp output-impl.lisp
73 LISP_SOURCES += module-proto.lisp module-impl.lisp
74 LISP_SOURCES += module-parse.lisp module-output.lisp
75 LISP_SOURCES += builtin.lisp
77 ## Class representation and layout.
78 LISP_SOURCES += classes.lisp c-types-class-impl.lisp
79 LISP_SOURCES += class-utilities.lisp
80 LISP_SOURCES += class-make-proto.lisp class-make-impl.lisp
81 LISP_SOURCES += class-layout-proto.lisp class-layout-impl.lisp
82 LISP_SOURCES += class-finalize-proto.lisp class-finalize-impl.lisp
83 LISP_SOURCES += class-output.lisp
86 LISP_SOURCES += method-proto.lisp method-impl.lisp
87 LISP_SOURCES += method-aggregate.lisp
90 LISP_SOURCES += sod-frontend.asd
91 LISP_SOURCES += frontend.lisp optparse.lisp
94 LISP_SOURCES += final.lisp
96 ###--------------------------------------------------------------------------
97 ### Constructing an output image.
99 CLEANFILES += *.$(fasl) parser/*.$(fasl)
101 ## Building the executable image.
105 $(V_DUMP)true_srcdir=$$(cd $(srcdir); pwd); \
106 ASDF_OUTPUT_TRANSLATIONS=$$true_srcdir:$(abs_builddir): \
107 $(CL_LAUNCH) -o sod -d ! -l $(LISPSYS) +I -S $$true_srcdir/: \
108 -s sod-frontend -r sod-frontend:main
110 ###--------------------------------------------------------------------------
113 ## The system definition.
114 EXTRA_DIST += sod-test.asd
117 EXTRA_DIST += test-base.lisp
120 EXTRA_DIST += parser/parser-test.lisp
121 EXTRA_DIST += parser/scanner-charbuf-test.lisp
124 EXTRA_DIST += c-types-test.lisp
125 EXTRA_DIST += codegen-test.lisp
126 EXTRA_DIST += lexer-test.lisp
128 ## Running the Lisp tests.
130 $(V_TEST)true_srcdir=$$(cd $(srcdir); pwd); \
131 ASDF_OUTPUT_TRANSLATIONS=$$true_srcdir:$(abs_builddir): \
132 $(CL_LAUNCH) -l $(LISPSYS) -s sod-test +I -S $$true_srcdir/: \
135 (setf sod-test:*build-version* "$(VERSION)") ;\
136 (asdf:test-system "sod")) ;\
138 (format *error-output* "ERR: ~A~%" cond) ;\
139 (cl-launch:quit 1)))'
141 ###--------------------------------------------------------------------------
144 ## We want a symlink $(lispsysdir)/sod.asd -> $(lispsrcdir)/sod/sod.asd. It
145 ## would be nice if this were a sane relative symlink, but that involves
146 ## calculating the proper relative path from $(lispsrcdir)/sod to
147 ## $(lispsysdir). Oh, well, here we go. This assumes that the path names
148 ## don't have spaces in them; but that's generally a bad idea in Makefiles
151 $(MKDIR_P) $(DESTDIR)$(lispsysdir)
153 from=$(lispsysdir) to=$(pkglispsrcdir)/sod.asd; \
154 set -- $$(echo $$from | tr "/" " "); fwd=$$*; \
155 set -- $$(echo $$to | tr "/" " "); twd=$$*; \
157 set -- $$fwd; fhd=$$1 fn=$$#; \
158 set -- $$twd; thd=$$1 tn=$$#; \
159 case :$$fn:$$tn: in *:0:*) break ;; esac; \
160 case "$$fhd" in "$$thd") ;; *) break ;; esac; \
161 set -- $$fwd; shift; fwd=$$*; \
162 set -- $$twd; shift; twd=$$*; \
164 dots=$$(echo $$fwd | sed 's/[^ ][^ ]*/../g'); \
165 rel=$$(echo $$dots $$twd | tr " " "/"); \
166 echo >&2 "ln -s $$rel $$to"; \
167 ln -s $$rel $(DESTDIR)$$from/sod.asd.new; \
168 mv $(DESTDIR)$$from/sod.asd.new $(DESTDIR)$$from/sod.asd
170 ###----- That's all, folks --------------------------------------------------