3 ### Build script for the SOD translator
5 ### (c) 2015 Straylight/Edgeware
8 ###----- Licensing notice ---------------------------------------------------
10 ### This file is part of the Sensible 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)
32 ###--------------------------------------------------------------------------
35 ## The package definition file.
36 LISP_SOURCES += package.lisp
39 LISP_SOURCES += utilities.lisp
41 ## The parser library.
42 LISP_SOURCES += parser/package.lisp
43 LISP_SOURCES += parser/floc-proto.lisp parser/floc-impl.lisp
44 LISP_SOURCES += parser/streams-proto.lisp parser/streams-impl.lisp
45 LISP_SOURCES += parser/scanner-proto.lisp parser/scanner-impl.lisp
46 LISP_SOURCES += parser/scanner-charbuf-impl.lisp
47 LISP_SOURCES += parser/scanner-token-impl.lisp
48 LISP_SOURCES += parser/parser-proto.lisp parser/parser-impl.lisp
49 LISP_SOURCES += parser/parser-expr-proto.lisp \
50 parser/parser-expr-impl.lisp
51 LISP_SOURCES += parser/scanner-context-impl.lisp
53 ## Lexical analysis and translator-specific parser utilities.
54 LISP_SOURCES += lexer-proto.lisp lexer-impl.lisp
55 LISP_SOURCES += fragment-parse.lisp
57 ## C type representation.
58 LISP_SOURCES += c-types-proto.lisp c-types-impl.lisp \
62 LISP_SOURCES += pset-proto.lisp pset-impl.lisp pset-parse.lisp
65 LISP_SOURCES += codegen-proto.lisp codegen-impl.lisp
68 LISP_SOURCES += output-proto.lisp output-impl.lisp
71 LISP_SOURCES += module-proto.lisp module-impl.lisp
72 LISP_SOURCES += module-parse.lisp module-output.lisp
73 LISP_SOURCES += builtin.lisp
75 ## Class representation and layout.
76 LISP_SOURCES += classes.lisp c-types-class-impl.lisp
77 LISP_SOURCES += class-utilities.lisp
78 LISP_SOURCES += class-make-proto.lisp class-make-impl.lisp
79 LISP_SOURCES += class-layout-proto.lisp class-layout-impl.lisp
80 LISP_SOURCES += class-finalize-proto.lisp class-finalize-impl.lisp
81 LISP_SOURCES += class-output.lisp
84 LISP_SOURCES += method-proto.lisp method-impl.lisp
85 LISP_SOURCES += method-aggregate.lisp
88 LISP_SOURCES += frontend.lisp optparse.lisp
91 LISP_SOURCES += final.lisp
93 ###--------------------------------------------------------------------------
94 ### Constructing an output image.
96 CLEANFILES += *.$(fasl) parser/*.$(fasl)
98 ## Autodetected configuration.
99 EXTRA_DIST += auto.lisp.in
100 CLEANFILES += auto.lisp
101 auto.lisp: auto.lisp.in Makefile
102 $(SUBST) $(srcdir)/auto.lisp.in >$@.new $(SUBSTITUTIONS) && \
103 grep '^[^;]' $@.new >$@.strip && \
104 rm -f $@.new && mv $@.strip $@
106 ## Building a working-tree system definition.
107 EXTRA_DIST += sod.asd.in
108 CLEANFILES += sod.asd
109 sod.asd: sod.asd.in Makefile
110 $(SUBST) $(srcdir)/sod.asd.in >$@.new $(SUBSTITUTIONS) && \
113 ## Building the executable image.
116 sod$(EXEEXT): $(LISP_SOURCES) sod.asd auto.lisp
117 $(V_DUMP)$(ASDF_ENV) $(RUNLISP) -L$(WORKING_LISPS) \
118 -e "(asdf:clear-configuration)" \
119 -e "(asdf:operate 'asdf:program-op \"sod/frontend\")"
121 ## The executable is needed if we're just distributing.
122 dist-hook: sod$(EXEEXT)
124 ###--------------------------------------------------------------------------
128 EXTRA_DIST += test-base.lisp
131 EXTRA_DIST += parser/parser-test.lisp
132 EXTRA_DIST += parser/scanner-charbuf-test.lisp
135 EXTRA_DIST += c-types-test.lisp
136 EXTRA_DIST += codegen-test.lisp
137 EXTRA_DIST += lexer-test.lisp
139 ## Running the Lisp tests.
140 check-local: sod sod.asd
141 $(V_TEST)$(ASDF_ENV) $(RUNLISP) -L$(WORKING_LISPS) -e \
142 '(asdf:clear-configuration) ;\
143 (handler-case (asdf:test-system "sod") ;\
145 (format *error-output* "ERR: ~A~%" cond) ;\
148 ###--------------------------------------------------------------------------
151 man_MANS += sod.1 sod-module.5
152 CLEANFILES += sod.1 sod-module.5
153 EXTRA_DIST += sod.1.in sod-module.5.in
155 ###--------------------------------------------------------------------------
158 ## We want a symlink $(lispsysdir)/sod.asd -> $(lispsrcdir)/sod/sod.asd. It
159 ## would be nice if this were a sane relative symlink, but that involves
160 ## calculating the proper relative path from $(lispsrcdir)/sod to
161 ## $(lispsysdir). Oh, well, here we go. This assumes that the path names
162 ## don't have spaces in them; but that's generally a bad idea in Makefiles
165 $(MKDIR_P) $(DESTDIR)$(lispsysdir) $(DESTDIR)$(pkglispsrcdir)
167 from=$(lispsysdir) to=$(pkglispsrcdir); \
168 set -- $$(echo $$from | tr "/" " "); fwd=$$*; \
169 set -- $$(echo $$to | tr "/" " "); twd=$$*; \
171 set -- $$fwd; fhd=$$1 fn=$$#; \
172 set -- $$twd; thd=$$1 tn=$$#; \
173 case :$$fn:$$tn: in *:0:*) break ;; esac; \
174 case "$$fhd" in "$$thd") ;; *) break ;; esac; \
175 set -- $$fwd; shift; fwd=$$*; \
176 set -- $$twd; shift; twd=$$*; \
178 dots=$$(echo $$fwd | sed 's/[^ ][^ ]*/../g'); \
179 rel=$$(echo $$dots $$twd | tr " " "/"); \
180 for i in sod.asd; do \
181 echo >&2 "CREATE $$to/$$i"; \
182 sed -e '/#|@-auto-@|#/ { r auto.lisp' -e ' d; }' \
183 -e '/#|@-del-@|#/ d' \
184 -e '/#|@-path-@|#/ d' \
185 $(srcdir)/$$i.in >$(DESTDIR)$(pkglispsrcdir)/$$i.new; \
186 mv $(DESTDIR)$(pkglispsrcdir)/$$i.new \
187 $(DESTDIR)$(pkglispsrcdir)/$$i; \
188 echo >&2 "LINK $$rel/$$i $$to/$$i"; \
189 ln -s $$rel/$$i $(DESTDIR)$$from/$$i.new; \
190 mv $(DESTDIR)$$from/$$i.new $(DESTDIR)$$from/$$i; \
194 for i in sod.asd sod-frontend.asd; do \
195 rm -f $(DESTDIR)$(pkglispsrcdir)/$$i $(DESTDIR)$(lispsysdir)/$$i; \
198 ###--------------------------------------------------------------------------
199 ### Additional random things useful during development.
201 ## ASDF hacking for finding the system definitions.
202 EXTRA_DIST += asdf-hack.lisp.in
203 noinst_DATA += asdf-hack.lisp
204 asdf-hack.lisp: asdf-hack.lisp.in Makefile
205 $(SUBST) $(srcdir)/asdf-hack.lisp.in >$@.new $(SUBSTITUTIONS) && \
207 CLEANFILES += asdf-hack.lisp
209 ## Emacs hacking for indentation.
210 EXTRA_DIST += emacs-hacks.el
212 ###----- That's all, folks --------------------------------------------------