[c21d4d6] | 1 | #
|
---|
[7d7f5e3] | 2 | # Copyright (c) 2023 Jiri Svoboda
|
---|
[c21d4d6] | 3 | # Copyright (c) 2005 Martin Decky
|
---|
| 4 | # Copyright (c) 2007 Jakub Jermar
|
---|
| 5 | # All rights reserved.
|
---|
| 6 | #
|
---|
| 7 | # Redistribution and use in source and binary forms, with or without
|
---|
| 8 | # modification, are permitted provided that the following conditions
|
---|
| 9 | # are met:
|
---|
| 10 | #
|
---|
| 11 | # - Redistributions of source code must retain the above copyright
|
---|
| 12 | # notice, this list of conditions and the following disclaimer.
|
---|
| 13 | # - Redistributions in binary form must reproduce the above copyright
|
---|
| 14 | # notice, this list of conditions and the following disclaimer in the
|
---|
| 15 | # documentation and/or other materials provided with the distribution.
|
---|
| 16 | # - The name of the author may not be used to endorse or promote products
|
---|
| 17 | # derived from this software without specific prior written permission.
|
---|
| 18 | #
|
---|
| 19 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 20 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 21 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 22 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 23 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 24 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 25 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 26 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 27 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 28 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 29 | #
|
---|
| 30 |
|
---|
[5fd05862] | 31 | # libarch
|
---|
| 32 | arch_src = []
|
---|
[5f176da] | 33 | subdir('arch' / UARCH)
|
---|
[5fd05862] | 34 |
|
---|
| 35 | c_args = [ '-fno-builtin', '-D_LIBC_SOURCE' ]
|
---|
| 36 |
|
---|
| 37 | root_path = '..' / '..' / '..'
|
---|
| 38 |
|
---|
| 39 | incdirs = [
|
---|
| 40 | 'include',
|
---|
[5f176da] | 41 | 'arch' / UARCH / 'include',
|
---|
| 42 | root_path / 'abi' / 'arch' / UARCH / 'include',
|
---|
[5fd05862] | 43 | root_path / 'abi' / 'include',
|
---|
[b169619] | 44 | root_path / 'common' / 'include',
|
---|
[5fd05862] | 45 | ]
|
---|
| 46 |
|
---|
| 47 | includes += include_directories(incdirs, is_system: true)
|
---|
| 48 |
|
---|
| 49 | allow_shared = true
|
---|
| 50 |
|
---|
[7749646] | 51 | uspace_lib_devel_install_script_text += 'mkdir -p "${DESTDIR}include/libc"'
|
---|
| 52 | foreach idir : incdirs
|
---|
| 53 | _sdir = meson.current_source_dir() / idir
|
---|
| 54 | uspace_lib_devel_install_script_text += 'cp -R -L -T "@0@" "${DESTDIR}include/libc"'.format(_sdir)
|
---|
| 55 | endforeach
|
---|
[5fd05862] | 56 |
|
---|
| 57 | src = [ arch_src ]
|
---|
| 58 |
|
---|
| 59 | src += files(
|
---|
[ad9178bf] | 60 | 'common/adt/checksum.c',
|
---|
| 61 | 'common/adt/circ_buf.c',
|
---|
| 62 | 'common/adt/list.c',
|
---|
| 63 | 'common/adt/hash_table.c',
|
---|
| 64 | 'common/adt/odict.c',
|
---|
[694ca3d6] | 65 | 'common/printf/printf_core.c',
|
---|
[fdfb24e] | 66 | 'common/stdc/ctype.c',
|
---|
[b169619] | 67 | 'common/stdc/mem.c',
|
---|
[44e8541] | 68 | 'common/stdc/bsearch.c',
|
---|
| 69 | 'common/stdc/qsort.c',
|
---|
| 70 | 'common/stdc/calloc.c',
|
---|
[55c5cb05] | 71 | 'common/gsort.c',
|
---|
[fdfb24e] | 72 | 'common/str.c',
|
---|
| 73 | 'common/str_error.c',
|
---|
| 74 | 'common/strtol.c',
|
---|
[44e8541] | 75 |
|
---|
[5fd05862] | 76 | 'generic/libc.c',
|
---|
[d76862d0] | 77 | 'generic/adt/prodcons.c',
|
---|
[5fd05862] | 78 | 'generic/as.c',
|
---|
[5fc8244] | 79 | 'generic/ddi.c',
|
---|
[5fd05862] | 80 | 'generic/perm.c',
|
---|
[c24b0dcb] | 81 | 'generic/capa.c',
|
---|
[5fd05862] | 82 | 'generic/config.c',
|
---|
| 83 | 'generic/context.c',
|
---|
[5fc8244] | 84 | 'generic/device/clock_dev.c',
|
---|
[5fd05862] | 85 | 'generic/device/hw_res.c',
|
---|
| 86 | 'generic/device/hw_res_parsed.c',
|
---|
| 87 | 'generic/device/pio_window.c',
|
---|
| 88 | 'generic/dirent.c',
|
---|
| 89 | 'generic/dlfcn.c',
|
---|
| 90 | 'generic/elf/elf.c',
|
---|
| 91 | 'generic/elf/elf_load.c',
|
---|
| 92 | 'generic/elf/elf_mod.c',
|
---|
| 93 | 'generic/event.c',
|
---|
| 94 | 'generic/errno.c',
|
---|
| 95 | 'generic/inttypes.c',
|
---|
| 96 | 'generic/loc.c',
|
---|
| 97 | 'generic/string.c',
|
---|
| 98 | 'generic/l18n/langs.c',
|
---|
| 99 | 'generic/pcb.c',
|
---|
[5fc8244] | 100 | 'generic/pio_trace.c',
|
---|
[5fd05862] | 101 | 'generic/smc.c',
|
---|
| 102 | 'generic/task.c',
|
---|
| 103 | 'generic/imath.c',
|
---|
| 104 | 'generic/io/asprintf.c',
|
---|
| 105 | 'generic/io/io.c',
|
---|
| 106 | 'generic/io/chargrid.c',
|
---|
| 107 | 'generic/io/printf.c',
|
---|
| 108 | 'generic/io/log.c',
|
---|
| 109 | 'generic/io/logctl.c',
|
---|
| 110 | 'generic/io/kio.c',
|
---|
| 111 | 'generic/io/klog.c',
|
---|
| 112 | 'generic/io/snprintf.c',
|
---|
| 113 | 'generic/io/vprintf.c',
|
---|
| 114 | 'generic/io/vsnprintf.c',
|
---|
| 115 | 'generic/io/table.c',
|
---|
| 116 | 'generic/irq.c',
|
---|
| 117 | 'generic/ieee_double.c',
|
---|
| 118 | 'generic/power_of_ten.c',
|
---|
| 119 | 'generic/double_to_str.c',
|
---|
| 120 | 'generic/malloc.c',
|
---|
| 121 | 'generic/rndgen.c',
|
---|
| 122 | 'generic/stdio/scanf.c',
|
---|
| 123 | 'generic/stdio/sprintf.c',
|
---|
| 124 | 'generic/stdio/sscanf.c',
|
---|
| 125 | 'generic/stdio/sstream.c',
|
---|
| 126 | 'generic/stdio/vsprintf.c',
|
---|
| 127 | 'generic/thread/fibril.c',
|
---|
| 128 | 'generic/thread/fibril_synch.c',
|
---|
| 129 | 'generic/thread/thread.c',
|
---|
| 130 | 'generic/thread/tls.c',
|
---|
| 131 | 'generic/thread/futex.c',
|
---|
| 132 | 'generic/thread/mpsc.c',
|
---|
| 133 | 'generic/sysinfo.c',
|
---|
| 134 | 'generic/ipc.c',
|
---|
| 135 | 'generic/ns.c',
|
---|
| 136 | 'generic/async/client.c',
|
---|
| 137 | 'generic/async/server.c',
|
---|
| 138 | 'generic/async/ports.c',
|
---|
| 139 | 'generic/loader.c',
|
---|
| 140 | 'generic/getopt.c',
|
---|
| 141 | 'generic/time.c',
|
---|
| 142 | 'generic/tmpfile.c',
|
---|
| 143 | 'generic/stdio.c',
|
---|
| 144 | 'generic/stdlib.c',
|
---|
| 145 | 'generic/udebug.c',
|
---|
| 146 | 'generic/vfs/canonify.c',
|
---|
| 147 | 'generic/vfs/inbox.c',
|
---|
| 148 | 'generic/vfs/mtab.c',
|
---|
| 149 | 'generic/vfs/vfs.c',
|
---|
| 150 | 'generic/setjmp.c',
|
---|
| 151 | 'generic/stack.c',
|
---|
| 152 | 'generic/stacktrace.c',
|
---|
| 153 | 'generic/arg_parse.c',
|
---|
| 154 | 'generic/stats.c',
|
---|
| 155 | 'generic/assert.c',
|
---|
| 156 | 'generic/ubsan.c',
|
---|
| 157 | 'generic/uuid.c',
|
---|
| 158 | )
|
---|
| 159 |
|
---|
| 160 | if CONFIG_RTLD
|
---|
| 161 | src += files(
|
---|
| 162 | 'generic/rtld/rtld.c',
|
---|
| 163 | 'generic/rtld/dynamic.c',
|
---|
| 164 | 'generic/rtld/module.c',
|
---|
| 165 | 'generic/rtld/symbol.c',
|
---|
| 166 | )
|
---|
| 167 | endif
|
---|
| 168 |
|
---|
| 169 | test_src = files(
|
---|
| 170 | 'test/adt/circ_buf.c',
|
---|
| 171 | 'test/adt/odict.c',
|
---|
[c24b0dcb] | 172 | 'test/capa.c',
|
---|
[5fd05862] | 173 | 'test/casting.c',
|
---|
| 174 | 'test/double_to_str.c',
|
---|
| 175 | 'test/fibril/timer.c',
|
---|
| 176 | 'test/getopt.c',
|
---|
| 177 | 'test/gsort.c',
|
---|
| 178 | 'test/ieee_double.c',
|
---|
| 179 | 'test/imath.c',
|
---|
| 180 | 'test/inttypes.c',
|
---|
| 181 | 'test/io/table.c',
|
---|
[7d7f5e3] | 182 | 'test/loc.c',
|
---|
[5fd05862] | 183 | 'test/main.c',
|
---|
| 184 | 'test/mem.c',
|
---|
| 185 | 'test/perf.c',
|
---|
| 186 | 'test/perm.c',
|
---|
| 187 | 'test/qsort.c',
|
---|
| 188 | 'test/sprintf.c',
|
---|
| 189 | 'test/stdio/scanf.c',
|
---|
| 190 | 'test/stdio.c',
|
---|
| 191 | 'test/stdlib.c',
|
---|
| 192 | 'test/str.c',
|
---|
| 193 | 'test/string.c',
|
---|
| 194 | 'test/strtol.c',
|
---|
| 195 | 'test/uuid.c',
|
---|
| 196 | )
|
---|
| 197 |
|
---|
| 198 | # Startfiles.
|
---|
| 199 | # This is what other systems know as crt*.o files, i.e. a set of object files
|
---|
| 200 | # that are automatically built into every program binary (but not libraries).
|
---|
| 201 | # We haven't yet installed the object files where the compiler can find them,
|
---|
| 202 | # so we have to add them manually.
|
---|
| 203 | #
|
---|
| 204 |
|
---|
| 205 | start_src = [ arch_start_src, files('generic/crt/crt1.c') ]
|
---|
| 206 |
|
---|
| 207 | libstartfiles = static_library('startfiles', start_src,
|
---|
| 208 | include_directories: includes,
|
---|
[63660a3] | 209 | c_args: arch_uspace_c_args + c_args,
|
---|
[5fd05862] | 210 | pic: false,
|
---|
| 211 | )
|
---|
| 212 |
|
---|
[fa5ab58] | 213 | if CONFIG_DEVEL_FILES
|
---|
| 214 | install_files += [[ 'lib', libstartfiles.full_path(), 'libstartfiles.a' ]]
|
---|
[123cd6d] | 215 | install_deps += [ libstartfiles ]
|
---|
[fa5ab58] | 216 | endif
|
---|