Index: uspace/lib/bithenge/Makefile
===================================================================
--- uspace/lib/bithenge/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,47 +1,0 @@
-#
-# Copyright (c) 2012 Sean Bartell
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libbithenge
-EXTRA_CFLAGS = -D__HELENOS__
-LIBS = block
-
-SOURCES = \
-	src/helenos/block.c \
-	src/blob.c \
-	src/compound.c \
-	src/expression.c \
-	src/file.c \
-	src/print.c \
-	src/script.c \
-	src/sequence.c \
-	src/source.c \
-	src/transform.c \
-	src/tree.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/bithenge/meson.build
===================================================================
--- uspace/lib/bithenge/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/bithenge/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,15 @@
+deps = [ 'block' ]
+c_args = [ '-D__HELENOS__' ]
+src = files(
+	'src/helenos/block.c',
+	'src/blob.c',
+	'src/compound.c',
+	'src/expression.c',
+	'src/file.c',
+	'src/print.c',
+	'src/script.c',
+	'src/sequence.c',
+	'src/source.c',
+	'src/transform.c',
+	'src/tree.c',
+)
Index: uspace/lib/block/Makefile
===================================================================
--- uspace/lib/block/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libblock
-
-SOURCES = \
-	block.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/block/meson.build
===================================================================
--- uspace/lib/block/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/block/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,1 @@
+src = files('block.c')
Index: uspace/lib/c/Makefile
===================================================================
--- uspace/lib/c/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,228 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-ROOT_PATH = $(USPACE_PREFIX)/..
-
-CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
-
-EXTRA_OUTPUT = $(START_FILES)
-EXTRA_CFLAGS += -fno-builtin -D_LIBC_SOURCE
-LIBRARY = libc
-SOVERSION = 0.0
-
--include $(CONFIG_MAKEFILE)
--include arch/$(UARCH)/Makefile.inc
-
-GENERIC_SOURCES = \
-	generic/libc.c \
-	generic/ddi.c \
-	generic/as.c \
-	generic/bd.c \
-	generic/bd_srv.c \
-	generic/perm.c \
-	generic/cap.c \
-	generic/clipboard.c \
-	generic/config.c \
-	generic/context.c \
-	generic/corecfg.c \
-	generic/ctype.c \
-	generic/devman.c \
-	generic/device/hw_res.c \
-	generic/device/hw_res_parsed.c \
-	generic/device/pio_window.c \
-	generic/device/clock_dev.c \
-	generic/device/led_dev.c \
-	generic/dirent.c \
-	generic/dhcp.c \
-	generic/dnsr.c \
-	generic/dlfcn.c \
-	generic/elf/elf.c \
-	generic/elf/elf_load.c \
-	generic/elf/elf_mod.c \
-	generic/event.c \
-	generic/errno.c \
-	generic/gsort.c \
-	generic/inttypes.c \
-	generic/ipc_test.c \
-	generic/loc.c \
-	generic/mem.c \
-	generic/str.c \
-	generic/string.c \
-	generic/str_error.c \
-	generic/strtol.c \
-	generic/l18n/langs.c \
-	generic/pcb.c \
-	generic/smc.c \
-	generic/task.c \
-	generic/imath.c \
-	generic/inet/addr.c \
-	generic/inet/endpoint.c \
-	generic/inet/host.c \
-	generic/inet/hostname.c \
-	generic/inet/hostport.c \
-	generic/inet/tcp.c \
-	generic/inet/udp.c \
-	generic/inet.c \
-	generic/inetcfg.c \
-	generic/inetping.c \
-	generic/io/asprintf.c \
-	generic/io/input.c \
-	generic/io/io.c \
-	generic/io/chardev.c \
-	generic/io/chardev_srv.c \
-	generic/io/chargrid.c \
-	generic/io/output.c \
-	generic/io/printf.c \
-	generic/io/log.c \
-	generic/io/logctl.c \
-	generic/io/label.c \
-	generic/io/kio.c \
-	generic/io/klog.c \
-	generic/io/serial.c \
-	generic/io/snprintf.c \
-	generic/io/vprintf.c \
-	generic/io/vsnprintf.c \
-	generic/io/printf_core.c \
-	generic/io/con_srv.c \
-	generic/io/console.c \
-	generic/io/table.c \
-	generic/io/visualizer.c \
-	generic/io/window.c \
-	generic/iplink.c \
-	generic/iplink_srv.c \
-	generic/irc.c \
-	generic/irq.c \
-	generic/ieee_double.c \
-	generic/power_of_ten.c \
-	generic/double_to_str.c \
-	generic/malloc.c \
-	generic/rndgen.c \
-	generic/stdio/scanf.c \
-	generic/stdio/sprintf.c \
-	generic/stdio/sscanf.c \
-	generic/stdio/sstream.c \
-	generic/stdio/vsprintf.c \
-	generic/thread/fibril.c \
-	generic/thread/fibril_synch.c \
-	generic/thread/thread.c \
-	generic/thread/tls.c \
-	generic/thread/futex.c \
-	generic/thread/mpsc.c \
-	generic/sysinfo.c \
-	generic/ipc.c \
-	generic/ns.c \
-	generic/async/client.c \
-	generic/async/server.c \
-	generic/async/ports.c \
-	generic/loader.c \
-	generic/getopt.c \
-	generic/adt/checksum.c \
-	generic/adt/circ_buf.c \
-	generic/adt/list.c \
-	generic/adt/hash_table.c \
-	generic/adt/odict.c \
-	generic/adt/prodcons.c \
-	generic/time.c \
-	generic/tmpfile.c \
-	generic/stdio.c \
-	generic/stdlib.c \
-	generic/udebug.c \
-	generic/vfs/canonify.c \
-	generic/vfs/inbox.c \
-	generic/vfs/mtab.c \
-	generic/vfs/vfs.c \
-	generic/setjmp.c \
-	generic/stack.c \
-	generic/stacktrace.c \
-	generic/arg_parse.c \
-	generic/stats.c \
-	generic/assert.c \
-	generic/bsearch.c \
-	generic/pci.c \
-	generic/pio_trace.c \
-	generic/qsort.c \
-	generic/ubsan.c \
-	generic/uuid.c \
-	generic/vbd.c \
-	generic/vol.c
-
-ifeq ($(CONFIG_RTLD),y)
-	GENERIC_SOURCES += \
-		generic/rtld/rtld.c \
-		generic/rtld/dynamic.c \
-		generic/rtld/module.c \
-		generic/rtld/symbol.c
-endif
-
-ARCH_SOURCES += $(ARCH_AUTOCHECK_HEADERS:%.h=%.check.c)
-
-SOURCES = \
-	$(GENERIC_SOURCES) \
-	$(ARCH_SOURCES)
-
-TEST_SOURCES = \
-	test/adt/circ_buf.c \
-	test/adt/odict.c \
-	test/cap.c \
-	test/casting.c \
-	test/double_to_str.c \
-	test/fibril/timer.c \
-	test/getopt.c \
-	test/gsort.c \
-	test/ieee_double.c \
-	test/imath.c \
-	test/inttypes.c \
-	test/io/table.c \
-	test/main.c \
-	test/mem.c \
-	test/perf.c \
-	test/perm.c \
-	test/qsort.c \
-	test/sprintf.c \
-	test/stdio/scanf.c \
-	test/stdio.c \
-	test/stdlib.c \
-	test/str.c \
-	test/string.c \
-	test/strtol.c \
-	test/uuid.c
-
-include $(USPACE_PREFIX)/Makefile.common
-
-$(LIBC_PREFIX)/crt0.o: $(LIBC_PREFIX)/arch/$(UARCH)/src/crt0.o
-	cp $< $@
-
-$(LIBC_PREFIX)/crt1.o: $(LIBC_PREFIX)/generic/crt/crt1.o
-	cp $< $@
-
-AUTOCHECK = $(realpath $(ROOT_PATH)/tools/autocheck.awk)
-
-%.check.c: %.h $(AUTOCHECK)
-	cd $(<D) && $(AUTOCHECK) $(<F) > $(@F)
Index: uspace/lib/c/arch/abs32le/Makefile.common
===================================================================
--- uspace/lib/c/arch/abs32le/Makefile.common	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ uspace/lib/c/arch/abs32le/Makefile.common	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -27,3 +27,2 @@
 #
 
-ENDIANESS = LE
Index: uspace/lib/c/arch/amd64/Makefile.common
===================================================================
--- uspace/lib/c/arch/amd64/Makefile.common	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ uspace/lib/c/arch/amd64/Makefile.common	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -36,4 +36,3 @@
 LDFLAGS += -Wl,--gc-sections
 
-ENDIANESS = LE
 
Index: uspace/lib/c/arch/amd64/meson.build
===================================================================
--- uspace/lib/c/arch/amd64/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/c/arch/amd64/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,34 @@
+arch_src += [ autocheck.process('include/libarch/fibril_context.h') ]
+
+arch_src += files(
+	'src/entryjmp.S',
+	'src/thread_entry.S',
+	'src/syscall.S',
+	'src/fibril.S',
+	'src/tls.c',
+	'src/stacktrace.c',
+	'src/stacktrace_asm.S',
+	'src/rtld/dynamic.c',
+	'src/rtld/reloc.c',
+)
+
+arch_start_src = files('src/crt0.S')
+
+rd_essential += [
+	'app/edit',
+	'app/mixerctl',
+	'app/wavplay',
+
+	'srv/audio/hound',
+
+	'drv/intctl/apic',
+	'drv/intctl/i8259',
+	'drv/platform/pc',
+	'drv/block/ata_bd',
+	'drv/bus/pci/pciintel',
+	'drv/bus/isa',
+	'drv/audio/sb16',
+	'drv/char/i8042',
+	'drv/hid/ps2mouse',
+	'drv/hid/xtkbd',
+]
Index: uspace/lib/c/arch/arm32/Makefile.common
===================================================================
--- uspace/lib/c/arch/arm32/Makefile.common	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ uspace/lib/c/arch/arm32/Makefile.common	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -37,4 +37,3 @@
 endif
 
-ENDIANESS = LE
 
Index: uspace/lib/c/arch/arm32/meson.build
===================================================================
--- uspace/lib/c/arch/arm32/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/c/arch/arm32/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,48 @@
+arch_src += files(
+	'src/atomic.c',
+	'src/entryjmp.S',
+	'src/thread_entry.S',
+	'src/syscall.c',
+	'src/fibril.S',
+	'src/tls.c',
+	'src/eabi.S',
+	'src/stacktrace.c',
+	'src/stacktrace_asm.S',
+	'src/rtld/dynamic.c',
+	'src/rtld/reloc.c',
+)
+
+arch_start_src = files('src/crt0.S')
+
+if MACHINE == 'gta02'
+	rd_essential += [
+		'srv/hid/s3c24xx_ts',
+		'srv/hw/char/s3c24xx_uart',
+	]
+
+elif MACHINE == 'beagleboardxm' or MACHINE == 'beaglebone'
+	rd_essential += [
+		'drv/platform/amdm37x',
+		'drv/fb/amdm37x_dispc',
+	]
+
+elif MACHINE == 'integratorcp'
+	rd_essential += [
+		'drv/char/pl050',
+		'drv/hid/atkbd',
+		'drv/hid/ps2mouse',
+		'drv/intctl/icp-ic',
+		'drv/platform/icp',
+	]
+endif
+
+rd_essential += [
+	'drv/bus/usb/ehci',
+	'drv/bus/usb/ohci',
+	'drv/bus/usb/usbdiag',
+	'drv/bus/usb/usbflbk',
+	'drv/bus/usb/usbhub',
+	'drv/bus/usb/usbmid',
+	'drv/block/usbmast',
+	'drv/hid/usbhid',
+]
Index: uspace/lib/c/arch/arm64/Makefile.common
===================================================================
--- uspace/lib/c/arch/arm64/Makefile.common	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ uspace/lib/c/arch/arm64/Makefile.common	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -31,4 +31,3 @@
 LDFLAGS += -Wl,--gc-sections
 
-ENDIANESS = LE
 
Index: uspace/lib/c/arch/arm64/meson.build
===================================================================
--- uspace/lib/c/arch/arm64/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/c/arch/arm64/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,21 @@
+arch_src += [ autocheck.process('include/libarch/fibril_context.h') ]
+
+arch_src += files(
+	'src/entryjmp.S',
+	'src/fibril.S',
+	'src/stacktrace.c',
+	'src/stacktrace_asm.S',
+	'src/syscall.c',
+	'src/tls.c',
+	'src/thread_entry.S',
+)
+
+arch_start_src = files('src/crt0.S')
+
+if MACHINE == 'virt'
+	rd_essential += [
+		'drv/char/pl011',
+		'drv/intctl/gicv2',
+		'drv/platform/arm64virt',
+	]
+endif
Index: uspace/lib/c/arch/ia32/Makefile.common
===================================================================
--- uspace/lib/c/arch/ia32/Makefile.common	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,43 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-ifeq ($(PROCESSOR),i486)
-	COMMON_CFLAGS += -march=i486
-else
-	COMMON_CFLAGS += -march=pentium
-endif
-
-# XXX: This architecture requires unoptimized TLS pointer access,
-#      as with the GCC option `-mno-tls-direct-seg-refs`.
-#      The `i686-helenos` target defaults to this behavior.
-
-COMMON_CFLAGS += -mno-tls-direct-seg-refs -fno-omit-frame-pointer
-LDFLAGS += -Wl,--gc-sections
-
-ENDIANESS = LE
-
Index: uspace/lib/c/arch/ia32/Makefile.inc
===================================================================
--- uspace/lib/c/arch/ia32/Makefile.inc	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,41 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-ARCH_SOURCES = \
-	arch/$(UARCH)/src/entryjmp.S \
-	arch/$(UARCH)/src/thread_entry.S \
-	arch/$(UARCH)/src/syscall.S \
-	arch/$(UARCH)/src/fibril.S \
-	arch/$(UARCH)/src/tls.c \
-	arch/$(UARCH)/src/stacktrace.c \
-	arch/$(UARCH)/src/stacktrace_asm.S \
-	arch/$(UARCH)/src/rtld/dynamic.c \
-	arch/$(UARCH)/src/rtld/reloc.c
-
-ARCH_AUTOCHECK_HEADERS = \
-	arch/$(UARCH)/include/libarch/fibril_context.h
Index: uspace/lib/c/arch/ia32/meson.build
===================================================================
--- uspace/lib/c/arch/ia32/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/c/arch/ia32/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,37 @@
+arch_src += [ autocheck.process('include/libarch/fibril_context.h') ]
+
+arch_src += files(
+	'src/entryjmp.S',
+	'src/thread_entry.S',
+	'src/syscall.S',
+	'src/fibril.S',
+	'src/tls.c',
+	'src/stacktrace.c',
+	'src/stacktrace_asm.S',
+	'src/rtld/dynamic.c',
+	'src/rtld/reloc.c',
+)
+
+arch_start_src = files('src/crt0.S')
+
+if MACHINE == 'bmalta' or MACHINE == 'lmalta'
+	rd_essential += [
+		'drv/platform/malta',
+		'drv/intctl/i8259',
+		'drv/block/ata_bd',
+		'drv/bus/pci/pciintel',
+		'drv/bus/isa',
+		'drv/char/i8042',
+		'drv/char/ns8250',
+		'drv/hid/ps2mouse',
+		'drv/hid/xtkbd',
+	]
+
+elif MACHINE == 'msim'
+	rd_essential += [
+		'drv/platform/msim',
+		'drv/block/ddisk',
+		'drv/char/msim-con',
+	]
+
+endif
Index: uspace/lib/c/arch/ia64/Makefile.common
===================================================================
--- uspace/lib/c/arch/ia64/Makefile.common	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ uspace/lib/c/arch/ia64/Makefile.common	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -30,4 +30,3 @@
 LDFLAGS += -Wl,--gc-sections
 
-ENDIANESS = LE
 
Index: uspace/lib/c/arch/ia64/meson.build
===================================================================
--- uspace/lib/c/arch/ia64/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/c/arch/ia64/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,31 @@
+arch_src = [ autocheck.process('include/libarch/fibril_context.h') ]
+
+arch_src += files(
+	'src/entryjmp.S',
+	'src/thread_entry.S',
+	'src/syscall.S',
+	'src/fibril.S',
+	'src/tls.c',
+	'src/ddi.c',
+	'src/stacktrace.c',
+	'src/stacktrace_asm.S',
+)
+
+arch_start_src = files('src/crt0.S')
+
+if MACHINE == 'i460GX'
+	rd_essential += [
+		'drv/platform/pc',
+		'drv/bus/pci/pciintel',
+		'drv/bus/isa',
+		'drv/char/i8042',
+		'drv/hid/xtkbd',
+	]
+
+elif MACHINE == 'ski'
+	rd_essential += [
+		'drv/char/ski-con',
+		'drv/platform/ski',
+	]
+
+endif
Index: uspace/lib/c/arch/mips32/Makefile.common
===================================================================
--- uspace/lib/c/arch/mips32/Makefile.common	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ uspace/lib/c/arch/mips32/Makefile.common	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -32,15 +32,12 @@
 
 ifeq ($(MACHINE),msim)
-	ENDIANESS = LE
 	COMMON_CFLAGS += -march=r4000
 endif
 
 ifeq ($(MACHINE),lmalta)
-	ENDIANESS = LE
 	COMMON_CFLAGS += -march=4kc
 endif
 
 ifeq ($(MACHINE),bmalta)
-	ENDIANESS = BE
 	COMMON_CFLAGS += -march=4kc
 endif
Index: uspace/lib/c/arch/mips32/meson.build
===================================================================
--- uspace/lib/c/arch/mips32/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/c/arch/mips32/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,37 @@
+arch_src += [ autocheck.process('include/libarch/fibril_context.h') ]
+
+arch_src += files(
+	'src/entryjmp.S',
+	'src/thread_entry.S',
+	'src/syscall.c',
+	'src/fibril.S',
+	'src/tls.c',
+	'src/stacktrace.c',
+	'src/stacktrace_asm.S',
+)
+
+as_prolog = '.module softfloat;.abicalls;'
+
+arch_start_src = files('src/crt0.S')
+
+if MACHINE == 'bmalta' or MACHINE == 'lmalta'
+	rd_essential += [
+		'drv/platform/malta',
+		'drv/intctl/i8259',
+		'drv/block/ata_bd',
+		'drv/bus/pci/pciintel',
+		'drv/bus/isa',
+		'drv/char/i8042',
+		'drv/char/ns8250',
+		'drv/hid/ps2mouse',
+		'drv/hid/xtkbd',
+	]
+
+elif MACHINE == 'msim'
+	rd_essential += [
+		'drv/platform/msim',
+		'drv/block/ddisk',
+		'drv/char/msim-con',
+	]
+
+endif
Index: uspace/lib/c/arch/ppc32/Makefile.common
===================================================================
--- uspace/lib/c/arch/ppc32/Makefile.common	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ uspace/lib/c/arch/ppc32/Makefile.common	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -36,4 +36,3 @@
 LDFLAGS += -Wl,--gc-sections -Wl,-z,max-page-size=0x1000
 
-ENDIANESS = BE
 
Index: uspace/lib/c/arch/ppc32/meson.build
===================================================================
--- uspace/lib/c/arch/ppc32/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/c/arch/ppc32/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,31 @@
+arch_src += [ autocheck.process('include/libarch/fibril_context.h') ]
+
+arch_src += files(
+	'src/entryjmp.S',
+	'src/thread_entry.S',
+	'src/syscall.c',
+	'src/fibril.S',
+	'src/tls.c',
+	'src/stacktrace.c',
+	'src/stacktrace_asm.S',
+	'src/rtld/dynamic.c',
+	'src/rtld/reloc.c',
+)
+
+arch_start_src = files('src/crt0.S')
+
+rd_essential += [
+	'drv/platform/mac',
+	'drv/bus/adb/cuda_adb',
+	'drv/bus/pci/pciintel',
+	'drv/bus/usb/ohci',
+	'drv/bus/usb/usbdiag',
+	'drv/bus/usb/usbflbk',
+	'drv/bus/usb/usbhub',
+	'drv/bus/usb/usbmid',
+	'drv/bus/usb/vhc',
+	'drv/block/usbmast',
+	'drv/hid/adb-kbd',
+	'drv/hid/adb-mouse',
+	'drv/hid/usbhid',
+]
Index: uspace/lib/c/arch/riscv64/Makefile.common
===================================================================
--- uspace/lib/c/arch/riscv64/Makefile.common	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ uspace/lib/c/arch/riscv64/Makefile.common	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -27,4 +27,3 @@
 #
 
-ENDIANESS = LE
 
Index: uspace/lib/c/arch/sparc64/Makefile.common
===================================================================
--- uspace/lib/c/arch/sparc64/Makefile.common	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ uspace/lib/c/arch/sparc64/Makefile.common	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -37,5 +37,4 @@
 LDFLAGS += -Wl,-no-check-sections,--gc-sections
 
-ENDIANESS = BE
 
 
Index: uspace/lib/c/meson.build
===================================================================
--- uspace/lib/c/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/c/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,219 @@
+# libarch
+arch_src = []
+subdir(join_paths('arch', h_arch))
+
+c_args = [ '-fno-builtin', '-D_LIBC_SOURCE' ]
+
+root_path = '..' / '..' / '..'
+
+incdirs = [
+	'include',
+	'arch' / h_arch / 'include',
+	root_path / 'abi' / 'arch' / h_arch / 'include',
+	root_path / 'abi' / 'include',
+]
+
+includes += include_directories(incdirs, is_system: true)
+
+allow_shared = true
+
+# FIXME: symlinks from uspace to kernel will break in future Meson version
+#        we should instead move the duplicated library parts into a shared location.
+
+if CONFIG_DEVEL_FILES
+	foreach idir : incdirs
+		install_subdir(idir, install_dir: 'include' / 'libc', strip_directory: true)
+	endforeach
+endif
+
+src = [ arch_src ]
+
+src += files(
+	'generic/libc.c',
+	'generic/ddi.c',
+	'generic/as.c',
+	'generic/bd.c',
+	'generic/bd_srv.c',
+	'generic/perm.c',
+	'generic/cap.c',
+	'generic/clipboard.c',
+	'generic/config.c',
+	'generic/context.c',
+	'generic/corecfg.c',
+	'generic/ctype.c',
+	'generic/devman.c',
+	'generic/device/hw_res.c',
+	'generic/device/hw_res_parsed.c',
+	'generic/device/pio_window.c',
+	'generic/device/clock_dev.c',
+	'generic/device/led_dev.c',
+	'generic/dirent.c',
+	'generic/dhcp.c',
+	'generic/dnsr.c',
+	'generic/dlfcn.c',
+	'generic/elf/elf.c',
+	'generic/elf/elf_load.c',
+	'generic/elf/elf_mod.c',
+	'generic/event.c',
+	'generic/errno.c',
+	'generic/gsort.c',
+	'generic/inttypes.c',
+	'generic/ipc_test.c',
+	'generic/loc.c',
+	'generic/mem.c',
+	'generic/str.c',
+	'generic/string.c',
+	'generic/str_error.c',
+	'generic/strtol.c',
+	'generic/l18n/langs.c',
+	'generic/pcb.c',
+	'generic/smc.c',
+	'generic/task.c',
+	'generic/imath.c',
+	'generic/inet/addr.c',
+	'generic/inet/endpoint.c',
+	'generic/inet/host.c',
+	'generic/inet/hostname.c',
+	'generic/inet/hostport.c',
+	'generic/inet/tcp.c',
+	'generic/inet/udp.c',
+	'generic/inet.c',
+	'generic/inetcfg.c',
+	'generic/inetping.c',
+	'generic/io/asprintf.c',
+	'generic/io/input.c',
+	'generic/io/io.c',
+	'generic/io/chardev.c',
+	'generic/io/chardev_srv.c',
+	'generic/io/chargrid.c',
+	'generic/io/output.c',
+	'generic/io/printf.c',
+	'generic/io/log.c',
+	'generic/io/logctl.c',
+	'generic/io/label.c',
+	'generic/io/kio.c',
+	'generic/io/klog.c',
+	'generic/io/serial.c',
+	'generic/io/snprintf.c',
+	'generic/io/vprintf.c',
+	'generic/io/vsnprintf.c',
+	'generic/io/printf_core.c',
+	'generic/io/con_srv.c',
+	'generic/io/console.c',
+	'generic/io/table.c',
+	'generic/io/visualizer.c',
+	'generic/io/window.c',
+	'generic/iplink.c',
+	'generic/iplink_srv.c',
+	'generic/irc.c',
+	'generic/irq.c',
+	'generic/ieee_double.c',
+	'generic/power_of_ten.c',
+	'generic/double_to_str.c',
+	'generic/malloc.c',
+	'generic/rndgen.c',
+	'generic/stdio/scanf.c',
+	'generic/stdio/sprintf.c',
+	'generic/stdio/sscanf.c',
+	'generic/stdio/sstream.c',
+	'generic/stdio/vsprintf.c',
+	'generic/thread/fibril.c',
+	'generic/thread/fibril_synch.c',
+	'generic/thread/thread.c',
+	'generic/thread/tls.c',
+	'generic/thread/futex.c',
+	'generic/thread/mpsc.c',
+	'generic/sysinfo.c',
+	'generic/ipc.c',
+	'generic/ns.c',
+	'generic/async/client.c',
+	'generic/async/server.c',
+	'generic/async/ports.c',
+	'generic/loader.c',
+	'generic/getopt.c',
+	'generic/adt/checksum.c',
+	'generic/adt/circ_buf.c',
+	'generic/adt/list.c',
+	'generic/adt/hash_table.c',
+	'generic/adt/odict.c',
+	'generic/adt/prodcons.c',
+	'generic/time.c',
+	'generic/tmpfile.c',
+	'generic/stdio.c',
+	'generic/stdlib.c',
+	'generic/udebug.c',
+	'generic/vfs/canonify.c',
+	'generic/vfs/inbox.c',
+	'generic/vfs/mtab.c',
+	'generic/vfs/vfs.c',
+	'generic/setjmp.c',
+	'generic/stack.c',
+	'generic/stacktrace.c',
+	'generic/arg_parse.c',
+	'generic/stats.c',
+	'generic/assert.c',
+	'generic/bsearch.c',
+	'generic/pci.c',
+	'generic/pio_trace.c',
+	'generic/qsort.c',
+	'generic/ubsan.c',
+	'generic/uuid.c',
+	'generic/vbd.c',
+	'generic/vol.c',
+)
+
+if CONFIG_RTLD
+	src += files(
+		'generic/rtld/rtld.c',
+		'generic/rtld/dynamic.c',
+		'generic/rtld/module.c',
+		'generic/rtld/symbol.c',
+	)
+endif
+
+test_src = files(
+	'test/adt/circ_buf.c',
+	'test/adt/odict.c',
+	'test/cap.c',
+	'test/casting.c',
+	'test/double_to_str.c',
+	'test/fibril/timer.c',
+	'test/getopt.c',
+	'test/gsort.c',
+	'test/ieee_double.c',
+	'test/imath.c',
+	'test/inttypes.c',
+	'test/io/table.c',
+	'test/main.c',
+	'test/mem.c',
+	'test/perf.c',
+	'test/perm.c',
+	'test/qsort.c',
+	'test/sprintf.c',
+	'test/stdio/scanf.c',
+	'test/stdio.c',
+	'test/stdlib.c',
+	'test/str.c',
+	'test/string.c',
+	'test/strtol.c',
+	'test/uuid.c',
+)
+
+# Startfiles.
+# This is what other systems know as crt*.o files, i.e. a set of object files
+# that are automatically built into every program binary (but not libraries).
+# We haven't yet installed the object files where the compiler can find them,
+# so we have to add them manually.
+#
+
+start_src = [ arch_start_src, files('generic/crt/crt1.c') ]
+
+libstartfiles = static_library('startfiles', start_src,
+	include_directories: includes,
+	c_args: c_args,
+	install: CONFIG_DEVEL_FILES,
+	install_dir: 'lib',
+	pic: false,
+)
+
+startfiles = libstartfiles.extract_all_objects()
Index: uspace/lib/clui/Makefile
===================================================================
--- uspace/lib/clui/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#
-# Copyright (c) 2010 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libclui
-
-SOURCES = \
-	nchoice.c \
-	tinput.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/clui/meson.build
===================================================================
--- uspace/lib/clui/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/clui/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,4 @@
+src = files(
+	'nchoice.c',
+	'tinput.c',
+)
Index: uspace/lib/compress/Makefile
===================================================================
--- uspace/lib/compress/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#
-# Copyright (c) 2014 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libcompress
-
-SOURCES = \
-	inflate.c \
-	gzip.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/compress/meson.build
===================================================================
--- uspace/lib/compress/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/compress/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,4 @@
+src = files(
+	'inflate.c',
+	'gzip.c',
+)
Index: uspace/lib/cpp/Makefile
===================================================================
--- uspace/lib/cpp/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,81 +1,0 @@
-#
-# Copyright (c) 2018 Jaroslav Jindrak
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-ROOT_PATH = $(USPACE_PREFIX)/..
-
-CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
-
-LIBRARY = libcpp
-SOVERSION = 0.0
-
--include $(CONFIG_MAKEFILE)
-
-SOURCES = \
-	src/condition_variable.cpp \
-	src/exception.cpp \
-	src/future.cpp \
-	src/iomanip.cpp \
-	src/ios.cpp \
-	src/iostream.cpp \
-	src/locale.cpp \
-	src/mutex.cpp \
-	src/new.cpp \
-	src/refcount_obj.cpp \
-	src/shared_mutex.cpp \
-	src/stdexcept.cpp \
-	src/string.cpp \
-	src/system_error.cpp \
-	src/thread.cpp \
-	src/typeindex.cpp \
-	src/typeinfo.cpp \
-	src/__bits/runtime.cpp \
-	src/__bits/trycatch.cpp \
-	src/__bits/unwind.cpp \
-	src/__bits/test/algorithm.cpp \
-	src/__bits/test/adaptors.cpp \
-	src/__bits/test/array.cpp \
-	src/__bits/test/bitset.cpp \
-	src/__bits/test/deque.cpp \
-	src/__bits/test/functional.cpp \
-	src/__bits/test/future.cpp \
-	src/__bits/test/list.cpp \
-	src/__bits/test/map.cpp \
-	src/__bits/test/memory.cpp \
-	src/__bits/test/mock.cpp \
-	src/__bits/test/numeric.cpp \
-	src/__bits/test/ratio.cpp \
-	src/__bits/test/set.cpp \
-	src/__bits/test/string.cpp \
-	src/__bits/test/test.cpp \
-	src/__bits/test/tuple.cpp \
-	src/__bits/test/unordered_map.cpp \
-	src/__bits/test/unordered_set.cpp \
-	src/__bits/test/vector.cpp
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/cpp/meson.build
===================================================================
--- uspace/lib/cpp/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/cpp/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,44 @@
+language = 'cpp'
+allow_shared = true
+src = files(
+	'src/condition_variable.cpp',
+	'src/exception.cpp',
+	'src/future.cpp',
+	'src/iomanip.cpp',
+	'src/ios.cpp',
+	'src/iostream.cpp',
+	'src/locale.cpp',
+	'src/mutex.cpp',
+	'src/new.cpp',
+	'src/refcount_obj.cpp',
+	'src/shared_mutex.cpp',
+	'src/stdexcept.cpp',
+	'src/string.cpp',
+	'src/system_error.cpp',
+	'src/thread.cpp',
+	'src/typeindex.cpp',
+	'src/typeinfo.cpp',
+	'src/__bits/runtime.cpp',
+	'src/__bits/trycatch.cpp',
+	'src/__bits/unwind.cpp',
+	'src/__bits/test/algorithm.cpp',
+	'src/__bits/test/adaptors.cpp',
+	'src/__bits/test/array.cpp',
+	'src/__bits/test/bitset.cpp',
+	'src/__bits/test/deque.cpp',
+	'src/__bits/test/functional.cpp',
+	'src/__bits/test/future.cpp',
+	'src/__bits/test/list.cpp',
+	'src/__bits/test/map.cpp',
+	'src/__bits/test/memory.cpp',
+	'src/__bits/test/mock.cpp',
+	'src/__bits/test/numeric.cpp',
+	'src/__bits/test/ratio.cpp',
+	'src/__bits/test/set.cpp',
+	'src/__bits/test/string.cpp',
+	'src/__bits/test/test.cpp',
+	'src/__bits/test/tuple.cpp',
+	'src/__bits/test/unordered_map.cpp',
+	'src/__bits/test/unordered_set.cpp',
+	'src/__bits/test/vector.cpp',
+)
Index: uspace/lib/crypto/Makefile
===================================================================
--- uspace/lib/crypto/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,38 +1,0 @@
-#
-# Copyright (c) 2015 Jan Kolarik
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libcrypto
-
-SOURCES = \
-	crypto.c \
-	aes.c \
-	rc4.c \
-	crc16_ibm.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/crypto/meson.build
===================================================================
--- uspace/lib/crypto/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/crypto/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,6 @@
+src = files(
+	'crypto.c',
+	'aes.c',
+	'rc4.c',
+	'crc16_ibm.c',
+)
Index: uspace/lib/dltest/Makefile
===================================================================
--- uspace/lib/dltest/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#
-# Copyright (c) 2016 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libdltest
-SOVERSION = 0.0
-
-SOURCES = \
-	dltest.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/dltest/meson.build
===================================================================
--- uspace/lib/dltest/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/dltest/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,7 @@
+allow_shared = true
+src = files(
+	'dltest.c',
+)
+
+# For dltests app.
+libdltest_includes = include_directories('.')
Index: uspace/lib/draw/Makefile
===================================================================
--- uspace/lib/draw/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,50 +1,0 @@
-#
-# Copyright (c) 2011 Petr Koupy
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libdraw
-LIBS = softrend compress
-
-SOURCES = \
-	codec/tga.c \
-	codec/tga.gz.c \
-	codec/webp.c \
-	cursor/embedded.c \
-	font/embedded.c \
-	font/bitmap_backend.c \
-	font/pcf.c \
-	gfx/font-8x16.c \
-	gfx/cursor-11x18.c \
-	drawctx.c \
-	cursor.c \
-	font.c \
-	path.c \
-	source.c \
-	surface.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/draw/meson.build
===================================================================
--- uspace/lib/draw/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/draw/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,18 @@
+deps = [ 'softrend' , 'compress' ]
+src = files(
+	'codec/tga.c',
+	'codec/tga.gz.c',
+	'codec/webp.c',
+	'cursor/embedded.c',
+	'font/embedded.c',
+	'font/bitmap_backend.c',
+	'font/pcf.c',
+	'gfx/font-8x16.c',
+	'gfx/cursor-11x18.c',
+	'drawctx.c',
+	'cursor.c',
+	'font.c',
+	'path.c',
+	'source.c',
+	'surface.c',
+)
Index: uspace/lib/drv/Makefile
===================================================================
--- uspace/lib/drv/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,57 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-EXTRA_CFLAGS = -Igeneric/private
-LIBRARY = libdrv
-LIBS = pcm
-
-SOURCES = \
-	generic/driver.c \
-	generic/dev_iface.c \
-	generic/interrupt.c \
-	generic/log.c \
-	generic/logbuf.c \
-	generic/remote_audio_mixer.c \
-	generic/remote_audio_pcm.c \
-	generic/remote_hw_res.c \
-	generic/remote_pio_window.c \
-	generic/remote_nic.c \
-	generic/remote_ieee80211.c \
-	generic/remote_usb.c \
-	generic/remote_pci.c \
-	generic/remote_usbdiag.c \
-	generic/remote_usbhc.c \
-	generic/remote_usbhid.c \
-	generic/remote_clock_dev.c \
-	generic/remote_led_dev.c \
-	generic/remote_battery_dev.c \
-	generic/remote_ahci.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/drv/meson.build
===================================================================
--- uspace/lib/drv/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/drv/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,24 @@
+deps = [ 'pcm' ]
+private_includes += include_directories('generic/private')
+src = files(
+	'generic/driver.c',
+	'generic/dev_iface.c',
+	'generic/interrupt.c',
+	'generic/log.c',
+	'generic/logbuf.c',
+	'generic/remote_audio_mixer.c',
+	'generic/remote_audio_pcm.c',
+	'generic/remote_hw_res.c',
+	'generic/remote_pio_window.c',
+	'generic/remote_nic.c',
+	'generic/remote_ieee80211.c',
+	'generic/remote_usb.c',
+	'generic/remote_pci.c',
+	'generic/remote_usbdiag.c',
+	'generic/remote_usbhc.c',
+	'generic/remote_usbhid.c',
+	'generic/remote_clock_dev.c',
+	'generic/remote_led_dev.c',
+	'generic/remote_battery_dev.c',
+	'generic/remote_ahci.c',
+)
Index: uspace/lib/ext4/Makefile
===================================================================
--- uspace/lib/ext4/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,47 +1,0 @@
-#
-# Copyright (c) 2012 Frantisek Princ
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libext4
-LIBS = block crypto fs
-
-SOURCES = \
-	src/balloc.c \
-	src/bitmap.c \
-	src/block_group.c \
-	src/directory.c \
-	src/directory_index.c \
-	src/extent.c \
-	src/filesystem.c \
-	src/hash.c \
-	src/ialloc.c \
-	src/inode.c \
-	src/ops.c \
-	src/superblock.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/ext4/meson.build
===================================================================
--- uspace/lib/ext4/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/ext4/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,15 @@
+deps = [ 'block' , 'crypto' , 'fs' ]
+src = files(
+	'src/balloc.c',
+	'src/bitmap.c',
+	'src/block_group.c',
+	'src/directory.c',
+	'src/directory_index.c',
+	'src/extent.c',
+	'src/filesystem.c',
+	'src/hash.c',
+	'src/ialloc.c',
+	'src/inode.c',
+	'src/ops.c',
+	'src/superblock.c',
+)
Index: uspace/lib/fdisk/Makefile
===================================================================
--- uspace/lib/fdisk/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#
-# Copyright (c) 2015 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-
-LIBRARY = libfdisk
-
-SOURCES = \
-	src/fdisk.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/fdisk/meson.build
===================================================================
--- uspace/lib/fdisk/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/fdisk/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,1 @@
+src = files('src/fdisk.c')
Index: uspace/lib/fmtutil/Makefile
===================================================================
--- uspace/lib/fmtutil/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,35 +1,0 @@
-#
-# Copyright (c) 2011 Martin Sucha
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libfmtutil
-
-SOURCES = \
-	fmtutil.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/fmtutil/meson.build
===================================================================
--- uspace/lib/fmtutil/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/fmtutil/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,1 @@
+src = files('fmtutil.c')
Index: uspace/lib/fs/Makefile
===================================================================
--- uspace/lib/fs/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libfs
-
-SOURCES = \
-	libfs.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/fs/meson.build
===================================================================
--- uspace/lib/fs/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/fs/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,1 @@
+src = files('libfs.c')
Index: uspace/lib/graph/Makefile
===================================================================
--- uspace/lib/graph/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,35 +1,0 @@
-#
-# Copyright (c) 2011 Petr Koupy
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libgraph
-
-SOURCES = \
-	graph.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/graph/meson.build
===================================================================
--- uspace/lib/graph/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/graph/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,1 @@
+src = files('graph.c')
Index: uspace/lib/gui/Makefile
===================================================================
--- uspace/lib/gui/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,45 +1,0 @@
-#
-# Copyright (c) 2012 Petr Koupy
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libgui
-LIBS = draw softrend graph
-
-SOURCES = \
-	common.c \
-	button.c \
-	canvas.c \
-	connection.c \
-	grid.c \
-	label.c \
-	minimal.c \
-	terminal.c \
-	widget.c \
-	window.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/gui/meson.build
===================================================================
--- uspace/lib/gui/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/gui/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,13 @@
+deps = [ 'draw' , 'softrend' , 'graph' ]
+src = files(
+	'common.c',
+	'button.c',
+	'canvas.c',
+	'connection.c',
+	'grid.c',
+	'label.c',
+	'minimal.c',
+	'terminal.c',
+	'widget.c',
+	'window.c',
+)
Index: uspace/lib/hound/Makefile
===================================================================
--- uspace/lib/hound/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,38 +1,0 @@
-#
-# Copyright (c) 2012 Jan Vesely
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-EXTRA_CFLAGS = -Iinclude/hound
-LIBRARY = libhound
-LIBS = pcm
-
-SOURCES = \
-	src/protocol.c \
-	src/client.c
-include $(USPACE_PREFIX)/Makefile.common
-
Index: uspace/lib/hound/meson.build
===================================================================
--- uspace/lib/hound/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/hound/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,6 @@
+deps = [ 'pcm' ]
+private_includes += include_directories('include/hound')
+src = files(
+	'src/protocol.c',
+	'src/client.c',
+)
Index: uspace/lib/http/Makefile
===================================================================
--- uspace/lib/http/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#
-# Copyright (c) 2013 Martin Sucha
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libhttp
-EXTRA_CFLAGS += -Iinclude
-
-SOURCES = \
-	src/http.c \
-	src/headers.c \
-	src/request.c \
-	src/response.c \
-	src/receive-buffer.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/http/meson.build
===================================================================
--- uspace/lib/http/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/http/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,7 @@
+src = files(
+	'src/http.c',
+	'src/headers.c',
+	'src/request.c',
+	'src/response.c',
+	'src/receive-buffer.c',
+)
Index: uspace/lib/ieee80211/Makefile
===================================================================
--- uspace/lib/ieee80211/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,38 +1,0 @@
-#
-# Copyright (c) 2015 Jan Kolarik
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libieee80211
-LIBS = drv nic crypto
-
-SOURCES = \
-	src/ieee80211.c \
-	src/ieee80211_impl.c \
-	src/ieee80211_iface_impl.c \
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/ieee80211/meson.build
===================================================================
--- uspace/lib/ieee80211/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/ieee80211/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,6 @@
+deps = [ 'drv' , 'nic' , 'crypto' ]
+src = files(
+	'src/ieee80211.c',
+	'src/ieee80211_impl.c',
+	'src/ieee80211_iface_impl.c',
+)
Index: uspace/lib/label/Makefile
===================================================================
--- uspace/lib/label/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,44 +1,0 @@
-#
-# Copyright (c) 2015 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-
-LIBRARY = liblabel
-
-SOURCES = \
-	src/dummy.c \
-	src/empty.c \
-	src/mbr.c \
-	src/gpt.c \
-	src/label.c
-
-TEST_SOURCES = \
-	test/main.c \
-	test/label.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/label/meson.build
===================================================================
--- uspace/lib/label/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/label/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,12 @@
+src = files(
+	'src/dummy.c',
+	'src/empty.c',
+	'src/mbr.c',
+	'src/gpt.c',
+	'src/label.c',
+)
+
+test_src = files(
+	'test/main.c',
+	'test/label.c',
+)
Index: uspace/lib/math/Makefile
===================================================================
--- uspace/lib/math/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,54 +1,0 @@
-#
-# Copyright (c) 2013 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-ROOT_PATH = $(USPACE_PREFIX)/..
-
-LIBRARY = libmath
-SOVERSION = 0.0
-
-SOURCES = \
-	generic/__fcompare.c \
-	generic/__fpclassify.c \
-	generic/__signbit.c \
-	generic/fabs.c \
-	generic/fmod.c \
-	generic/fmodf.c \
-	generic/nearbyint.c \
-	generic/round.c \
-	generic/trig.c \
-	generic/sin.c \
-	generic/cos.c \
-	generic/sincos.c \
-	generic/trunc.c
-
-TEST_SOURCES = \
-	test/rounding.c \
-	test/main.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/math/meson.build
===================================================================
--- uspace/lib/math/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/math/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,23 @@
+allow_shared = true
+
+src = files(
+	'generic/__fcompare.c',
+	'generic/__fpclassify.c',
+	'generic/__signbit.c',
+	'generic/cos.c',
+	'generic/fabs.c',
+	'generic/fmod.c',
+	'generic/fmodf.c',
+	'generic/nearbyint.c',
+	'generic/round.c',
+	'generic/trig.c',
+	'generic/sin.c',
+	'generic/cos.c',
+	'generic/sincos.c',
+	'generic/trunc.c',
+)
+
+test_src = files(
+	'test/rounding.c',
+	'test/main.c',
+)
Index: uspace/lib/meson.build
===================================================================
--- uspace/lib/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,310 @@
+always_static = (get_option('default_library') == 'static')
+
+# Redefined in libarch, if necessary.
+# Used in a few places where we generate custom assembly.
+as_prolog = ''
+
+# Which libraries are installed when CONFIG_DEVEL_FILES is enabled
+installed_libs = [
+	'c',
+	'math',
+	'gui',
+	'draw',
+	'softrend',
+	'posix',
+]
+
+# IMPORTANT: Dependencies must be listed before libs that depend on them.
+libs = [
+	'c',
+
+	'block',
+	'clui',
+	'compress',
+	'cpp',
+	'crypto',
+	'dltest',
+	'fdisk',
+	'fmtutil',
+	'fs',
+	'graph',
+	'http',
+	'label',
+	'math',
+	'minix',
+	'nettl',
+	'pcm',
+	'pcut',
+	'posix',
+	'scsi',
+	'sif',
+	'softrend',
+	'trackmod',
+	'untar',
+	'uri',
+
+	'bithenge',
+	'draw',
+	'drv',
+	'ext4',
+	'gui',
+	'hound',
+	'nic',
+	'usb',
+	'usbdev',
+	'usbhid',
+	'usbhost',
+	'usbvirt',
+	'virtio',
+
+	'ieee80211',
+]
+
+# Generated list of include directory paths
+include_paths = []
+
+# Generated list of test sources
+testfiles = []
+
+foreach l : libs
+	# Variables that might be defined in library meson files:
+
+	# List of source files.
+	# To set it correctly, use files('list.c', 'of.c', 'files.c')
+	# Often this is the only variable that needs to be set.
+	src = files()
+
+	# Public include directories. These are used by everyone who depends
+	# on this library.
+	# Use include_directories('include_dir1', 'include_dir2') to set this.
+	# If the variable is omitted, it defaults to 'include' subdirectory
+	# if it exists, or the source directory otherwise.
+	# If the library has no headers, you can use
+	# includes += include_directories()
+	includes = []
+
+	# Private include directories.
+	# Unnecessary if you always include private headers using relative
+	# paths, but may be useful if you need to override system headers.
+	private_includes = []
+
+	# List of dependency names.
+	# E.g. to use libnic and libuntar use
+	# `deps = [ 'nic', 'untar' ]`
+	deps = []
+
+	# Extra arguments for the C compiler.
+	# Don't use for arguments involving file paths.
+	c_args = []
+
+	# Shared object version of the library.
+	version = '0.0'
+
+	# Sources of unit tests.
+	# Automatically get compiled into a test binary,
+	# but not into the library itself.
+	test_src = []
+
+	# Language of the library.
+	# Currently supported options are 'c' and 'cpp', with 'c' being default.
+	language = 'c'
+
+	# Whether the library can be dynamically linked.
+	# Eventually, all libraries will be shared by default and this will go away.
+	allow_shared = false
+
+	subdir(l)
+
+	# Add `include` or `.` subdirectory to include dirs if needed.
+	if includes.length() == 0
+		incdir = join_paths(l, 'include')
+		if run_command('[', '-d', incdir, ']').returncode() == 0
+			includes += include_directories(incdir)
+
+			if CONFIG_DEVEL_FILES and installed_libs.contains(l)
+				install_subdir(l / 'include', install_dir: 'include' / 'lib' + l, strip_directory: true)
+			endif
+		else
+			includes += include_directories(l)
+		endif
+	endif
+
+	# Pretty much everything depends on libc.
+	if l != 'c'
+		deps += 'c'
+	endif
+
+	if language == 'cpp' and l != 'cpp'
+		deps += 'cpp'
+	endif
+
+	# TODO: install mapfile if install_debug_data is true
+	mapfile = meson.current_build_dir() / 'lib' + l + '.map'
+
+	link_args = [ '-Wl,--no-undefined,--no-allow-shlib-undefined' ]
+	# We want linker to generate link map for debugging.
+	link_args += [ '-Wl,-Map,' + mapfile ]
+
+	# Convert strings to dependency objects
+	# TODO: this dependency business is way too convoluted due to issues in current Meson
+	_any_deps = []
+	_static_deps = []
+	_shared_deps = []
+	_include_deps = []
+	foreach s : deps
+		_any_deps += get_variable('lib' + s).get('any')
+		_static_deps += get_variable('lib' + s).get('static')
+		if not always_static
+			_shared_deps += get_variable('lib' + s).get('shared')
+		endif
+		_include_deps += get_variable('lib' + s).get('include')
+	endforeach
+
+	install_static_lib = CONFIG_DEVEL_FILES and installed_libs.contains(l)
+	install_shared_lib = allow_shared
+
+	_shared_dep = disabler()
+
+	if src.length() > 0
+		if not always_static
+			_shared_lib = shared_library(l, src,
+				# TODO: Include private headers using #include "quoted",
+				#       and get rid of private_includes.
+				include_directories: [ private_includes, includes ],
+				dependencies: _shared_deps,
+				c_args: c_args,
+				link_args: link_args,
+				version: version,
+				build_by_default: true,
+				install: install_shared_lib,
+				install_dir: 'lib',
+			)
+
+			if disassemble
+				custom_target('lib' + l + '.disasm',
+					command: [ objdump, '-S', '@INPUT@' ],
+					input: _shared_lib,
+					output: 'lib' + l + '.disasm',
+					capture: true,
+					build_by_default: true,
+					install: install_debug_files,
+					install_dir: join_paths('debug', 'lib'),
+				)
+			endif
+
+			_shared_dep = declare_dependency(
+				link_with: _shared_lib,
+				# TODO: Always use `include` subdirectory for public headers,
+				#       and ditch the variable.
+				include_directories: includes,
+				dependencies: _shared_deps,
+			)
+		endif
+
+		_static_lib = static_library(l, src,
+			# TODO: Include private headers using #include "quoted",
+			#       and get rid of private_includes.
+			include_directories: [ private_includes, includes ],
+			dependencies: _include_deps,
+			c_args: c_args,
+			link_args: link_args,
+			install: install_static_lib,
+			install_dir: 'lib',
+		)
+
+		_static_dep = declare_dependency(
+			link_with: _static_lib,
+			# TODO: Always use `include` subdirectory for public headers,
+			#       and ditch the variable.
+			include_directories: includes,
+			dependencies: _static_deps,
+		)
+
+		if always_static or not allow_shared
+			_any_dep = declare_dependency(
+				link_with: _static_lib,
+				# TODO: Always use `include` subdirectory for public headers,
+				#       and ditch the variable.
+				include_directories: includes,
+				dependencies: _any_deps,
+			)
+		else
+			_any_dep = declare_dependency(
+				link_with: _shared_lib,
+				# TODO: Always use `include` subdirectory for public headers,
+				#       and ditch the variable.
+				include_directories: includes,
+				dependencies: _any_deps,
+			)
+		endif
+
+		_include_dep = declare_dependency(
+			# TODO: Always use `include` subdirectory for public headers,
+			#       and ditch the variable.
+			include_directories: includes,
+			dependencies: _include_deps,
+		)
+	else
+		# Header-only library.
+		_any_dep = declare_dependency(
+			include_directories: includes,
+			dependencies: _any_deps,
+		)
+		_static_dep = declare_dependency(
+			include_directories: includes,
+			dependencies: _static_deps,
+		)
+	endif
+
+	if test_src.length() > 0
+		testfiles += [ {
+			'name': l,
+			'src': test_src,
+			'includes': [ private_includes, includes ],
+		} ]
+	endif
+
+	set_variable('lib' + l, {
+		'any': _any_dep,
+		'static': _static_dep,
+		'shared': _shared_dep,
+		'include': _include_dep,
+	})
+endforeach
+
+if not CONFIG_PCUT_TESTS
+	subdir_done()
+endif
+
+# Test binaries
+foreach test : testfiles
+	_testname = test['name']
+	_libname = _testname.split('-')[0]
+	_ldargs = []
+	_test_binname = 'test-lib' + _testname
+
+	if link_map
+		# We want linker to generate link map for debugging.
+		_ldargs += [ '-Wl,-Map,' + meson.current_build_dir() / _test_binname + '.map' ]
+	endif
+
+	_bin = executable(_test_binname, test.get('src'),
+		include_directories: test.get('includes'),
+		dependencies: [ get_variable('lib' + _libname).get('any'), libpcut.get('any') ],
+		objects: startfiles,
+		install: true,
+		install_dir: 'test',
+		link_args: _ldargs,
+	)
+
+	if disassemble
+		custom_target(_test_binname + '.disasm',
+			command: [ objdump, '-S', '@INPUT@' ],
+			input: _bin,
+			output: _test_binname + '.disasm',
+			capture: true,
+			install: install_debug_files,
+			install_dir: 'debug' / 'test',
+		)
+	endif
+endforeach
Index: uspace/lib/minix/Makefile
===================================================================
--- uspace/lib/minix/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#
-# Copyright (c) 2017 CZ.NIC, z.s.p.o.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libminix
-
-SOURCES = \
-	minix.c
-
-include $(USPACE_PREFIX)/Makefile.common
-
Index: uspace/lib/nettl/Makefile
===================================================================
--- uspace/lib/nettl/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#
-# Copyright (c) 2015 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libnettl
-
-SOURCES = \
-	src/amap.c \
-	src/portrng.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/nettl/meson.build
===================================================================
--- uspace/lib/nettl/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/nettl/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,4 @@
+src = files(
+	'src/amap.c',
+	'src/portrng.c',
+)
Index: uspace/lib/nic/Makefile
===================================================================
--- uspace/lib/nic/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,42 +1,0 @@
-#
-# Copyright (c) 2011 Radim Vansa
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libnic
-EXTRA_CFLAGS += -DLIBNIC_INTERNAL
-LIBS = drv
-
-SOURCES = \
-	src/nic_driver.c \
-	src/nic_ev.c \
-	src/nic_addr_db.c \
-	src/nic_rx_control.c \
-	src/nic_wol_virtues.c \
-	src/nic_impl.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/nic/meson.build
===================================================================
--- uspace/lib/nic/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/nic/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,10 @@
+deps = [ 'drv' ]
+c_args = [ '-DLIBNIC_INTERNAL', ]
+src = files(
+	'src/nic_driver.c',
+	'src/nic_ev.c',
+	'src/nic_addr_db.c',
+	'src/nic_rx_control.c',
+	'src/nic_wol_virtues.c',
+	'src/nic_impl.c',
+)
Index: uspace/lib/pcm/Makefile
===================================================================
--- uspace/lib/pcm/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#
-# Copyright (c) 2012 Jan Vesely
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-EXTRA_CFLAGS = -Iinclude/pcm
-LIBRARY = libpcm
-
-SOURCES = \
-	src/format.c
-include $(USPACE_PREFIX)/Makefile.common
-
-
Index: uspace/lib/pcm/meson.build
===================================================================
--- uspace/lib/pcm/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/pcm/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,4 @@
+private_includes += include_directories('include/pcm')
+src = files(
+	'src/format.c',
+)
Index: uspace/lib/pcut/Makefile
===================================================================
--- uspace/lib/pcut/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,39 +1,0 @@
-#
-# This file was generated by call to update-from-master.sh
-#
-
-USPACE_PREFIX = ../..
-PCUT_TEST_PREFIX = test-libpcut-
-
-SELF_TESTS = \
-	$(PCUT_TEST_PREFIX)abort$(PCUT_TEST_SUFFIX) \
-	$(PCUT_TEST_PREFIX)asserts$(PCUT_TEST_SUFFIX) \
-	$(PCUT_TEST_PREFIX)beforeafter$(PCUT_TEST_SUFFIX) \
-	$(PCUT_TEST_PREFIX)errno$(PCUT_TEST_SUFFIX) \
-	$(PCUT_TEST_PREFIX)inithook$(PCUT_TEST_SUFFIX) \
-	$(PCUT_TEST_PREFIX)manytests$(PCUT_TEST_SUFFIX) \
-	$(PCUT_TEST_PREFIX)multisuite$(PCUT_TEST_SUFFIX) \
-	$(PCUT_TEST_PREFIX)preinithook$(PCUT_TEST_SUFFIX) \
-	$(PCUT_TEST_PREFIX)printing$(PCUT_TEST_SUFFIX) \
-	$(PCUT_TEST_PREFIX)simple$(PCUT_TEST_SUFFIX) \
-	$(PCUT_TEST_PREFIX)skip$(PCUT_TEST_SUFFIX) \
-	$(PCUT_TEST_PREFIX)suites$(PCUT_TEST_SUFFIX) \
-	$(PCUT_TEST_PREFIX)teardownaborts$(PCUT_TEST_SUFFIX) \
-	$(PCUT_TEST_PREFIX)teardown$(PCUT_TEST_SUFFIX) \
-	$(PCUT_TEST_PREFIX)testlist$(PCUT_TEST_SUFFIX) \
-	$(PCUT_TEST_PREFIX)timeout$(PCUT_TEST_SUFFIX) \
-	$(PCUT_TEST_PREFIX)xmlreport$(PCUT_TEST_SUFFIX)
-
-EXTRA_CLEAN = $(SELF_TESTS)
-
-include helenos.mak
-
-include $(USPACE_PREFIX)/Makefile.common
-
-include helenos.test.mak
-
-all-test: $(SELF_TESTS)
-
-test-libpcut-%: $(LIBRARY).a
-	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(START_FILES) $^ $(LIBRARY).a $(BASE_LIBS)
-
Index: uspace/lib/pcut/meson.build
===================================================================
--- uspace/lib/pcut/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/pcut/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,18 @@
+c_args += [ '-D__helenos__', '-Wno-unknown-pragmas' ]
+
+src = files(
+	'src/os/helenos.c',
+	'src/assert.c',
+	'src/helper.c',
+	'src/list.c',
+	'src/main.c',
+	'src/print.c',
+	'src/report/report.c',
+	'src/report/tap.c',
+	'src/report/xml.c',
+	'src/run.c',
+)
+
+if CONFIG_PCUT_SELF_TESTS
+	subdir('tests')
+endif
Index: uspace/lib/pcut/tests/meson.build
===================================================================
--- uspace/lib/pcut/tests/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/pcut/tests/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,27 @@
+self_tests = [
+	[ 'abort', files('abort.c') ],
+	[ 'asserts', files('asserts.c') ],
+	[ 'beforeafter', files('beforeafter.c') ],
+	[ 'errno', files('errno.c') ],
+	[ 'inithook', files('inithook.c') ],
+	[ 'manytests', files('manytests.c') ],
+	[ 'multisuite', files('suite_all.c', 'suite1.c', 'suite2.c', 'tested.c') ],
+	[ 'preinithook', files('inithook.c') ],
+	[ 'printing', files('printing.c') ],
+	[ 'simple', files('simple.c', 'tested.c') ],
+	[ 'skip', files('skip.c') ],
+	[ 'suites', files('suites.c', 'tested.c') ],
+	[ 'teardownaborts', files('teardownaborts.c') ],
+	[ 'teardown', files('teardown.c', 'tested.c') ],
+	[ 'testlist', files('testlist.c') ],
+	[ 'timeout', files('timeout.c') ],
+	[ 'xmlreport', files('xmlreport.c', 'tested.c') ],
+]
+
+foreach t : self_tests
+		testfiles += [ {
+			'name': 'pcut-' + t[0],
+			'src': t[1],
+			'includes': include_directories('../include'),
+		} ]
+endforeach
Index: uspace/lib/posix/Makefile
===================================================================
--- uspace/lib/posix/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,149 +1,0 @@
-#
-# Copyright (c) 2011 Petr Koupy
-# Copyright (c) 2011 Jiri Zarevucky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libposix
-
-EXTRA_CFLAGS = -Iinclude/posix -D_XOPEN_SOURCE
-
-EXPORT_FILES = \
-	../math/libmath.a \
-	../clui/libclui.a \
-	../gui/libgui.a \
-	../draw/libdraw.a \
-	../softrend/libsoftrend.a \
-	../hound/libhound.a \
-	../pcm/libpcm.a \
-	../cpp/libcpp.a \
-	$(LIBC_PREFIX)/libc.a \
-	$(LIBC_PREFIX)/crt0.o \
-	$(LIBC_PREFIX)/crt1.o \
-	$(LIBRARY).a
-
-SOURCES = \
-	src/ctype.c \
-	src/dlfcn.c \
-	src/fcntl.c \
-	src/fnmatch.c \
-	src/locale.c \
-	src/pthread/condvar.c \
-	src/pthread/keys.c \
-	src/pthread/mutex.c \
-	src/pthread/threads.c \
-	src/pwd.c \
-	src/signal.c \
-	src/stdio.c \
-	src/stdlib.c \
-	src/string.c \
-	src/strings.c \
-	src/sys/mman.c \
-	src/sys/stat.c \
-	src/sys/wait.c \
-	src/time.c \
-	src/unistd.c
-
-TEST_SOURCES = \
-	test/main.c \
-	test/stdio.c \
-	test/stdlib.c \
-	test/unistd.c
-
-EXTRA_TEST_CFLAGS = -Wno-deprecated-declarations
-
-EXPORT_CPPFLAGS = \
-	-isystem $$(HELENOS_EXPORT_ROOT)/include/posix \
-	-isystem $$(HELENOS_EXPORT_ROOT)/include/libc \
-	-idirafter $$(HELENOS_EXPORT_ROOT)/include \
-	$(COMMON_CPPFLAGS)
-
-EXPORT_LDFLAGS = \
-	-L$$(HELENOS_EXPORT_ROOT)/lib \
-	$$(HELENOS_EXPORT_ROOT)/lib/crt0.o \
-	$$(HELENOS_EXPORT_ROOT)/lib/crt1.o
-
-EXPORT_LDLIBS = \
-	-Wl,--start-group -lposix -lmath -lc -lgcc -Wl,--end-group
-
-EXPORT_CFLAGS = \
-	$(COMMON_CFLAGS)
-
-EXPORT_CXXFLAGS = \
-	$(COMMON_CXXFLAGS)
-
-include $(USPACE_PREFIX)/Makefile.common
-
-export: $(EXPORT_DIR)/config.mk $(EXPORT_DIR)/config.rc \
-    $(EXPORT_DIR)/Makefile.common $(EXPORT_DIR)/Makefile.config
-
-$(EXPORT_DIR)/config.mk: export-libs export-includes
-	echo '# Generated file, do not modify.' >> $@.new
-	echo '# Do not forget to set HELENOS_EXPORT_ROOT.' >> $@.new
-	echo 'HELENOS_CROSS_PATH="$(shell dirname `which $(CC)`)"' >> $@.new
-	echo 'HELENOS_ARCH="$(firstword $(subst -, ,$(TARGET)))"' >> $@.new
-	echo 'HELENOS_TARGET="$(TARGET)"' >> $@.new
-	echo 'HELENOS_CPPFLAGS="$(EXPORT_CPPFLAGS)"' >> $@.new
-	echo 'HELENOS_CFLAGS="$(EXPORT_CFLAGS)"' >> $@.new
-	echo 'HELENOS_CXXFLAGS="$(EXPORT_CXXFLAGS)"' >> $@.new
-	echo 'HELENOS_LDFLAGS="$(EXPORT_LDFLAGS)"' >> $@.new
-	echo 'HELENOS_LDLIBS="$(EXPORT_LDLIBS)"' >> $@.new
-	mv $@.new $@
-
-$(EXPORT_DIR)/config.rc: $(EXPORT_DIR)/config.mk
-	sed 's:$$(HELENOS_EXPORT_ROOT):$$HELENOS_EXPORT_ROOT:g' < $< >$@
-
-$(EXPORT_DIR)/Makefile.common: ../../../Makefile.common
-	cp $< $@
-
-$(EXPORT_DIR)/Makefile.config: ../../../Makefile.config
-	cp $< $@
-
-export-libs: $(EXPORT_FILES) export-includes
-	mkdir -p $(EXPORT_DIR)/lib
-	cp -L $(EXPORT_FILES) $(EXPORT_DIR)/lib
-
-export-includes: $(shell find ./include ../c/arch/$(UARCH)/include $(ROOT_PATH)/abi/include -name '*.h')
-	mkdir -p $(EXPORT_DIR)/include
-	rm -rf $(EXPORT_DIR)/include.new
-	cp -r -L -T ./include $(EXPORT_DIR)/include.new
-	cp -r -L ../c/arch/$(UARCH)/include/libarch $(EXPORT_DIR)/include.new/libc
-	cp -r -L $(ROOT_PATH)/abi/include/* $(EXPORT_DIR)/include.new
-	mkdir -p $(EXPORT_DIR)/include.new/libclui
-	cp -L ../clui/tinput.h $(EXPORT_DIR)/include.new/libclui
-	rm -rf $(EXPORT_DIR)/include
-	mkdir -p $(EXPORT_DIR)/include.new/libdraw
-	cp -r -L -t $(EXPORT_DIR)/include.new/libdraw ../draw/include/*
-	mkdir -p $(EXPORT_DIR)/include.new/libgui
-	cp -L -t $(EXPORT_DIR)/include.new/libgui ../gui/*.h
-	mkdir -p $(EXPORT_DIR)/include.new/libhound
-	cp -r -L -t $(EXPORT_DIR)/include.new/libhound ../hound/include/*
-	mkdir -p $(EXPORT_DIR)/include.new/libpcm
-	cp -r -L -t $(EXPORT_DIR)/include.new/libpcm ../pcm/include/*
-	mkdir -p $(EXPORT_DIR)/include.new/libcpp
-	cp -r -L -t $(EXPORT_DIR)/include.new/libcpp ../cpp/include/*
-	mv $(EXPORT_DIR)/include.new $(EXPORT_DIR)/include
Index: uspace/lib/posix/meson.build
===================================================================
--- uspace/lib/posix/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/posix/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,36 @@
+includes += include_directories('include/posix', 'include')
+c_args += [ '-fno-builtin', '-D_XOPEN_SOURCE' ]
+
+# TODO
+
+src = files(
+	'src/ctype.c',
+	'src/dlfcn.c',
+	'src/fcntl.c',
+	'src/fnmatch.c',
+	'src/locale.c',
+	'src/pthread/condvar.c',
+	'src/pthread/keys.c',
+	'src/pthread/mutex.c',
+	'src/pthread/threads.c',
+	'src/pwd.c',
+	'src/signal.c',
+	'src/stdio.c',
+	'src/stdlib.c',
+	'src/string.c',
+	'src/strings.c',
+	'src/sys/mman.c',
+	'src/sys/stat.c',
+	'src/sys/wait.c',
+	'src/time.c',
+	'src/unistd.c',
+)
+
+test_src = files(
+	'test/main.c',
+	'test/stdio.c',
+	'test/stdlib.c',
+	'test/unistd.c',
+)
+
+# TODO: exports
Index: uspace/lib/scsi/Makefile
===================================================================
--- uspace/lib/scsi/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,35 +1,0 @@
-#
-# Copyright (c) 2011 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libscsi
-
-SOURCES = \
-	src/spc.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/scsi/meson.build
===================================================================
--- uspace/lib/scsi/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/scsi/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,1 @@
+src = files('src/spc.c')
Index: uspace/lib/sif/Makefile
===================================================================
--- uspace/lib/sif/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#
-# Copyright (c) 2018 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-
-LIBRARY = libsif
-
-SOURCES = \
-	src/sif.c
-
-TEST_SOURCES = \
-	test/main.c \
-	test/sif.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/sif/meson.build
===================================================================
--- uspace/lib/sif/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/sif/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,2 @@
+src = files('src/sif.c')
+test_src = files('test/main.c', 'test/sif.c')
Index: uspace/lib/softrend/Makefile
===================================================================
--- uspace/lib/softrend/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#
-# Copyright (c) 2011 Petr Koupy
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libsoftrend
-LIBS = math
-
-SOURCES = \
-	compose.c \
-	filter.c \
-	pixconv.c \
-	rectangle.c \
-	transform.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/softrend/meson.build
===================================================================
--- uspace/lib/softrend/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/softrend/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,8 @@
+deps = [ 'math' ]
+src = files(
+	'compose.c',
+	'filter.c',
+	'pixconv.c',
+	'rectangle.c',
+	'transform.c',
+)
Index: uspace/lib/trackmod/Makefile
===================================================================
--- uspace/lib/trackmod/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#
-# Copyright (c) 2014 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libtrackmod
-
-SOURCES = \
-	protracker.c \
-	trackmod.c \
-	xm.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/trackmod/meson.build
===================================================================
--- uspace/lib/trackmod/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/trackmod/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,5 @@
+src = files(
+	'protracker.c',
+	'trackmod.c',
+	'xm.c',
+)
Index: uspace/lib/untar/Makefile
===================================================================
--- uspace/lib/untar/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#
-# Copyright (c) 2018 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libuntar
-
-SOURCES = \
-	tar.c \
-	untar.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/untar/meson.build
===================================================================
--- uspace/lib/untar/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/untar/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,1 @@
+src = files('tar.c', 'untar.c')
Index: uspace/lib/uri/Makefile
===================================================================
--- uspace/lib/uri/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,39 +1,0 @@
-#
-# Copyright (c) 2013 Martin Sucha
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = liburi
-
-SOURCES = \
-	uri.c
-
-TEST_SOURCES = \
-	test/main.c \
-	test/parser.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/uri/meson.build
===================================================================
--- uspace/lib/uri/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/uri/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,6 @@
+src = files('uri.c')
+
+test_src = files(
+	'test/main.c',
+	'test/parser.c',
+)
Index: uspace/lib/usb/Makefile
===================================================================
--- uspace/lib/usb/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,42 +1,0 @@
-#
-# Copyright (c) 2010 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libusb
-LIBS = drv
-
-SOURCES = \
-	src/class.c \
-	src/dev.c \
-	src/debug.c \
-	src/dma_buffer.c \
-	src/dump.c \
-	src/port.c \
-	src/usb.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/usb/meson.build
===================================================================
--- uspace/lib/usb/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/usb/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,10 @@
+deps = [ 'drv' ]
+src = files(
+	'src/class.c',
+	'src/dev.c',
+	'src/debug.c',
+	'src/dma_buffer.c',
+	'src/dump.c',
+	'src/port.c',
+	'src/usb.c',
+)
Index: uspace/lib/usbdev/Makefile
===================================================================
--- uspace/lib/usbdev/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,44 +1,0 @@
-#
-# Copyright (c) 2011 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libusbdev
-LIBS = usb drv
-
-SOURCES = \
-	src/altiface.c \
-	src/driver.c \
-	src/devdrv.c \
-	src/devpoll.c \
-	src/dp.c \
-	src/pipes.c \
-	src/pipesinit.c \
-	src/recognise.c \
-	src/request.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/usbdev/meson.build
===================================================================
--- uspace/lib/usbdev/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/usbdev/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,12 @@
+deps = [ 'usb' , 'drv' ]
+src = files(
+	'src/altiface.c',
+	'src/driver.c',
+	'src/devdrv.c',
+	'src/devpoll.c',
+	'src/dp.c',
+	'src/pipes.c',
+	'src/pipesinit.c',
+	'src/recognise.c',
+	'src/request.c',
+)
Index: uspace/lib/usbhid/Makefile
===================================================================
--- uspace/lib/usbhid/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,41 +1,0 @@
-#
-# Copyright (c) 2011 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libusbhid
-LIBS = usb usbdev drv
-
-SOURCES = \
-	src/hiddescriptor.c \
-	src/hidparser.c \
-	src/hidpath.c \
-	src/hidreport.c \
-	src/consumer.c \
-	src/hidreq.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/usbhid/meson.build
===================================================================
--- uspace/lib/usbhid/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/usbhid/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,9 @@
+deps = [ 'usb' , 'usbdev' , 'drv' ]
+src = files(
+	'src/hiddescriptor.c',
+	'src/hidparser.c',
+	'src/hidpath.c',
+	'src/hidreport.c',
+	'src/consumer.c',
+	'src/hidreq.c',
+)
Index: uspace/lib/usbhost/Makefile
===================================================================
--- uspace/lib/usbhost/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,45 +1,0 @@
-#
-# Copyright (c) 2011 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libusbhost
-EXTRA_CFLAGS += \
-	-Iinclude/usb/host
-LIBS = usb drv
-
-SOURCES = \
-	src/ddf_helpers.c \
-	src/endpoint.c \
-	src/hcd.c \
-	src/bus.c \
-	src/usb2_bus.c \
-	src/bandwidth.c \
-	src/utility.c \
-	src/usb_transfer_batch.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/usbhost/meson.build
===================================================================
--- uspace/lib/usbhost/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/usbhost/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,12 @@
+deps = [ 'usb' , 'drv' ]
+private_includes += include_directories('include/usb/host')
+src = files(
+	'src/ddf_helpers.c',
+	'src/endpoint.c',
+	'src/hcd.c',
+	'src/bus.c',
+	'src/usb2_bus.c',
+	'src/bandwidth.c',
+	'src/utility.c',
+	'src/usb_transfer_batch.c',
+)
Index: uspace/lib/usbvirt/Makefile
===================================================================
--- uspace/lib/usbvirt/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,45 +1,0 @@
-#
-# Copyright (c) 2011 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libusbvirt
-EXTRA_CFLAGS = \
-	-Iinclude/usbvirt
-LIBS = drv usb usbdev
-
-SOURCES = \
-	src/ctrltransfer.c \
-	src/device.c \
-	src/ipc_dev.c \
-	src/ipc_hc.c \
-	src/stdreq.c \
-	src/transfer.c \
-	src/virthub_base.c \
-	src/virthub_descriptors.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/usbvirt/meson.build
===================================================================
--- uspace/lib/usbvirt/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/usbvirt/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,12 @@
+deps = [ 'drv' , 'usb' , 'usbdev' ]
+private_includes += include_directories('include/usbvirt')
+src = files(
+	'src/ctrltransfer.c',
+	'src/device.c',
+	'src/ipc_dev.c',
+	'src/ipc_hc.c',
+	'src/stdreq.c',
+	'src/transfer.c',
+	'src/virthub_base.c',
+	'src/virthub_descriptors.c',
+)
Index: uspace/lib/virtio/Makefile
===================================================================
--- uspace/lib/virtio/Makefile	(revision 06e0f37b2f97829f85d3054ff2902fab11f4ff9b)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#
-# Copyright (c) 2018 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBRARY = libvirtio
-LIBS = drv
-
-SOURCES = \
-	virtio.c \
-	virtio-pci.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/virtio/meson.build
===================================================================
--- uspace/lib/virtio/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/virtio/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
@@ -0,0 +1,2 @@
+deps = [ 'drv' ]
+src = files('virtio.c', 'virtio-pci.c')
