159aa11bd60263fba0d97fcf98b0028568d3994c
[mes.git] / build-aux / configure-lib.sh
1 #! /bin/sh
2
3 # GNU Mes --- Maxwell Equations of Software
4 # Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
5 #
6 # This file is part of GNU Mes.
7 #
8 # GNU Mes is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or (at
11 # your option) any later version.
12 #
13 # GNU Mes is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with GNU Mes.  If not, see <http://www.gnu.org/licenses/>.
20
21 set -e
22 set -u
23
24 V=${V-1}
25
26 if [ "$V" = 2 ]; then
27     set -x
28 fi
29
30 . ./config.sh
31
32 libc_mini_SOURCES="
33 lib/mes/eputs.c
34 lib/mes/oputs.c
35 "
36
37 if test $mes_libc = mes; then
38     libc_mini_SOURCES="$libc_mini_SOURCES
39 lib/posix/write.c
40 lib/string/strlen.c
41 lib/stdlib/puts.c
42 lib/stdlib/exit.c
43 lib/$mes_kernel/$mes_cpu-mes-$compiler/mini.c
44 "
45 fi
46
47 libmes_SOURCES="
48 $libc_mini_SOURCES
49 lib/ctype/isnumber.c
50 lib/mes/abtol.c
51 lib/mes/itoa.c
52 lib/mes/ltoa.c
53 lib/mes/ltoab.c
54 lib/mes/ultoa.c
55 lib/mes/utoa.c
56 lib/mes/eputc.c
57 lib/mes/fdgetc.c
58 lib/mes/fdputc.c
59 lib/mes/fdputs.c
60 lib/mes/fdungetc.c
61 lib/mes/mes_open.c
62 lib/mes/ntoab.c
63 lib/mes/oputc.c
64 "
65
66 if test $mes_libc = mes; then
67     libmes_SOURCES="$libmes_SOURCES
68 lib/stdlib/atoi.c
69 lib/ctype/isdigit.c
70 lib/ctype/isspace.c
71 lib/ctype/isxdigit.c
72 "
73 else
74     libmes_SOURCES="$libmes_SOURCES
75 "
76 fi
77
78 libc_SOURCES="
79 $libmes_SOURCES
80 lib/mes/__assert_fail.c
81 lib/mes/__buffered_read.c
82 lib/mes/__mes_debug.c
83 lib/posix/execv.c
84 lib/posix/getcwd.c
85 lib/posix/getenv.c
86 lib/posix/isatty.c
87 lib/posix/open.c
88 lib/posix/read.c
89 lib/posix/setenv.c
90 lib/posix/wait.c
91 lib/stdio/fgetc.c
92 lib/stdio/fputc.c
93 lib/stdio/fputs.c
94 lib/stdio/getc.c
95 lib/stdio/getchar.c
96 lib/stdio/putc.c
97 lib/stdio/putchar.c
98 lib/stdio/ungetc.c
99 lib/stdlib/free.c
100 lib/stdlib/malloc.c
101 lib/stdlib/realloc.c
102 lib/string/memchr.c
103 lib/string/memcmp.c
104 lib/string/memcpy.c
105 lib/string/memmove.c
106 lib/string/memset.c
107 lib/string/strcmp.c
108 lib/string/strcpy.c
109 lib/string/strncmp.c
110 "
111
112 if test $mes_kernel = linux; then
113     libc_SOURCES="$libc_SOURCES
114 lib/linux/access.c
115 lib/linux/brk.c
116 lib/linux/chmod.c
117 lib/linux/clock_gettime.c
118 lib/linux/dup.c
119 lib/linux/dup2.c
120 lib/linux/execve.c
121 lib/linux/fork.c
122 lib/linux/fsync.c
123 lib/linux/_getcwd.c
124 lib/linux/gettimeofday.c
125 lib/linux/ioctl.c
126 lib/linux/_open3.c
127 lib/linux/_read.c
128 lib/linux/time.c
129 lib/linux/unlink.c
130 lib/linux/waitpid.c
131 lib/linux/$mes_cpu-mes-$compiler/syscall.c
132 "
133 fi
134
135 libtcc1_SOURCES="
136 lib/libtcc1.c
137 "
138
139 libc_tcc_SOURCES="
140 $libc_SOURCES
141 lib/ctype/islower.c
142 lib/ctype/isupper.c
143 lib/ctype/tolower.c
144 lib/ctype/toupper.c
145 lib/mes/search-path.c
146 lib/posix/execvp.c
147 lib/stdio/fclose.c
148 lib/stdio/fdopen.c
149 lib/stdio/ferror.c
150 lib/stdio/fflush.c
151 lib/stdio/fopen.c
152 lib/stdio/fprintf.c
153 lib/stdio/fread.c
154 lib/stdio/fseek.c
155 lib/stdio/ftell.c
156 lib/stdio/fwrite.c
157 lib/stdio/printf.c
158 lib/stdio/remove.c
159 lib/stdio/snprintf.c
160 lib/stdio/sprintf.c
161 lib/stdio/sscanf.c
162 lib/stdio/vfprintf.c
163 lib/stdio/vprintf.c
164 lib/stdio/vsnprintf.c
165 lib/stdio/vsprintf.c
166 lib/stdio/vsscanf.c
167 lib/stdlib/calloc.c
168 lib/stdlib/qsort.c
169 lib/stdlib/strtof.c
170 lib/stdlib/strtol.c
171 lib/stdlib/strtold.c
172 lib/stdlib/strtoll.c
173 lib/stdlib/strtoul.c
174 lib/stdlib/strtoull.c
175 lib/string/memmem.c
176 lib/string/strcat.c
177 lib/string/strchr.c
178 lib/string/strlwr.c
179 lib/string/strncpy.c
180 lib/string/strrchr.c
181 lib/string/strstr.c
182 lib/string/strupr.c
183 lib/stub/sigaction.c
184 lib/stub/ldexp.c
185 lib/stub/mprotect.c
186 lib/stub/localtime.c
187 lib/stub/sigemptyset.c
188 lib/stub/strtod.c
189 lib/$mes_cpu-mes-$compiler/setjmp.c
190 "
191
192 if test $mes_kernel = linux; then
193     libc_tcc_SOURCES="$libc_tcc_SOURCES
194 lib/linux/close.c
195 lib/linux/lseek.c
196 lib/linux/rmdir.c
197 lib/linux/stat.c
198 "
199 fi
200
201 libc_gnu_SOURCES="
202 $libc_tcc_SOURCES
203 lib/ctype/isalnum.c
204 lib/ctype/isalpha.c
205 lib/ctype/isascii.c
206 lib/ctype/iscntrl.c
207 lib/ctype/isprint.c
208 lib/ctype/ispunct.c
209 lib/dirent/__getdirentries.c
210 lib/dirent/closedir.c
211 lib/dirent/opendir.c
212 lib/dirent/readdir.c
213 lib/math/fabs.c
214 lib/mes/fdgets.c
215 lib/posix/alarm.c
216 lib/posix/execl.c
217 lib/posix/mktemp.c
218 lib/posix/raise.c
219 lib/posix/sbrk.c
220 lib/posix/sleep.c
221 lib/posix/unsetenv.c
222 lib/stdio/clearerr.c
223 lib/stdio/feof.c
224 lib/stdio/fgets.c
225 lib/stdio/fileno.c
226 lib/stdio/freopen.c
227 lib/stdio/perror.c
228 lib/stdlib/__exit.c
229 lib/stdlib/abort.c
230 lib/stdlib/abs.c
231 lib/stdlib/alloca.c
232 lib/stdlib/atexit.c
233 lib/stdlib/atol.c
234 lib/stdlib/mbstowcs.c
235 lib/string/bcmp.c
236 lib/string/bcopy.c
237 lib/string/bzero.c
238 lib/string/index.c
239 lib/string/rindex.c
240 lib/string/strcspn.c
241 lib/string/strdup.c
242 lib/string/strerror.c
243 lib/string/strncat.c
244 lib/string/strpbrk.c
245 lib/string/strspn.c
246 lib/stub/__cleanup.c
247 lib/stub/bsearch.c
248 lib/stub/chown.c
249 lib/stub/ctime.c
250 lib/stub/fpurge.c
251 lib/stub/freadahead.c
252 lib/stub/frexp.c
253 lib/stub/getlogin.c
254 lib/stub/getpwnam.c
255 lib/stub/getpwuid.c
256 lib/stub/gmtime.c
257 lib/stub/pclose.c
258 lib/stub/popen.c
259 lib/stub/rand.c
260 lib/stub/setbuf.c
261 lib/stub/setlocale.c
262 lib/stub/setvbuf.c
263 lib/stub/sigaddset.c
264 lib/stub/sigblock.c
265 lib/stub/sigdelset.c
266 lib/stub/sigsetmask.c
267 lib/stub/strftime.c
268 lib/stub/sys_siglist.c
269 lib/stub/system.c
270 lib/stub/times.c
271 lib/stub/ttyname.c
272 lib/stub/umask.c
273 lib/stub/utime.c
274 "
275
276 if test $mes_kernel = linux; then
277     libc_gnu_SOURCES="$libc_gnu_SOURCES
278 lib/linux/chdir.c
279 lib/linux/fcntl.c
280 lib/linux/fstat.c
281 lib/linux/getdents.c
282 lib/linux/getegid.c
283 lib/linux/geteuid.c
284 lib/linux/getgid.c
285 lib/linux/getpid.c
286 lib/linux/getppid.c
287 lib/linux/getrusage.c
288 lib/linux/getuid.c
289 lib/linux/kill.c
290 lib/linux/link.c
291 lib/linux/lstat.c
292 lib/linux/mkdir.c
293 lib/linux/nanosleep.c
294 lib/linux/pipe.c
295 lib/linux/rename.c
296 lib/linux/setgid.c
297 lib/linux/settimer.c
298 lib/linux/setuid.c
299 lib/linux/signal.c
300 lib/linux/sigprogmask.c
301 "
302 fi
303
304 mes_SOURCES="
305 src/gc.c
306 src/hash.c
307 src/lib.c
308 src/math.c
309 src/mes.c
310 src/module.c
311 src/posix.c
312 src/reader.c
313 src/string.c
314 src/struct.c
315 src/vector.c
316 "