Introduce a proper build system and clear away old cruft.
[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 bin_PROGRAMS =
27
28 CLEANFILES =
29
30 pkglispsrcdir = $(lispsrcdir)/$(PACKAGE)
31
32 dist_pkglispsrc_DATA =
33
34 ###--------------------------------------------------------------------------
35 ### The source files.
36
37 ## The system definition file.
38 dist_pkglispsrc_DATA += sod.asd
39
40 ## The package definition file.
41 dist_pkglispsrc_DATA += package.lisp
42
43 ## General utilities.
44 dist_pkglispsrc_DATA += utilities.lisp
45
46 ## The parser library.
47 dist_pkglispsrc_DATA += parser/floc-proto.lisp parser/floc-impl.lisp
48 dist_pkglispsrc_DATA += parser/streams-proto.lisp parser/streams-impl.lisp
49 dist_pkglispsrc_DATA += parser/scanner-proto.lisp parser/scanner-impl.lisp
50 dist_pkglispsrc_DATA += parser/scanner-charbuf-impl.lisp
51 dist_pkglispsrc_DATA += parser/scanner-token-impl.lisp
52 dist_pkglispsrc_DATA += parser/parser-proto.lisp parser/parser-impl.lisp
53 dist_pkglispsrc_DATA += parser/parser-expr-proto.lisp \
54 parser/parser-expr-impl.lisp
55 dist_pkglispsrc_DATA += parser/scanner-context-impl.lisp
56
57 ## Lexical analysis and translator-specific parser utilities.
58 dist_pkglispsrc_DATA += lexer-proto.lisp lexer-impl.lisp
59 dist_pkglispsrc_DATA += fragment-parse.lisp
60
61 ## C type representation.
62 dist_pkglispsrc_DATA += c-types-proto.lisp c-types-impl.lisp \
63 c-types-parse.lisp
64
65 ## Property sets.
66 dist_pkglispsrc_DATA += pset-proto.lisp pset-impl.lisp pset-parse.lisp
67
68 ## Code generation.
69 dist_pkglispsrc_DATA += codegen-proto.lisp codegen-impl.lisp
70
71 ## Output machinery.
72 dist_pkglispsrc_DATA += output-proto.lisp output-impl.lisp
73
74 ## Modules.
75 dist_pkglispsrc_DATA += module-proto.lisp module-impl.lisp
76 dist_pkglispsrc_DATA += module-parse.lisp module-output.lisp
77 dist_pkglispsrc_DATA += builtin.lisp
78
79 ## Class representation and layout.
80 dist_pkglispsrc_DATA += classes.lisp c-types-class-impl.lisp
81 dist_pkglispsrc_DATA += class-utilities.lisp
82 dist_pkglispsrc_DATA += class-make-proto.lisp class-make-impl.lisp
83 dist_pkglispsrc_DATA += class-layout-proto.lisp class-layout-impl.lisp
84 dist_pkglispsrc_DATA += class-finalize-proto.lisp class-finalize-impl.lisp
85 dist_pkglispsrc_DATA += class-output.lisp
86
87 ## Method generation.
88 dist_pkglispsrc_DATA += method-proto.lisp method-impl.lisp
89
90 ## User interface.
91 dist_pkglispsrc_DATA += sod-frontend.asd
92 dist_pkglispsrc_DATA += frontend.lisp optparse.lisp
93
94 ###--------------------------------------------------------------------------
95 ### Constructing an output image.
96
97 CLEANFILES += *.$(FASL_TYPE)
98
99 bin_PROGRAMS += sod
100 sod_SOURCES =
101 sod: $(dist_pkglispsrc_DATA)
102 set -ex; true_srcdir=$$(cd $(srcdir); pwd); \
103 ASDF_OUTPUT_TRANSLATIONS=$$true_srcdir:$(abs_builddir): \
104 $(CL_LAUNCH) -o sod -d ! -l $(LISPSYS) +I -S $$true_srcdir/ \
105 -s sod-frontend -r sod-frontend:main
106
107 ###--------------------------------------------------------------------------
108 ### Installation.
109
110 ## We want a symlink $(lispsysdir)/sod.asd -> $(lispsrcdir)/sod/sod.asd. It
111 ## would be nice if this were a sane relative symlink, but that involves
112 ## calculating the proper relative path from $(lispsrcdir)/sod to
113 ## $(lispsysdir). Oh, well, here we go. This assumes that the path names
114 ## don't have spaces in them; but that's generally a bad idea in Makefiles
115 ## anyway.
116 install-data-local:
117 $(MKDIR_P) $(DESTDIR)$(lispsysdir)
118 @set -e; \
119 from=$(lispsysdir) to=$(pkglispsrcdir)/sod.asd; \
120 set -- $$(echo $$from | tr "/" " "); fwd=$$*; \
121 set -- $$(echo $$to | tr "/" " "); twd=$$*; \
122 while :; do \
123 set -- $$fwd; fhd=$$1 fn=$$#; \
124 set -- $$twd; thd=$$1 tn=$$#; \
125 case :$$fn:$$tn: in *:0:*) break ;; esac; \
126 case "$$fhd" in "$$thd") ;; *) break ;; esac; \
127 set -- $$fwd; shift; fwd=$$*; \
128 set -- $$twd; shift; twd=$$*; \
129 done; \
130 dots=$$(echo $$fwd | sed 's/[^ ][^ ]*/../g'); \
131 rel=$$(echo $$dots $$twd | tr " " "/"); \
132 echo >&2 "ln -s $$rel $$to"; \
133 ln -s $$rel $(DESTDIR)$$from.new; \
134 mv $(DESTDIR)$$from.new $(DESTDIR)$$from
135
136 ###----- That's all, folks --------------------------------------------------