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 dist_pkglispsrc_DATA =
30 ###--------------------------------------------------------------------------
33 ## The system definition file.
34 dist_pkglispsrc_DATA += sod.asd
36 ## The package definition file.
37 dist_pkglispsrc_DATA += package.lisp
40 dist_pkglispsrc_DATA += utilities.lisp
42 ## The parser library.
43 dist_pkglispsrc_DATA += parser/floc-proto.lisp parser/floc-impl.lisp
44 dist_pkglispsrc_DATA += parser/streams-proto.lisp parser/streams-impl.lisp
45 dist_pkglispsrc_DATA += parser/scanner-proto.lisp parser/scanner-impl.lisp
46 dist_pkglispsrc_DATA += parser/scanner-charbuf-impl.lisp
47 dist_pkglispsrc_DATA += parser/scanner-token-impl.lisp
48 dist_pkglispsrc_DATA += parser/parser-proto.lisp parser/parser-impl.lisp
49 dist_pkglispsrc_DATA += parser/parser-expr-proto.lisp \
50 parser/parser-expr-impl.lisp
51 dist_pkglispsrc_DATA += parser/scanner-context-impl.lisp
53 ## Lexical analysis and translator-specific parser utilities.
54 dist_pkglispsrc_DATA += lexer-proto.lisp lexer-impl.lisp
55 dist_pkglispsrc_DATA += fragment-parse.lisp
57 ## C type representation.
58 dist_pkglispsrc_DATA += c-types-proto.lisp c-types-impl.lisp \
62 dist_pkglispsrc_DATA += pset-proto.lisp pset-impl.lisp pset-parse.lisp
65 dist_pkglispsrc_DATA += codegen-proto.lisp codegen-impl.lisp
68 dist_pkglispsrc_DATA += output-proto.lisp output-impl.lisp
71 dist_pkglispsrc_DATA += module-proto.lisp module-impl.lisp
72 dist_pkglispsrc_DATA += module-parse.lisp module-output.lisp
73 dist_pkglispsrc_DATA += builtin.lisp
75 ## Class representation and layout.
76 dist_pkglispsrc_DATA += classes.lisp c-types-class-impl.lisp
77 dist_pkglispsrc_DATA += class-utilities.lisp
78 dist_pkglispsrc_DATA += class-make-proto.lisp class-make-impl.lisp
79 dist_pkglispsrc_DATA += class-layout-proto.lisp class-layout-impl.lisp
80 dist_pkglispsrc_DATA += class-finalize-proto.lisp class-finalize-impl.lisp
81 dist_pkglispsrc_DATA += class-output.lisp
84 dist_pkglispsrc_DATA += method-proto.lisp method-impl.lisp
85 dist_pkglispsrc_DATA += method-aggregate.lisp
88 dist_pkglispsrc_DATA += sod-frontend.asd
89 dist_pkglispsrc_DATA += frontend.lisp optparse.lisp
91 ## Interactive testing.
92 dist_pkglispsrc_DATA += debug.lisp
94 ###--------------------------------------------------------------------------
95 ### Constructing an output image.
97 CLEANFILES += *.$(fasl) parser/*.$(fasl)
99 ## Building the executable image.
102 sod: $(dist_pkglispsrc_DATA)
103 $(V_DUMP)true_srcdir=$$(cd $(srcdir); pwd); \
104 ASDF_OUTPUT_TRANSLATIONS=$$true_srcdir:$(abs_builddir): \
105 $(CL_LAUNCH) -o sod -d ! -l $(LISPSYS) +I -S $$true_srcdir/: \
106 -s sod-frontend -r sod-frontend:main
108 ###--------------------------------------------------------------------------
111 ## The system definition.
112 EXTRA_DIST += sod-test.asd
115 EXTRA_DIST += test-base.lisp
118 EXTRA_DIST += parser/parser-test.lisp
119 EXTRA_DIST += parser/scanner-charbuf-test.lisp
122 EXTRA_DIST += c-types-test.lisp
123 EXTRA_DIST += codegen-test.lisp
124 EXTRA_DIST += lexer-test.lisp
126 ## Running the Lisp tests.
128 $(V_TEST)true_srcdir=$$(cd $(srcdir); pwd); \
129 ASDF_OUTPUT_TRANSLATIONS=$$true_srcdir:$(abs_builddir): \
130 $(CL_LAUNCH) -l $(LISPSYS) -s sod-test +I -S $$true_srcdir/: \
133 (setf sod-test:*build-version* "$(VERSION)") ;\
134 (asdf:test-system "sod")) ;\
136 (format *error-output* "ERR: ~A~%" cond) ;\
137 (cl-launch:quit 1)))'
139 ###--------------------------------------------------------------------------
142 ## We want a symlink $(lispsysdir)/sod.asd -> $(lispsrcdir)/sod/sod.asd. It
143 ## would be nice if this were a sane relative symlink, but that involves
144 ## calculating the proper relative path from $(lispsrcdir)/sod to
145 ## $(lispsysdir). Oh, well, here we go. This assumes that the path names
146 ## don't have spaces in them; but that's generally a bad idea in Makefiles
149 $(MKDIR_P) $(DESTDIR)$(lispsysdir)
151 from=$(lispsysdir) to=$(pkglispsrcdir)/sod.asd; \
152 set -- $$(echo $$from | tr "/" " "); fwd=$$*; \
153 set -- $$(echo $$to | tr "/" " "); twd=$$*; \
155 set -- $$fwd; fhd=$$1 fn=$$#; \
156 set -- $$twd; thd=$$1 tn=$$#; \
157 case :$$fn:$$tn: in *:0:*) break ;; esac; \
158 case "$$fhd" in "$$thd") ;; *) break ;; esac; \
159 set -- $$fwd; shift; fwd=$$*; \
160 set -- $$twd; shift; twd=$$*; \
162 dots=$$(echo $$fwd | sed 's/[^ ][^ ]*/../g'); \
163 rel=$$(echo $$dots $$twd | tr " " "/"); \
164 echo >&2 "ln -s $$rel $$to"; \
165 ln -s $$rel $(DESTDIR)$$from/sod.asd.new; \
166 mv $(DESTDIR)$$from/sod.asd.new $(DESTDIR)$$from/sod.asd
168 ###----- That's all, folks --------------------------------------------------