src/final.lisp: Rename from `debug.lisp'.
[sod] / src / Makefile.am
1 ### -*-makefile-*-
2 ###
3 ### Build script for the SOD translator
4 ###
5 ### (c) 2015 Straylight/Edgeware
6 ###
7
8 ###----- Licensing notice ---------------------------------------------------
9 ###
10 ### This file is part of the Sensble Object Design, an object system for C.
11 ###
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.
16 ###
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.
21 ###
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.
25
26 include $(top_srcdir)/vars.am
27
28 nobase_dist_pkglispsrc_DATA = $(LISP_SOURCES)
29 LISP_SOURCES =
30
31 ###--------------------------------------------------------------------------
32 ### The source files.
33
34 ## The system definition file.
35 LISP_SOURCES += sod.asd
36
37 ## The package definition file.
38 LISP_SOURCES += package.lisp
39
40 ## General utilities.
41 LISP_SOURCES += utilities.lisp
42
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
54
55 ## Lexical analysis and translator-specific parser utilities.
56 LISP_SOURCES += lexer-proto.lisp lexer-impl.lisp
57 LISP_SOURCES += fragment-parse.lisp
58
59 ## C type representation.
60 LISP_SOURCES += c-types-proto.lisp c-types-impl.lisp \
61 c-types-parse.lisp
62
63 ## Property sets.
64 LISP_SOURCES += pset-proto.lisp pset-impl.lisp pset-parse.lisp
65
66 ## Code generation.
67 LISP_SOURCES += codegen-proto.lisp codegen-impl.lisp
68
69 ## Output machinery.
70 LISP_SOURCES += output-proto.lisp output-impl.lisp
71
72 ## Modules.
73 LISP_SOURCES += module-proto.lisp module-impl.lisp
74 LISP_SOURCES += module-parse.lisp module-output.lisp
75 LISP_SOURCES += builtin.lisp
76
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
84
85 ## Method generation.
86 LISP_SOURCES += method-proto.lisp method-impl.lisp
87 LISP_SOURCES += method-aggregate.lisp
88
89 ## User interface.
90 LISP_SOURCES += sod-frontend.asd
91 LISP_SOURCES += frontend.lisp optparse.lisp
92
93 ## Finishing touches.
94 LISP_SOURCES += final.lisp
95
96 ###--------------------------------------------------------------------------
97 ### Constructing an output image.
98
99 CLEANFILES += *.$(fasl) parser/*.$(fasl)
100
101 ## Building the executable image.
102 bin_PROGRAMS += sod
103 sod_SOURCES =
104 sod: $(LISP_SOURCES)
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
109
110 ###--------------------------------------------------------------------------
111 ### Unit testing.
112
113 ## The system definition.
114 EXTRA_DIST += sod-test.asd
115
116 ## Basic utilities.
117 EXTRA_DIST += test-base.lisp
118
119 ## Parser tests.
120 EXTRA_DIST += parser/parser-test.lisp
121 EXTRA_DIST += parser/scanner-charbuf-test.lisp
122
123 ## Translator tests.
124 EXTRA_DIST += c-types-test.lisp
125 EXTRA_DIST += codegen-test.lisp
126 EXTRA_DIST += lexer-test.lisp
127
128 ## Running the Lisp tests.
129 check-local:
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/: \
133 -i '(handler-case ;\
134 (progn ;\
135 (setf sod-test:*build-version* "$(VERSION)") ;\
136 (asdf:test-system "sod")) ;\
137 (error (cond) ;\
138 (format *error-output* "ERR: ~A~%" cond) ;\
139 (cl-launch:quit 1)))'
140
141 ###--------------------------------------------------------------------------
142 ### Installation.
143
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
149 ## anyway.
150 install-data-local:
151 $(MKDIR_P) $(DESTDIR)$(lispsysdir)
152 @set -e; \
153 from=$(lispsysdir) to=$(pkglispsrcdir)/sod.asd; \
154 set -- $$(echo $$from | tr "/" " "); fwd=$$*; \
155 set -- $$(echo $$to | tr "/" " "); twd=$$*; \
156 while :; do \
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=$$*; \
163 done; \
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
169
170 ###----- That's all, folks --------------------------------------------------