Index: HelenOS.config
===================================================================
--- HelenOS.config	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ HelenOS.config	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -526,7 +526,7 @@
 @ "modular" Modular
 @ "module" One module
-! NETWORKING (choice)
+! CONFIG_NETWORKING (choice)
 
 % DP8390 (NE2k) network interface
-! [NETWORKING=modular|NETWORKING=module] CONFIG_NETIF_DP8390 (y/n)
-
+! [CONFIG_NETWORKING=modular|CONFIG_NETWORKING=module] CONFIG_NETIF_DP8390 (y/n)
+
Index: boot/Makefile.common
===================================================================
--- boot/Makefile.common	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ boot/Makefile.common	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -102,35 +102,30 @@
 	$(USPACEDIR)/srv/net/app/nettest2/nettest2
 
-ifneq ($(NETWORKING), none)
-NET_CFG = \
-	$(USPACEDIR)/srv/net/cfg/$(NETWORKING)/general \
-	$(USPACEDIR)/srv/net/cfg/$(NETWORKING)/lo
-
-ifeq ($(CONFIG_NETIF_DP8390),y)
-	NET_SRVS	+=	$(USPACEDIR)/srv/net/netif/dp8390/dp8390
-
-	NET_CFG	+=	$(USPACEDIR)/srv/net/cfg/$(NETWORKING)/ne2k
-endif
-
-ifeq ($(NETWORKING), module)
-	RD_APPS +=	$(NET_APPS)
-
-	RD_SRVS +=	$(NET_SRVS)
-
-	CFG		+=	$(NET_CFG)
-else
-ifeq ($(NETWORKING), modular)
-	RD_APPS +=	$(NET_APPS)
-
-	RD_SRVS +=	$(NET_SRVS)
-
-	RD_SRVS +=	$(USPACEDIR)/srv/net/il/ip/ip \
+ifneq ($(CONFIG_NETWORKING),none)
+	NET_CFG = \
+		$(USPACEDIR)/srv/net/cfg/$(CONFIG_NETWORKING)/general \
+		$(USPACEDIR)/srv/net/cfg/$(CONFIG_NETWORKING)/lo
+	
+	ifeq ($(CONFIG_NETIF_DP8390),y)
+		NET_SRVS += $(USPACEDIR)/srv/net/netif/dp8390/dp8390
+		NET_CFG += $(USPACEDIR)/srv/net/cfg/$(CONFIG_NETWORKING)/ne2k
+	endif
+	
+	ifeq ($(CONFIG_NETWORKING),module)
+		RD_APPS += $(NET_APPS)
+		RD_SRVS += $(NET_SRVS)
+		CFG += $(NET_CFG)
+	endif
+	
+	ifeq ($(CONFIG_NETWORKING),modular)
+		RD_APPS += $(NET_APPS)
+		RD_SRVS += $(NET_SRVS)
+		RD_SRVS += \
+			$(USPACEDIR)/srv/net/il/ip/ip \
 			$(USPACEDIR)/srv/net/il/arp/arp \
 			$(USPACEDIR)/srv/net/tl/udp/udp \
 			$(USPACEDIR)/srv/net/tl/tcp/tcp \
 			$(USPACEDIR)/srv/net/tl/icmp/icmp
-
-	CFG		+=	$(NET_CFG)
+		CFG += $(NET_CFG)
+	endif
 endif
-endif
-endif
Index: defaults/amd64/Makefile.config
===================================================================
--- defaults/amd64/Makefile.config	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ defaults/amd64/Makefile.config	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -63,3 +63,3 @@
 
 # Default networking architecture
-NETWORKING = modular
+CONFIG_NETWORKING = modular
Index: defaults/arm32/Makefile.config
===================================================================
--- defaults/arm32/Makefile.config	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ defaults/arm32/Makefile.config	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -39,3 +39,3 @@
 
 # Default networking architecture
-NETWORKING = none 
+CONFIG_NETWORKING = none
Index: defaults/ia32/Makefile.config
===================================================================
--- defaults/ia32/Makefile.config	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ defaults/ia32/Makefile.config	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -69,3 +69,3 @@
 
 # Default networking architecture
-NETWORKING = modular
+CONFIG_NETWORKING = modular
Index: defaults/ia64/Makefile.config
===================================================================
--- defaults/ia64/Makefile.config	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ defaults/ia64/Makefile.config	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -51,3 +51,3 @@
 
 # Default networking architecture
-NETWORKING = modular
+CONFIG_NETWORKING = modular
Index: defaults/mips32/Makefile.config
===================================================================
--- defaults/mips32/Makefile.config	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ defaults/mips32/Makefile.config	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -45,3 +45,3 @@
 
 # Default networking architecture
-NETWORKING = none 
+CONFIG_NETWORKING = none
Index: defaults/ppc32/Makefile.config
===================================================================
--- defaults/ppc32/Makefile.config	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ defaults/ppc32/Makefile.config	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -45,3 +45,3 @@
 
 # Default networking architecture
-NETWORKING = none 
+CONFIG_NETWORKING = none
Index: defaults/sparc64/Makefile.config
===================================================================
--- defaults/sparc64/Makefile.config	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ defaults/sparc64/Makefile.config	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -63,3 +63,3 @@
 
 # Default networking architecture
-NETWORKING = modular
+CONFIG_NETWORKING = modular
Index: defaults/sparc64/sun4v/Makefile.config
===================================================================
--- defaults/sparc64/sun4v/Makefile.config	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ defaults/sparc64/sun4v/Makefile.config	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -13,4 +13,3 @@
 CONFIG_FB = n
 
-NETWORKING = none
-
+CONFIG_NETWORKING = none
Index: defaults/special/abs32le/Makefile.config
===================================================================
--- defaults/special/abs32le/Makefile.config	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ defaults/special/abs32le/Makefile.config	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -6,3 +6,3 @@
 
 # Networking architecture
-NETWORKING = none
+CONFIG_NETWORKING = none
Index: uspace/Makefile
===================================================================
--- uspace/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -27,9 +27,9 @@
 #
 
-## Include configuration
-#
-
 -include ../Makefile.common
 -include ../Makefile.config
+
+## Common binaries
+#
 
 DIRS = \
@@ -64,6 +64,8 @@
 	srv/hid/fb \
 	srv/hid/kbd \
-	srv/hw/char/i8042 \
-	srv/net
+	srv/hw/char/i8042
+
+## Platform-specific hardware support
+#
 
 ifneq ($(UARCH),abs32le)
@@ -89,4 +91,33 @@
 endif
 
+## Networking
+#
+
+ifeq ($(CONFIG_NETIF_DP8390),y)
+	DIRS += srv/net/netif/dp8390
+endif
+
+NETWORKING_COMMON += \
+	srv/net/netif/lo \
+	srv/net/nil/eth \
+	srv/net/nil/nildummy \
+	srv/net/net \
+	srv/net/net/start \
+	srv/net/socket \
+	srv/net/app/echo \
+	srv/net/app/ping \
+	srv/net/app/nettest1 \
+	srv/net/app/nettest2
+
+NETWORKING_MODULAR = \
+	srv/net/il/arp \
+	srv/net/il/ip \
+	srv/net/tl/icmp \
+	srv/net/tl/udp \
+	srv/net/tl/tcp
+
+## System libraries
+#
+
 LIBC = lib/libc
 LIBS = \
@@ -108,6 +139,17 @@
 LIBS_BUILD = $(addsuffix .build,$(LIBS))
 
-BUILDS := $(addsuffix .build,$(DIRS))
-CLEANS := $(addsuffix .clean,$(DIRS)) $(addsuffix .clean,$(LIBS)) $(addsuffix .clean,$(LIBC))
+ifeq ($(CONFIG_NETWORKING),modular)
+	BUILDS := $(addsuffix .build,$(DIRS)) $(addsuffix .build,$(NETWORKING_COMMON)) $(addsuffix .build,$(NETWORKING_MODULAR))
+endif
+
+ifeq ($(CONFIG_NETWORKING),module)
+	BUILDS := $(addsuffix .build,$(DIRS)) $(addsuffix .build,$(NETWORKING_COMMON))
+endif
+
+ifeq ($(CONFIG_NETWORKING),none)
+	BUILDS := $(addsuffix .build,$(DIRS))
+endif
+
+CLEANS := $(addsuffix .clean,$(DIRS)) $(addsuffix .clean,$(NETWORKING_COMMON)) $(addsuffix .clean,$(NETWORKING_MODULAR)) $(addsuffix .clean,$(LIBS)) $(addsuffix .clean,$(LIBC))
 
 .PHONY: all $(LIBC_BUILD) $(LIBS_BUILD) $(BUILDS) $(CLEANS) clean
Index: uspace/Makefile.common
===================================================================
--- uspace/Makefile.common	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
+++ uspace/Makefile.common	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -0,0 +1,188 @@
+#
+# 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.
+#
+
+# Individual makefiles set:
+#
+#   USPACE_PREFIX  (*) relative path to uspace/ directory
+#   SOURCES        (*) list of source files
+#   LIBS               libraries to link with
+#   DEFS               compiler defines
+#   EXTRA_CFLAGS       additional flags to pass to C compiler
+#   LINKER_SCRIPT      linker script
+#   PRE_DEPEND         targets required for dependency check
+#
+#   BINARY         (/) binary output name (like appname)
+#   LIBRARY        (/) library output name (like libname)
+#   EXTRA_OUTPUT       additional output targets
+#   EXTRA_CLEAN        additional cleanup targets
+#
+# (x) required variables
+# (/) exactly one of the variables must be defined
+#
+
+ROOT_PATH = $(USPACE_PREFIX)/..
+
+VERSION_DEF = $(ROOT_PATH)/version
+
+COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
+COMMON_HEADER = $(ROOT_PATH)/common.h
+
+CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
+CONFIG_HEADER = $(ROOT_PATH)/config.h
+
+-include $(VERSION_DEF)
+-include $(COMMON_MAKEFILE)
+-include $(CONFIG_MAKEFILE)
+
+ifneq ($(BINARY),)
+	JOB = $(BINARY).job
+	OUTPUT = $(BINARY)
+	EXTRA_OUTPUT += $(BINARY).disasm
+	EXTRA_CLEAN += $(BINARY).map
+endif
+
+ifneq ($(LIBRARY),)
+	JOB = $(LIBRARY).job
+	OUTPUT = $(LIBRARY).a
+endif
+
+DEPEND = Makefile.depend
+DEPEND_PREV = $(DEPEND).prev
+
+LIBC_PREFIX = $(USPACE_PREFIX)/lib/libc
+LIBBLOCK_PREFIX = $(USPACE_PREFIX)/lib/libblock
+LIBFS_PREFIX = $(USPACE_PREFIX)/lib/libfs
+LIBPCI_PREFIX = $(USPACE_PREFIX)/lib/libpci
+SOFTFLOAT_PREFIX = $(USPACE_PREFIX)/lib/softfloat
+SOFTINT_PREFIX = $(USPACE_PREFIX)/lib/softint
+
+BASE_LIBS = $(LIBC_PREFIX)/libc.a $(SOFTINT_PREFIX)/libsoftint.a
+
+LINKER_SCRIPT ?= $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld
+
+.PHONY: all clean
+
+all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(LIBS) $(OUTPUT) $(EXTRA_OUTPUT)
+	-[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV)
+
+clean:
+	rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(EXTRA_OUTPUT) $(EXTRA_CLEAN)
+	find . -name '*.o' -follow -exec rm \{\} \;
+
+OPTIMIZATION = 3
+
+GCC_CFLAGS = -I$(LIBC_PREFIX)/include -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
+	-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
+	-finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
+	-Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \
+	-Werror-implicit-function-declaration -Wwrite-strings \
+	-Werror -pipe -g -D__$(ENDIANESS)__
+
+ICC_CFLAGS = -I$(LIBC_PREFIX)/include -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
+	-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
+	-finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
+	-Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \
+	-Werror-implicit-function-declaration -Wwrite-strings \
+	-Werror -pipe -g -D__$(ENDIANESS)__
+
+CLANG_CFLAGS = -I$(LIBC_PREFIX)/include -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
+	-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
+	-finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
+	-Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
+	-Werror-implicit-function-declaration -Wwrite-strings \
+	-pipe -g -arch $(CLANG_ARCH) -D__$(ENDIANESS)__
+
+## Setup platform configuration
+#
+
+-include $(LIBC_PREFIX)/arch/$(UARCH)/Makefile.common
+
+## Compilation options
+#
+
+JOBFILE = $(LIBC_PREFIX)/../../../tools/jobfile.py
+
+ifeq ($(COMPILER),gcc_cross)
+	CFLAGS = $(GCC_CFLAGS) $(EXTRA_CFLAGS)
+	DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
+endif
+
+ifeq ($(COMPILER),gcc_native)
+	CFLAGS = $(GCC_CFLAGS) $(EXTRA_CFLAGS)
+	DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
+endif
+
+ifeq ($(COMPILER),icc)
+	CFLAGS = $(ICC_CFLAGS) $(EXTRA_CFLAGS)
+	DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
+endif
+
+ifeq ($(COMPILER),clang)
+	CFLAGS = $(CLANG_CFLAGS) $(EXTRA_CFLAGS)
+	DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
+endif
+
+-include $(DEPEND)
+
+OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
+
+ifneq ($(BINARY),)
+%.disasm: $(BINARY)
+	$(OBJDUMP) -d $< > $@
+
+$(BINARY): $(LINKER_SCRIPT) $(OBJECTS) $(LIBS) $(BASE_LIBS)
+	$(LD) -N $(LFLAGS) -T $(LINKER_SCRIPT) -M -Map $(BINARY).map -o $(BINARY) $(OBJECTS) $(LIBS) $(BASE_LIBS)
+endif
+
+ifneq ($(LIBRARY),)
+%.a: $(OBJECTS)
+	$(AR) rc $@ $(OBJECTS)
+endif
+
+%.o: %.S $(DEPEND)
+	$(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@
+ifeq ($(PRECHECK),y)
+	$(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(CFLAGS) -D__ASM__
+endif
+
+%.o: %.s $(DEPEND)
+	$(AS) $(AFLAGS) -o $@ $<
+ifeq ($(PRECHECK),y)
+	$(JOBFILE) $(JOB) $< $@ as asm
+endif
+
+%.o: %.c $(DEPEND)
+	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
+ifeq ($(PRECHECK),y)
+	$(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS)
+endif
+
+$(DEPEND): $(PRE_DEPEND)
+	makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
+	-[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
Index: pace/app/Makefile.common
===================================================================
--- uspace/app/Makefile.common	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ 	(revision )
@@ -1,92 +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.
-#
-
-## Common rules for building apps.
-#
-
-# Individual makefiles set:
-#
-#	USPACE_PREFIX	relative path to uspace/ directory
-#	LIBS		libraries to link with (with relative path)
-#	EXTRA_CFLAGS	additional flags to pass to C compiler
-#	JOB		job file name (like appname.job)
-#	OUTPUT		output binary name (like appname)
-#	SOURCES		list of source files
-#
-
-DEPEND = Makefile.depend
-DEPEND_PREV = $(DEPEND).prev
-
-LIBC_PREFIX = $(USPACE_PREFIX)/lib/libc
-LIBBLOCK_PREFIX = $(USPACE_PREFIX)/lib/libblock
-SOFTINT_PREFIX = $(USPACE_PREFIX)/lib/softint
-
-JOB = $(OUTPUT).job
-
-OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
-
-include $(LIBC_PREFIX)/Makefile.toolchain
-
-CFLAGS += $(EXTRA_CFLAGS)
-
-.PHONY: all build clean
-
-all: \
-    $(LIBC_PREFIX)/../../../version \
-    $(LIBC_PREFIX)/../../../Makefile.common \
-    $(LIBC_PREFIX)/../../../Makefile.config \
-    $(LIBC_PREFIX)/../../../config.h \
-    $(LIBS) \
-    \
-    $(OUTPUT) $(OUTPUT).disasm
-	-[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV)
-
-clean:
-	rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm
-	find . -name '*.o' -follow -exec rm \{\} \;
-
-build: 
-
--include $(DEPEND)
-
-$(OUTPUT).disasm: $(OUTPUT)
-	$(OBJDUMP) -d $< > $@
-
-$(OUTPUT): $(OBJECTS) $(LIBS)
-	$(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
-
-%.o: %.c $(DEPEND)
-	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
-ifeq ($(PRECHECK),y)
-	$(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS)
-endif
-
-$(DEPEND):
-	makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
-	-[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
Index: uspace/app/bdsh/Makefile
===================================================================
--- uspace/app/bdsh/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/app/bdsh/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,8 +29,7 @@
 
 USPACE_PREFIX = ../..
-LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBC_PREFIX)/libc.a
+LIBS = $(LIBBLOCK_PREFIX)/libblock.a
 EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) -I. -Icmds/ -Icmds/builtins -Icmds/modules
-
-OUTPUT = bdsh
+BINARY = bdsh
 
 SOURCES = \
@@ -60,3 +59,3 @@
 	scli.c
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/app/edit/Makefile
===================================================================
--- uspace/app/edit/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/app/edit/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,7 +29,5 @@
 
 USPACE_PREFIX = ../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = edit
+BINARY = edit
 
 SOURCES = \
@@ -37,3 +35,3 @@
 	sheet.c
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/app/getterm/Makefile
===================================================================
--- uspace/app/getterm/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/app/getterm/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -28,11 +28,7 @@
 #
 
-include ../../../version
-DEFS += -DRELEASE=$(RELEASE) "-DNAME=$(NAME)"
-
 USPACE_PREFIX = ../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = getterm
+DEFS = -DRELEASE=$(RELEASE) "-DNAME=$(NAME)"
+BINARY = getterm
 
 SOURCES = \
@@ -40,3 +36,3 @@
 	version.c
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/app/init/Makefile
===================================================================
--- uspace/app/init/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/app/init/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,10 +29,8 @@
 
 USPACE_PREFIX = ../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = init
+BINARY = init
 
 SOURCES = \
 	init.c
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/app/klog/Makefile
===================================================================
--- uspace/app/klog/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/app/klog/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,10 +29,8 @@
 
 USPACE_PREFIX = ../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = klog
+BINARY = klog
 
 SOURCES = \
 	klog.c
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/app/mkfat/Makefile
===================================================================
--- uspace/app/mkfat/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/app/mkfat/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,11 +29,10 @@
 
 USPACE_PREFIX = ../..
-LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBC_PREFIX)/libc.a
+LIBS = $(LIBBLOCK_PREFIX)/libblock.a
 EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX)
-
-OUTPUT = mkfat
+BINARY = mkfat
 
 SOURCES = \
 	mkfat.c
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/app/redir/Makefile
===================================================================
--- uspace/app/redir/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/app/redir/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,10 +29,8 @@
 
 USPACE_PREFIX = ../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = redir
+BINARY = redir
 
 SOURCES = \
 	redir.c
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/app/taskdump/Makefile
===================================================================
--- uspace/app/taskdump/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/app/taskdump/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -28,8 +28,6 @@
 
 USPACE_PREFIX = ../..
-LIBS = $(LIBC_PREFIX)/libc.a
 EXTRA_CFLAGS = -Iinclude
-
-OUTPUT = taskdump
+BINARY = taskdump
 
 SOURCES = \
@@ -38,3 +36,3 @@
 	symtab.c
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/app/tester/Makefile
===================================================================
--- uspace/app/tester/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/app/tester/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,7 +29,5 @@
 
 USPACE_PREFIX = ../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = tester
+BINARY = tester
 
 SOURCES = \
@@ -53,3 +51,3 @@
 	mm/malloc1.c
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/app/tetris/Makefile
===================================================================
--- uspace/app/tetris/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/app/tetris/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,7 +29,5 @@
 
 USPACE_PREFIX = ../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = tetris
+BINARY = tetris
 
 SOURCES = \
@@ -40,3 +38,3 @@
 	screen.c
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/app/trace/Makefile
===================================================================
--- uspace/app/trace/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/app/trace/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,7 +29,5 @@
 
 USPACE_PREFIX = ../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = trace
+BINARY = trace
 
 SOURCES = \
@@ -41,3 +39,3 @@
 	errors.c
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: pace/lib/Makefile.common
===================================================================
--- uspace/lib/Makefile.common	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ 	(revision )
@@ -1,102 +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.
-#
-
-## Common rules for building apps.
-#
-
-# Individual makefiles set:
-#
-#   USPACE_PREFIX  relative path to uspace/ directory
-#   LIBS           libraries to link with (with relative path)
-#   EXTRA_CFLAGS   additional flags to pass to C compiler
-#   JOB            job file name (like appname.job)
-#   OUTPUT         output binary name (like appname)
-#   SOURCES        list of source files
-#
-
-DEPEND = Makefile.depend
-DEPEND_PREV = $(DEPEND).prev
-
-LIBC_PREFIX = $(USPACE_PREFIX)/lib/libc
-
-JOB = $(OUTPUT).job
-
-OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
-
--include $(USPACE_PREFIX)/../Makefile.common
--include $(USPACE_PREFIX)/../Makefile.config
-include $(LIBC_PREFIX)/Makefile.toolchain
-
-CFLAGS += $(EXTRA_CFLAGS)
-
-.PHONY: all build clean
-
-all: \
-    $(LIBC_PREFIX)/../../../version \
-    $(LIBC_PREFIX)/../../../Makefile.common \
-    $(LIBC_PREFIX)/../../../Makefile.config \
-    $(LIBC_PREFIX)/../../../config.h \
-    $(LIBS) \
-    \
-    $(OUTPUT) \
-    $(EXTRA_OUTPUT)
-	-[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV)
-
-clean:
-	rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(EXTRA_OUTPUT) $(EXTRA_CLEAN)
-	find . -name '*.o' -follow -exec rm \{\} \;
-
-build:
-
--include $(DEPEND)
-
-$(OUTPUT): $(OBJECTS)
-	$(AR) rc $@ $(OBJECTS)
-
-%.o: %.S $(DEPEND)
-	$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
-ifeq ($(PRECHECK),y)
-	$(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__
-endif
-
-%.o: %.s $(DEPEND)
-	$(AS) $(AFLAGS) $< -o $@
-ifeq ($(PRECHECK),y)
-	$(JOBFILE) $(JOB) $< $@ as asm $(AFLAGS)
-endif
-
-%.o: %.c $(DEPEND)
-	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
-ifeq ($(PRECHECK),y)
-	$(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS)
-endif
-
-$(DEPEND): $(PRE_DEPEND)
-	makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
-	-[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
Index: uspace/lib/libblock/Makefile
===================================================================
--- uspace/lib/libblock/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/libblock/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,10 +29,8 @@
 
 USPACE_PREFIX = ../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = libblock.a
+LIBRARY = libblock
 
 SOURCES = \
 	libblock.c
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/libc/Makefile
===================================================================
--- uspace/lib/libc/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/libc/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -28,15 +28,6 @@
 #
 
--include ../../../Makefile.common
--include ../../../Makefile.config
-
-USPACE_PREFIX = $(shell pwd)/../..
-LIBS =
-
-LINK = arch/$(UARCH)/_link.ld
-
-PRE_DEPEND = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH)
-EXTRA_CLEAN = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH)
-EXTRA_OUTPUT = $(LINK)
+USPACE_PREFIX = ../..
+ROOT_PATH = $(USPACE_PREFIX)/..
 
 INCLUDE_KERNEL = include/kernel
@@ -44,5 +35,15 @@
 INCLUDE_LIBARCH = include/libarch
 
-OUTPUT = libc.a
+PRE_DEPEND = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH)
+EXTRA_OUTPUT = $(LINKER_SCRIPT)
+EXTRA_CLEAN = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) $(LINKER_SCRIPT)
+LIBRARY = libc
+
+COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
+CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
+
+-include $(COMMON_MAKEFILE)
+-include $(CONFIG_MAKEFILE)
+-include arch/$(UARCH)/Makefile.inc
 
 GENERIC_SOURCES = \
@@ -95,5 +96,5 @@
 	$(ARCH_SOURCES)
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
 
 $(INCLUDE_ARCH): $(INCLUDE_KERNEL) $(INCLUDE_KERNEL)/arch
@@ -108,4 +109,4 @@
 	ln -sfn ../$< $@
 
-$(LINK): $(LINK).in
-	$(GCC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@
+$(LINKER_SCRIPT): $(LINKER_SCRIPT).in
+	$(GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -E -x c $< | grep -v "^\#" > $@
Index: pace/lib/libc/Makefile.toolchain
===================================================================
--- uspace/lib/libc/Makefile.toolchain	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ 	(revision )
@@ -1,85 +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.
-#
-
-OPTIMIZATION = 3
-
-GCC_CFLAGS = -I$(LIBC_PREFIX)/include -O$(OPTIMIZATION) -imacros $(LIBC_PREFIX)/../../../config.h \
-	-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
-	-finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
-	-Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \
-	-Werror-implicit-function-declaration -Wwrite-strings \
-	-Werror -pipe -g -D__$(ENDIANESS)__
-
-ICC_CFLAGS = -I$(LIBC_PREFIX)/include -O$(OPTIMIZATION) -imacros $(LIBC_PREFIX)/../../../config.h \
-	-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
-	-finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
-	-Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \
-	-Werror-implicit-function-declaration -Wwrite-strings \
-	-Werror -pipe -g -D__$(ENDIANESS)__
-
-CLANG_CFLAGS = -I$(LIBC_PREFIX)/include -O$(OPTIMIZATION) -imacros $(LIBC_PREFIX)/../../../config.h \
-	-fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
-	-finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
-	-Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
-	-Werror-implicit-function-declaration -Wwrite-strings \
-	-pipe -g -arch $(CLANG_ARCH) -D__$(ENDIANESS)__
-
-LFLAGS = -M -N $(SOFTINT_PREFIX)/libsoftint.a
-AFLAGS =
-
-## Setup platform configuration
-#
-
--include $(LIBC_PREFIX)/../../../Makefile.common
--include $(LIBC_PREFIX)/../../../Makefile.config
--include $(LIBC_PREFIX)/arch/$(UARCH)/Makefile.inc
-
-## Compilation options
-#
-
-JOBFILE = $(LIBC_PREFIX)/../../../tools/jobfile.py
-
-ifeq ($(COMPILER),gcc_cross)
-	CFLAGS = $(GCC_CFLAGS)
-	DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
-endif
-
-ifeq ($(COMPILER),gcc_native)
-	CFLAGS = $(GCC_CFLAGS)
-	DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
-endif
-
-ifeq ($(COMPILER),icc)
-	CFLAGS = $(ICC_CFLAGS)
-	DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
-endif
-
-ifeq ($(COMPILER),clang)
-	CFLAGS = $(CLANG_CFLAGS)
-	DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
-endif
Index: uspace/lib/libc/arch/abs32le/Makefile.common
===================================================================
--- uspace/lib/libc/arch/abs32le/Makefile.common	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
+++ uspace/lib/libc/arch/abs32le/Makefile.common	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -0,0 +1,33 @@
+#
+# Copyright (c) 2010 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 ($(COMPILER),clang)
+	CLANG_ARCH = i386
+endif
+
+ENDIANESS = LE
Index: uspace/lib/libc/arch/abs32le/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/abs32le/Makefile.inc	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/libc/arch/abs32le/Makefile.inc	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -27,8 +27,4 @@
 #
 
-ifeq ($(COMPILER),clang)
-	CLANG_ARCH = i386
-endif
-
 ARCH_SOURCES = \
 	arch/$(UARCH)/src/entry.c \
@@ -39,3 +35,3 @@
 	arch/$(UARCH)/src/stacktrace.c
 
-ENDIANESS = LE
+.PRECIOUS: arch/$(UARCH)/src/entry.o
Index: uspace/lib/libc/arch/abs32le/_link.ld.in
===================================================================
--- uspace/lib/libc/arch/abs32le/_link.ld.in	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/libc/arch/abs32le/_link.ld.in	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,3 +1,3 @@
-STARTUP(LIBC_PREFIX/arch/UARCH/src/entry.o)
+STARTUP(LIBC_PATH/arch/UARCH/src/entry.o)
 ENTRY(__entry)
 
Index: uspace/lib/libc/arch/amd64/Makefile.common
===================================================================
--- uspace/lib/libc/arch/amd64/Makefile.common	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
+++ uspace/lib/libc/arch/amd64/Makefile.common	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -0,0 +1,35 @@
+#
+# 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.
+#
+
+CLANG_ARCH = x86_64
+GCC_CFLAGS += -fno-omit-frame-pointer
+
+ENDIANESS = LE
+
+BFD_NAME = elf64-x86-64
+BFD_ARCH = i386:x86-64
Index: uspace/lib/libc/arch/amd64/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/amd64/Makefile.inc	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/libc/arch/amd64/Makefile.inc	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -27,6 +27,4 @@
 #
 
-CLANG_ARCH = x86_64
-
 ARCH_SOURCES = \
 	arch/$(UARCH)/src/entry.s \
@@ -38,9 +36,3 @@
 	arch/$(UARCH)/src/stacktrace_asm.S
 
-GCC_CFLAGS += -fno-omit-frame-pointer
-LFLAGS += -N
-
-ENDIANESS = LE
-
-BFD_NAME = elf64-x86-64
-BFD_ARCH = i386:x86-64
+.PRECIOUS: arch/$(UARCH)/src/entry.o
Index: uspace/lib/libc/arch/amd64/_link.ld.in
===================================================================
--- uspace/lib/libc/arch/amd64/_link.ld.in	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/libc/arch/amd64/_link.ld.in	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,3 +1,3 @@
-STARTUP(LIBC_PREFIX/arch/UARCH/src/entry.o)
+STARTUP(LIBC_PATH/arch/UARCH/src/entry.o)
 ENTRY(__entry)
 
Index: uspace/lib/libc/arch/arm32/Makefile.common
===================================================================
--- uspace/lib/libc/arch/arm32/Makefile.common	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
+++ uspace/lib/libc/arch/arm32/Makefile.common	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 2007 Michal Kebrt
+# Copyright (c) 2007 Pavel Jancik
+# 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.
+#
+
+GCC_CFLAGS += -ffixed-r9 -mtp=soft -mapcs-frame -fno-omit-frame-pointer
+
+ENDIANESS = LE
+
+BFD_NAME = elf32-littlearm
+BFD_ARCH = arm
Index: uspace/lib/libc/arch/arm32/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/arm32/Makefile.inc	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/libc/arch/arm32/Makefile.inc	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -38,9 +38,3 @@
 	arch/$(UARCH)/src/stacktrace_asm.S
 
-GCC_CFLAGS += -ffixed-r9 -mtp=soft -mapcs-frame -fno-omit-frame-pointer
-LFLAGS += -N $(SOFTINT_PREFIX)/libsoftint.a
-
-ENDIANESS = LE
-
-BFD_NAME = elf32-littlearm
-BFD_ARCH = arm
+.PRECIOUS: arch/$(UARCH)/src/entry.o
Index: uspace/lib/libc/arch/arm32/_link.ld.in
===================================================================
--- uspace/lib/libc/arch/arm32/_link.ld.in	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/libc/arch/arm32/_link.ld.in	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,3 +1,3 @@
-STARTUP(LIBC_PREFIX/arch/UARCH/src/entry.o)
+STARTUP(LIBC_PATH/arch/UARCH/src/entry.o)
 ENTRY(__entry)
 
Index: uspace/lib/libc/arch/ia32/Makefile.common
===================================================================
--- uspace/lib/libc/arch/ia32/Makefile.common	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
+++ uspace/lib/libc/arch/ia32/Makefile.common	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -0,0 +1,35 @@
+#
+# 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.
+#
+
+CLANG_ARCH = i386
+GCC_CFLAGS += -march=pentium
+
+ENDIANESS = LE
+
+BFD_NAME = elf32-i386
+BFD_ARCH = i386
Index: uspace/lib/libc/arch/ia32/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/ia32/Makefile.inc	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/libc/arch/ia32/Makefile.inc	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -27,6 +27,4 @@
 #
 
-CLANG_ARCH = i386
-
 ARCH_SOURCES = \
 	arch/$(UARCH)/src/entry.s \
@@ -39,9 +37,3 @@
 	arch/$(UARCH)/src/stacktrace_asm.S
 
-GCC_CFLAGS += -march=pentium
-LFLAGS += -N
-
-ENDIANESS = LE
-
-BFD_NAME = elf32-i386
-BFD_ARCH = i386
+.PRECIOUS: arch/$(UARCH)/src/entry.o
Index: uspace/lib/libc/arch/ia32/_link.ld.in
===================================================================
--- uspace/lib/libc/arch/ia32/_link.ld.in	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/libc/arch/ia32/_link.ld.in	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,3 +1,3 @@
-STARTUP(LIBC_PREFIX/arch/UARCH/src/entry.o)
+STARTUP(LIBC_PATH/arch/UARCH/src/entry.o)
 ENTRY(__entry)
 
Index: uspace/lib/libc/arch/ia64/Makefile.common
===================================================================
--- uspace/lib/libc/arch/ia64/Makefile.common	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
+++ uspace/lib/libc/arch/ia64/Makefile.common	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -0,0 +1,34 @@
+#
+# 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.
+#
+
+GCC_CFLAGS += -fno-unwind-tables
+
+ENDIANESS = LE
+
+BFD_NAME = elf64-ia64-little
+BFD_ARCH = ia64-elf64
Index: uspace/lib/libc/arch/ia64/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/ia64/Makefile.inc	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/libc/arch/ia64/Makefile.inc	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -37,9 +37,3 @@
 	arch/$(UARCH)/src/stacktrace_asm.S
 
-GCC_CFLAGS += -fno-unwind-tables
-LFLAGS += -N $(SOFTINT_PREFIX)/libsoftint.a
-
-ENDIANESS = LE
-
-BFD_NAME = elf64-ia64-little
-BFD_ARCH = ia64-elf64
+.PRECIOUS: arch/$(UARCH)/src/entry.o
Index: uspace/lib/libc/arch/ia64/_link.ld.in
===================================================================
--- uspace/lib/libc/arch/ia64/_link.ld.in	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/libc/arch/ia64/_link.ld.in	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,3 +1,3 @@
-STARTUP(LIBC_PREFIX/arch/UARCH/src/entry.o)
+STARTUP(LIBC_PATH/arch/UARCH/src/entry.o)
 ENTRY(__entry)
 
Index: uspace/lib/libc/arch/ia64/include/types.h
===================================================================
--- uspace/lib/libc/arch/ia64/include/types.h	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/libc/arch/ia64/include/types.h	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -38,5 +38,5 @@
 #define __64_BITS__
 
-typedef unsigned long long sysarg_t;
+typedef unsigned long sysarg_t;
 
 typedef char int8_t;
Index: uspace/lib/libc/arch/mips32/Makefile.common
===================================================================
--- uspace/lib/libc/arch/mips32/Makefile.common	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
+++ uspace/lib/libc/arch/mips32/Makefile.common	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -0,0 +1,34 @@
+#
+# 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.
+#
+
+GCC_CFLAGS += -mips3
+
+ENDIANESS = LE
+
+BFD_ARCH = mips
+BFD_NAME = elf32-tradlittlemips
Index: uspace/lib/libc/arch/mips32/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/mips32/Makefile.inc	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/libc/arch/mips32/Makefile.inc	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -36,8 +36,3 @@
 	arch/$(UARCH)/src/stacktrace_asm.S
 
-GCC_CFLAGS += -mips3
-
-ENDIANESS = LE
-
-BFD_ARCH = mips
-BFD_NAME = elf32-tradlittlemips
+.PRECIOUS: arch/$(UARCH)/src/entry.o
Index: uspace/lib/libc/arch/mips32/_link.ld.in
===================================================================
--- uspace/lib/libc/arch/mips32/_link.ld.in	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/libc/arch/mips32/_link.ld.in	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,3 +1,3 @@
-STARTUP(LIBC_PREFIX/arch/UARCH/src/entry.o)
+STARTUP(LIBC_PATH/arch/UARCH/src/entry.o)
 ENTRY(__entry)
 
Index: uspace/lib/libc/arch/mips32eb/Makefile.common
===================================================================
--- uspace/lib/libc/arch/mips32eb/Makefile.common	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
+++ uspace/lib/libc/arch/mips32eb/Makefile.common	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -0,0 +1,34 @@
+#
+# 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.
+#
+
+GCC_CFLAGS += -mips3
+
+ENDIANESS = BE
+
+BFD_ARCH = mips
+BFD_NAME = elf32-tradbigmips
Index: uspace/lib/libc/arch/mips32eb/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/mips32eb/Makefile.inc	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/libc/arch/mips32eb/Makefile.inc	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -36,9 +36,3 @@
 	arch/$(UARCH)/src/stacktrace_asm.S
 
-GCC_CFLAGS += -mips3
-LFLAGS += -N
-
-ENDIANESS = BE
-
-BFD_ARCH = mips
-BFD_NAME = elf32-tradbigmips
+.PRECIOUS: arch/$(UARCH)/src/entry.o
Index: uspace/lib/libc/arch/ppc32/Makefile.common
===================================================================
--- uspace/lib/libc/arch/ppc32/Makefile.common	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
+++ uspace/lib/libc/arch/ppc32/Makefile.common	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 2006 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.
+#
+
+GCC_CFLAGS += -mcpu=powerpc -msoft-float -m32
+AFLAGS = -a32
+
+ENDIANESS = BE
+
+BFD_NAME = elf32-powerpc
+BFD_ARCH = powerpc:common
Index: uspace/lib/libc/arch/ppc32/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/ppc32/Makefile.inc	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/libc/arch/ppc32/Makefile.inc	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -36,10 +36,3 @@
 	arch/$(UARCH)/src/stacktrace_asm.S
 
-GCC_CFLAGS += -mcpu=powerpc -msoft-float -m32
-AFLAGS += -a32
-LFLAGS += -N
-
-ENDIANESS = BE
-
-BFD_NAME = elf32-powerpc
-BFD_ARCH = powerpc:common
+.PRECIOUS: arch/$(UARCH)/src/entry.o
Index: uspace/lib/libc/arch/ppc32/_link.ld.in
===================================================================
--- uspace/lib/libc/arch/ppc32/_link.ld.in	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/libc/arch/ppc32/_link.ld.in	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,3 +1,3 @@
-STARTUP(LIBC_PREFIX/arch/UARCH/src/entry.o)
+STARTUP(LIBC_PATH/arch/UARCH/src/entry.o)
 ENTRY(__entry)
 
Index: uspace/lib/libc/arch/sparc64/Makefile.common
===================================================================
--- uspace/lib/libc/arch/sparc64/Makefile.common	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
+++ uspace/lib/libc/arch/sparc64/Makefile.common	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -0,0 +1,47 @@
+#
+# Copyright (c) 2006 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.
+#
+
+GCC_CFLAGS += -mcpu=ultrasparc -m64
+LFLAGS = -no-check-sections
+
+ENDIANESS = BE
+
+BFD_NAME = elf64-sparc
+BFD_ARCH = sparc
+
+ifeq ($(PROCESSOR),us)
+	DEFS += -DSUN4U
+endif
+
+ifeq ($(PROCESSOR),us3)
+	DEFS += -DSUN4U
+endif
+
+ifeq ($(PROCESSOR),sun4v)
+	DEFS += -DSUN4V
+endif
Index: uspace/lib/libc/arch/sparc64/Makefile.inc
===================================================================
--- uspace/lib/libc/arch/sparc64/Makefile.inc	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/libc/arch/sparc64/Makefile.inc	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -35,21 +35,3 @@
 	arch/$(UARCH)/src/stacktrace_asm.S
 
-GCC_CFLAGS += -mcpu=ultrasparc -m64
-LFLAGS += -no-check-sections -N
-
-ENDIANESS = BE
-
-BFD_NAME = elf64-sparc
-BFD_ARCH = sparc
-
-ifeq ($(PROCESSOR),us)
-	DEFS += -DSUN4U
-endif
-
-ifeq ($(PROCESSOR),us3)
-	DEFS += -DSUN4U
-endif
-
-ifeq ($(PROCESSOR),sun4v)
-	DEFS += -DSUN4V
-endif
+.PRECIOUS: arch/$(UARCH)/src/entry.o
Index: uspace/lib/libc/arch/sparc64/_link.ld.in
===================================================================
--- uspace/lib/libc/arch/sparc64/_link.ld.in	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/libc/arch/sparc64/_link.ld.in	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,3 +1,3 @@
-STARTUP(LIBC_PREFIX/arch/UARCH/src/entry.o)
+STARTUP(LIBC_PATH/arch/UARCH/src/entry.o)
 ENTRY(__entry)
 
Index: uspace/lib/libfs/Makefile
===================================================================
--- uspace/lib/libfs/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/libfs/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,10 +29,8 @@
 
 USPACE_PREFIX = ../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = libfs.a
+LIBRARY = libfs
 
 SOURCES = \
 	libfs.c
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/libpci/Makefile
===================================================================
--- uspace/lib/libpci/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/libpci/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,7 +29,5 @@
 
 USPACE_PREFIX = ../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = libpci.a
+LIBRARY = libpci
 
 SOURCES = \
@@ -39,3 +37,3 @@
 	i386-ports.c
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/softfloat/Makefile
===================================================================
--- uspace/lib/softfloat/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/softfloat/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,8 +29,6 @@
 
 USPACE_PREFIX = ../..
-LIBS = $(LIBC_PREFIX)/libc.a
-EXTRA_CFLAGS += -Iinclude -Iarch/$(UARCH)/include/
-
-OUTPUT = libsoftfloat.a
+EXTRA_CFLAGS = -Iinclude -Iarch/$(UARCH)/include/
+LIBRARY = libsoftfloat
 
 SOURCES = \
@@ -45,3 +43,3 @@
 	generic/sub.c
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/softint/Makefile
===================================================================
--- uspace/lib/softint/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/lib/softint/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,8 +29,6 @@
 
 USPACE_PREFIX = ../..
-LIBS = $(LIBC_PREFIX)/libc.a
 EXTRA_CFLAGS = -Iinclude
-
-OUTPUT = libsoftint.a
+LIBRARY = libsoftint
 
 SOURCES = \
@@ -38,3 +36,3 @@
 	generic/multiplication.c
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: pace/srv/Makefile.common
===================================================================
--- uspace/srv/Makefile.common	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ 	(revision )
@@ -1,97 +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.
-#
-
-## Common rules for building servers.
-#
-
-# Individual makefiles set:
-#
-#	USPACE_PREFIX	relative path to uspace/ directory
-#	LIBS		libraries to link with (with relative path)
-#	EXTRA_CFLAGS	additional flags to pass to C compiler
-#	JOB		job file name (like appname.job)
-#	OUTPUT		output binary name (like appname)
-#	SOURCES		list of source files
-#
-
-DEPEND = Makefile.depend
-DEPEND_PREV = $(DEPEND).prev
-
-LIBC_PREFIX = $(USPACE_PREFIX)/lib/libc
-LIBBLOCK_PREFIX = $(USPACE_PREFIX)/lib/libblock
-LIBFS_PREFIX = $(USPACE_PREFIX)/lib/libfs
-LIBPCI_PREFIX = $(USPACE_PREFIX)/lib/libpci
-SOFTINT_PREFIX = $(USPACE_PREFIX)/lib/softint
-
-LINK_SCRIPT ?= $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld
-
-JOB = $(OUTPUT).job
-
-OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
-
-include $(LIBC_PREFIX)/Makefile.toolchain
-
-CFLAGS += $(EXTRA_CFLAGS)
-
-.PHONY: all build clean
-
-all: \
-    $(LIBC_PREFIX)/../../../version \
-    $(LIBC_PREFIX)/../../../Makefile.common \
-    $(LIBC_PREFIX)/../../../Makefile.config \
-    $(LIBC_PREFIX)/../../../config.h \
-    $(LIBS) \
-    \
-    $(OUTPUT) $(OUTPUT).disasm \
-    $(EXTRA_OUTPUT)
-	-[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV)
-
-clean:
-	rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm $(EXTRA_OUTPUT)
-	find . -name '*.o' -follow -exec rm \{\} \;
-
-build:
-
--include $(DEPEND)
-
-$(OUTPUT).disasm: $(OUTPUT)
-	$(OBJDUMP) -d $< > $@
-
-$(OUTPUT): $(LINK_SCRIPT) $(OBJECTS) $(LIBS)
-	$(LD) -T $(LINK_SCRIPT) $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
-
-%.o: %.c $(DEPEND)
-	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
-ifeq ($(PRECHECK),y)
-	$(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS)
-endif
-
-$(DEPEND):
-	makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
-	-[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
Index: uspace/srv/bd/ata_bd/Makefile
===================================================================
--- uspace/srv/bd/ata_bd/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/bd/ata_bd/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,10 +29,8 @@
 
 USPACE_PREFIX = ../../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = ata_bd
+BINARY = ata_bd
 
 SOURCES = \
 	ata_bd.c
 
-include ../../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/bd/file_bd/Makefile
===================================================================
--- uspace/srv/bd/file_bd/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/bd/file_bd/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,10 +29,8 @@
 
 USPACE_PREFIX = ../../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = file_bd
+BINARY = file_bd
 
 SOURCES = \
 	file_bd.c
 
-include ../../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/bd/gxe_bd/Makefile
===================================================================
--- uspace/srv/bd/gxe_bd/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/bd/gxe_bd/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,10 +29,8 @@
 
 USPACE_PREFIX = ../../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = gxe_bd
+BINARY = gxe_bd
 
 SOURCES = \
 	gxe_bd.c
 
-include ../../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/bd/part/guid_part/Makefile
===================================================================
--- uspace/srv/bd/part/guid_part/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/bd/part/guid_part/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -28,12 +28,12 @@
 
 USPACE_PREFIX = ../../../..
-LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBC_PREFIX)/libc.a
+LIBS = $(LIBBLOCK_PREFIX)/libblock.a
 EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX)
 
 # Correct name is 'guid_part' but must use this because of FAT 8.3 names.
-OUTPUT = g_part
+BINARY = g_part
 
 SOURCES = \
 	guid_part.c
 
-include ../../../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/bd/part/mbr_part/Makefile
===================================================================
--- uspace/srv/bd/part/mbr_part/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/bd/part/mbr_part/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,11 +29,10 @@
 
 USPACE_PREFIX = ../../../..
-LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBC_PREFIX)/libc.a
+LIBS = $(LIBBLOCK_PREFIX)/libblock.a
 EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX)
-
-OUTPUT = mbr_part
+BINARY = mbr_part
 
 SOURCES = \
 	mbr_part.c
 
-include ../../../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/bd/rd/Makefile
===================================================================
--- uspace/srv/bd/rd/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/bd/rd/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,10 +29,8 @@
 
 USPACE_PREFIX = ../../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = rd
+BINARY = rd
 
 SOURCES = \
 	rd.c
 
-include ../../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/clip/Makefile
===================================================================
--- uspace/srv/clip/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/clip/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,10 +29,8 @@
 
 USPACE_PREFIX = ../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = clip
+BINARY = clip
 
 SOURCES = \
 	clip.c
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/devmap/Makefile
===================================================================
--- uspace/srv/devmap/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/devmap/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,10 +29,8 @@
 
 USPACE_PREFIX = ../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = devmap
+BINARY = devmap
 
 SOURCES = \
 	devmap.c
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/fs/devfs/Makefile
===================================================================
--- uspace/srv/fs/devfs/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/fs/devfs/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,8 +29,7 @@
 
 USPACE_PREFIX = ../../..
-LIBS = $(LIBFS_PREFIX)/libfs.a $(LIBC_PREFIX)/libc.a
+LIBS = $(LIBFS_PREFIX)/libfs.a
 EXTRA_CFLAGS += -I$(LIBFS_PREFIX)
-
-OUTPUT = devfs
+BINARY = devfs
 
 SOURCES = \
@@ -38,3 +37,3 @@
 	devfs_ops.c
 
-include ../../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/fs/fat/Makefile
===================================================================
--- uspace/srv/fs/fat/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/fs/fat/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,8 +29,7 @@
 
 USPACE_PREFIX = ../../..
-LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBFS_PREFIX)/libfs.a $(LIBC_PREFIX)/libc.a
+LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBFS_PREFIX)/libfs.a
 EXTRA_CFLAGS += -I$(LIBBLOCK_PREFIX) -I$(LIBFS_PREFIX)
-
-OUTPUT = fat
+BINARY = fat
 
 SOURCES = \
@@ -41,3 +40,3 @@
 	fat_fat.c
 
-include ../../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/fs/tmpfs/Makefile
===================================================================
--- uspace/srv/fs/tmpfs/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/fs/tmpfs/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,8 +29,7 @@
 
 USPACE_PREFIX = ../../..
-LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBFS_PREFIX)/libfs.a $(LIBC_PREFIX)/libc.a
+LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBFS_PREFIX)/libfs.a
 EXTRA_CFLAGS += -I$(LIBBLOCK_PREFIX) -I$(LIBFS_PREFIX)
-
-OUTPUT = tmpfs
+BINARY = tmpfs
 
 SOURCES = \
@@ -39,3 +38,3 @@
 	tmpfs_dump.c
 
-include ../../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/hid/adb_mouse/Makefile
===================================================================
--- uspace/srv/hid/adb_mouse/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/hid/adb_mouse/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -28,8 +28,6 @@
 
 USPACE_PREFIX = ../../..
-LIBS = $(LIBC_PREFIX)/libc.a
 EXTRA_CFLAGS = -Iinclude
-
-OUTPUT = adb_ms
+BINARY = adb_ms
 
 SOURCES = \
@@ -37,3 +35,3 @@
 	adb_dev.c
 
-include ../../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/hid/char_mouse/Makefile
===================================================================
--- uspace/srv/hid/char_mouse/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/hid/char_mouse/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,8 +29,6 @@
 
 USPACE_PREFIX = ../../..
-LIBS = $(LIBC_PREFIX)/libc.a
 EXTRA_CFLAGS = -Iinclude
-
-OUTPUT = char_ms
+BINARY = char_ms
 
 SOURCES = \
@@ -39,3 +37,3 @@
 	chardev.c
 
-include ../../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/hid/console/Makefile
===================================================================
--- uspace/srv/hid/console/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/hid/console/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -28,13 +28,31 @@
 #
 
-include Makefile.common
+USPACE_PREFIX = ../../..
+BINARY = console
 
-.PHONY: all clean
+GENERIC_SOURCES = \
+	console.c \
+	screenbuffer.c \
+	keybuffer.c \
+	gcons.c
 
-all: $(LIBC_PREFIX)/../../../Makefile.common $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBS)
-	-[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV)
-	$(MAKE) -f Makefile.build PRECHECK=$(PRECHECK)
+IMAGES = \
+	gfx/helenos.ppm \
+	gfx/nameic.ppm \
+	gfx/cons_selected.ppm \
+	gfx/cons_idle.ppm \
+	gfx/cons_has_data.ppm \
+	gfx/cons_kernel.ppm \
+	gfx/anim_1.ppm \
+	gfx/anim_2.ppm \
+	gfx/anim_3.ppm \
+	gfx/anim_4.ppm
 
-clean:
-	rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm
-	find . -name '*.o' -follow -exec rm \{\} \;
+SOURCES = \
+	$(GENERIC_SOURCES) \
+	$(IMAGES)
+
+include $(USPACE_PREFIX)/Makefile.common
+
+%.o: %.ppm
+	$(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) $< $@
Index: pace/srv/hid/console/Makefile.build
===================================================================
--- uspace/srv/hid/console/Makefile.build	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ 	(revision )
@@ -1,82 +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.
-#
-
-## Setup toolchain
-#
-
-include Makefile.common
-include $(LIBC_PREFIX)/Makefile.toolchain
-
-## Sources
-#
-
-SOURCES = \
-	console.c \
-	screenbuffer.c \
-	keybuffer.c \
-	gcons.c
-
-IMAGES = \
-	gfx/helenos.ppm \
-	gfx/nameic.ppm \
-	gfx/cons_selected.ppm \
-	gfx/cons_idle.ppm \
-	gfx/cons_has_data.ppm \
-	gfx/cons_kernel.ppm \
-	gfx/anim_1.ppm \
-	gfx/anim_2.ppm \
-	gfx/anim_3.ppm \
-	gfx/anim_4.ppm
-
-OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) $(addsuffix .o,$(basename $(IMAGES)))
-
-.PHONY: all
-
-all: $(OUTPUT) $(OUTPUT).disasm
-
--include $(DEPEND)
-
-$(OUTPUT).disasm: $(OUTPUT)
-	$(OBJDUMP) -d $< > $@
-
-$(OUTPUT): $(OBJECTS) $(LIBS)
-	$(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
-
-%.o: %.c $(DEPEND)
-	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
-ifeq ($(PRECHECK),y)
-	$(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS)
-endif
-
-%.o: %.ppm
-	$(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) $< $@
-
-$(DEPEND):
-	makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
-	-[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
Index: pace/srv/hid/console/Makefile.common
===================================================================
--- uspace/srv/hid/console/Makefile.common	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ 	(revision )
@@ -1,40 +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.
-#
-
-
-## Common names
-#
-
-LIBC_PREFIX = ../../../lib/libc
-SOFTINT_PREFIX = ../../../lib/softint
-LIBS = $(LIBC_PREFIX)/libc.a
-
-DEPEND = Makefile.depend
-DEPEND_PREV = $(DEPEND).prev
-JOB = console.job
-OUTPUT = console
Index: uspace/srv/hid/fb/Makefile
===================================================================
--- uspace/srv/hid/fb/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/hid/fb/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -28,13 +28,55 @@
 #
 
-include Makefile.common
+USPACE_PREFIX = ../../..
+BINARY = fb
 
-.PHONY: all clean
+SOURCES = \
+	main.c \
+	ppm.c
 
-all: $(LIBC_PREFIX)/../../../Makefile.common $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBS)
-	-[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV)
-	$(MAKE) -f Makefile.build PRECHECK=$(PRECHECK)
+ifneq ($(UARCH),ia64)
+	SOURCES += fb.c \
+		font-8x16.c
+	EXTRA_CFLAGS = -DFB_ENABLED
+endif
 
-clean:
-	rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm
-	find . -name '*.o' -follow -exec rm \{\} \;
+ifeq ($(UARCH),ia32)
+	SOURCES += ega.c
+	EXTRA_CFLAGS = -DEGA_ENABLED
+endif
+
+ifeq ($(UARCH),ia64)
+	SOURCES += ega.c \
+		ski.c \
+		serial_console.c
+	EXTRA_CFLAGS = -DSKI_ENABLED -DEGA_ENABLED
+endif
+
+ifeq ($(UARCH),amd64)
+	SOURCES += ega.c
+	EXTRA_CFLAGS = -DEGA_ENABLED
+endif
+
+ifeq ($(UARCH),mips32)
+	SOURCES += msim.c \
+		serial_console.c
+	EXTRA_CFLAGS = -DMSIM_ENABLED
+endif
+
+ifeq ($(UARCH),sparc64)
+	ifeq ($(PROCESSOR), sun4v)
+		SOURCES += niagara.c \
+			serial_console.c
+		EXTRA_CFLAGS = -DNIAGARA_ENABLED
+	endif
+
+	ifeq ($(MACHINE), serengeti)
+		SOURCES += sgcn.c \
+			serial_console.c
+		EXTRA_CFLAGS = -DSGCN_ENABLED
+	endif
+endif
+
+EXTRA_CFLAGS += -D$(UARCH)
+
+include $(USPACE_PREFIX)/Makefile.common
Index: pace/srv/hid/fb/Makefile.build
===================================================================
--- uspace/srv/hid/fb/Makefile.build	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ 	(revision )
@@ -1,111 +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.
-#
-
-## Setup toolchain
-#
-
-include Makefile.common
-include $(LIBC_PREFIX)/Makefile.toolchain
-
-## Sources
-#
-
-SOURCES = \
-	main.c \
-	ppm.c
-
-ifneq ($(UARCH),ia64)
-	SOURCES += fb.c \
-		font-8x16.c
-	CFLAGS += -DFB_ENABLED
-endif
-
-ifeq ($(UARCH),ia32)
-	SOURCES += ega.c
-	CFLAGS += -DEGA_ENABLED
-endif
-
-ifeq ($(UARCH),ia64)
-	SOURCES += ega.c \
-		ski.c \
-		serial_console.c
-	CFLAGS += -DSKI_ENABLED
-	CFLAGS += -DEGA_ENABLED
-endif
-
-ifeq ($(UARCH),amd64)
-	SOURCES += ega.c
-	CFLAGS += -DEGA_ENABLED
-endif
-
-ifeq ($(UARCH),mips32)
-	SOURCES += msim.c \
-		serial_console.c
-	CFLAGS += -DMSIM_ENABLED
-endif
-
-ifeq ($(UARCH),sparc64)
-	ifeq ($(PROCESSOR), sun4v)
-		SOURCES += niagara.c \
-			serial_console.c
-		CFLAGS += -DNIAGARA_ENABLED
-	endif
-
-	ifeq ($(MACHINE), serengeti)
-		SOURCES += sgcn.c \
-			serial_console.c
-		CFLAGS += -DSGCN_ENABLED
-	endif
-endif
-
-CFLAGS += -D$(UARCH)
-
-OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
-
-.PHONY: all
-
-all: $(OUTPUT) $(OUTPUT).disasm
-
--include $(DEPEND)
-
-$(OUTPUT).disasm: $(OUTPUT)
-	$(OBJDUMP) -d $< > $@
-
-$(OUTPUT): $(OBJECTS) $(LIBS)
-	$(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
-
-%.o: %.c $(DEPEND)
-	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
-ifeq ($(PRECHECK),y)
-	$(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS)
-endif
-
-$(DEPEND):
-	makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
-	-[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
Index: pace/srv/hid/fb/Makefile.common
===================================================================
--- uspace/srv/hid/fb/Makefile.common	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ 	(revision )
@@ -1,40 +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.
-#
-
-
-## Common names
-#
-
-LIBC_PREFIX = ../../../lib/libc
-SOFTINT_PREFIX = ../../../lib/softint
-LIBS = $(LIBC_PREFIX)/libc.a
-
-DEPEND = Makefile.depend
-DEPEND_PREV = $(DEPEND).prev
-JOB = fb.job
-OUTPUT = fb
Index: uspace/srv/hid/kbd/Makefile
===================================================================
--- uspace/srv/hid/kbd/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/hid/kbd/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -28,13 +28,135 @@
 #
 
-include Makefile.common
+USPACE_PREFIX = ../../..
+ROOT_PATH = $(USPACE_PREFIX)/..
 
-.PHONY: all clean
+COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
+CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
 
-all: $(LIBC_PREFIX)/../../../Makefile.common $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBS)
-	-[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV)
-	$(MAKE) -f Makefile.build PRECHECK=$(PRECHECK)
+EXTRA_CFLAGS = -Iinclude
+BINARY = kbd
 
-clean:
-	rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm
-	find . -name '*.o' -follow -exec rm \{\} \;
+-include $(COMMON_MAKEFILE)
+-include $(CONFIG_MAKEFILE)
+
+## Sources
+#
+
+SOURCES = \
+	generic/kbd.c \
+	genarch/gsp.c \
+	genarch/stroke.c \
+	layout/cz.c \
+	layout/us_qwerty.c \
+	layout/us_dvorak.c
+
+ifeq ($(UARCH),amd64)
+	SOURCES += \
+		port/chardev.c \
+		ctl/pc.c
+endif
+
+ifeq ($(UARCH),arm32)
+	ifeq ($(MACHINE),testarm)
+		SOURCES += \
+			port/gxemul.c
+		
+		ifeq ($(CONFIG_FB),y)
+			SOURCES += \
+				ctl/gxe_fb.c
+		else
+			SOURCES += \
+				ctl/stty.c
+		endif
+	endif
+	ifeq ($(MACHINE),integratorcp)
+		SOURCES += \
+			port/pl050.c \
+			ctl/pl050.c
+	endif
+endif
+
+ifeq ($(UARCH),ia32)
+	SOURCES += \
+		port/chardev.c \
+		ctl/pc.c
+endif
+
+ifeq ($(MACHINE),i460GX)
+	SOURCES += \
+		port/chardev.c \
+		ctl/pc.c
+endif
+
+ifeq ($(MACHINE),ski)
+	SOURCES += \
+		port/ski.c \
+		ctl/stty.c
+endif
+
+ifeq ($(MACHINE),msim)
+	SOURCES += \
+		port/msim.c \
+		ctl/stty.c
+endif
+
+ifeq ($(MACHINE),lgxemul)
+	SOURCES += \
+		port/gxemul.c
+	
+	ifeq ($(CONFIG_FB),y)
+		SOURCES += \
+			ctl/gxe_fb.c
+	else
+		SOURCES += \
+			ctl/stty.c
+	endif
+endif
+
+ifeq ($(MACHINE),bgxemul)
+	SOURCES += \
+		port/gxemul.c
+	
+	ifeq ($(CONFIG_FB),y)
+		SOURCES += \
+			ctl/gxe_fb.c
+	else
+		SOURCES += \
+			ctl/stty.c
+	endif
+endif
+
+ifeq ($(UARCH),ppc32)
+	SOURCES += \
+		port/adb.c \
+		ctl/apple.c
+endif
+
+ifeq ($(UARCH),sparc64)
+	ifeq ($(PROCESSOR),sun4v)
+		SOURCES += \
+			port/niagara.c \
+			ctl/stty.c
+	else
+		ifeq ($(MACHINE),serengeti)
+			SOURCES += \
+				port/sgcn.c \
+				ctl/stty.c
+		endif
+		ifeq ($(MACHINE),generic)
+			SOURCES += \
+			port/sun.c \
+			port/z8530.c \
+			port/ns16550.c \
+			ctl/sun.c
+		endif
+	endif
+endif
+
+ifeq ($(UARCH),abs32le)
+	SOURCES += \
+		port/dummy.c \
+		ctl/pc.c
+endif
+
+include $(USPACE_PREFIX)/Makefile.common
Index: pace/srv/hid/kbd/Makefile.build
===================================================================
--- uspace/srv/hid/kbd/Makefile.build	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ 	(revision )
@@ -1,180 +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.
-#
-
-## Setup toolchain
-#
-
-include Makefile.common
-include $(LIBC_PREFIX)/Makefile.toolchain
-
-CFLAGS += -Iinclude
-
-## Sources
-#
-
-SOURCES = \
-	generic/kbd.c \
-	genarch/gsp.c \
-	genarch/stroke.c \
-	layout/cz.c \
-	layout/us_qwerty.c \
-	layout/us_dvorak.c
-
-ifeq ($(UARCH),amd64)
-	SOURCES += \
-		port/chardev.c \
-		ctl/pc.c
-endif
-
-ifeq ($(UARCH),arm32)
-	ifeq ($(MACHINE),testarm)
-		SOURCES += \
-			port/gxemul.c
-		
-		ifeq ($(CONFIG_FB),y)
-			SOURCES += \
-				ctl/gxe_fb.c
-		else
-			SOURCES += \
-				ctl/stty.c
-		endif
-	endif
-	ifeq ($(MACHINE),integratorcp)
-		SOURCES += \
-			port/pl050.c \
-			ctl/pl050.c
-	endif
-endif
-
-ifeq ($(UARCH),ia32)
-	SOURCES += \
-		port/chardev.c \
-		ctl/pc.c
-endif
-
-ifeq ($(MACHINE),i460GX)
-	SOURCES += \
-		port/chardev.c \
-		ctl/pc.c
-endif
-
-ifeq ($(MACHINE),ski)
-	SOURCES += \
-		port/ski.c \
-		ctl/stty.c
-endif
-
-ifeq ($(MACHINE),msim)
-	SOURCES += \
-		port/msim.c \
-		ctl/stty.c
-endif
-
-ifeq ($(MACHINE),lgxemul)
-	SOURCES += \
-		port/gxemul.c
-	
-	ifeq ($(CONFIG_FB),y)
-		SOURCES += \
-			ctl/gxe_fb.c
-	else
-		SOURCES += \
-			ctl/stty.c
-	endif
-endif
-
-ifeq ($(MACHINE),bgxemul)
-	SOURCES += \
-		port/gxemul.c
-	
-	ifeq ($(CONFIG_FB),y)
-		SOURCES += \
-			ctl/gxe_fb.c
-	else
-		SOURCES += \
-			ctl/stty.c
-	endif
-endif
-
-ifeq ($(UARCH),ppc32)
-	SOURCES += \
-		port/adb.c \
-		ctl/apple.c
-endif
-
-ifeq ($(UARCH),sparc64)
-	ifeq ($(PROCESSOR),sun4v)
-		SOURCES += \
-			port/niagara.c \
-			ctl/stty.c
-	else
-		ifeq ($(MACHINE),serengeti)
-			SOURCES += \
-				port/sgcn.c \
-				ctl/stty.c
-		endif
-		ifeq ($(MACHINE),generic)
-			SOURCES += \
-			port/sun.c \
-			port/z8530.c \
-			port/ns16550.c \
-			ctl/sun.c
-		endif
-	endif
-endif
-
-ifeq ($(UARCH),abs32le)
-	SOURCES += \
-		port/dummy.c \
-		ctl/pc.c
-endif
-
-OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
-
-.PHONY: all
-
-all: $(OUTPUT) $(OUTPUT).disasm
-
--include $(DEPEND)
-
-$(OUTPUT).disasm: $(OUTPUT)
-	$(OBJDUMP) -d $< > $@
-
-$(OUTPUT): $(OBJECTS) $(LIBS)
-	$(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
-
-%.o: %.c $(DEPEND)
-	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
-ifeq ($(PRECHECK),y)
-	$(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS)
-endif
-
-$(DEPEND):
-	makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
-	-[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
Index: pace/srv/hid/kbd/Makefile.common
===================================================================
--- uspace/srv/hid/kbd/Makefile.common	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ 	(revision )
@@ -1,40 +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.
-#
-
-
-## Common names
-#
-
-LIBC_PREFIX = ../../../lib/libc
-SOFTINT_PREFIX = ../../../lib/softint
-LIBS = $(LIBC_PREFIX)/libc.a
-
-DEPEND = Makefile.depend
-DEPEND_PREV = $(DEPEND).prev
-JOB = kbd.job
-OUTPUT = kbd
Index: uspace/srv/hw/bus/cuda_adb/Makefile
===================================================================
--- uspace/srv/hw/bus/cuda_adb/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/hw/bus/cuda_adb/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -28,11 +28,8 @@
 
 USPACE_PREFIX = ../../../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = cuda_adb
+BINARY = cuda_adb
 
 SOURCES = \
 	cuda_adb.c
 
-include ../../../Makefile.common
-
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/hw/bus/pci/Makefile
===================================================================
--- uspace/srv/hw/bus/pci/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/hw/bus/pci/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,11 +29,10 @@
 
 USPACE_PREFIX = ../../../..
-LIBS = $(LIBPCI_PREFIX)/libpci.a $(LIBC_PREFIX)/libc.a
+LIBS = $(LIBPCI_PREFIX)/libpci.a
 EXTRA_CFLAGS = -I$(LIBPCI_PREFIX)
-
-OUTPUT = pci
+BINARY = pci
 
 SOURCES = \
 	pci.c
 
-include ../../../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/hw/char/i8042/Makefile
===================================================================
--- uspace/srv/hw/char/i8042/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/hw/char/i8042/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,10 +29,8 @@
 
 USPACE_PREFIX = ../../../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = i8042
+BINARY = i8042
 
 SOURCES = \
 	i8042.c
 
-include ../../../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/hw/cir/fhc/Makefile
===================================================================
--- uspace/srv/hw/cir/fhc/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/hw/cir/fhc/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,10 +29,8 @@
 
 USPACE_PREFIX = ../../../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = fhc
+BINARY = fhc
 
 SOURCES = \
 	fhc.c
 
-include ../../../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/hw/cir/obio/Makefile
===================================================================
--- uspace/srv/hw/cir/obio/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/hw/cir/obio/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,10 +29,8 @@
 
 USPACE_PREFIX = ../../../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = obio
+BINARY = obio
 
 SOURCES = \
 	obio.c
 
-include ../../../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/loader/Makefile
===================================================================
--- uspace/srv/loader/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/loader/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -28,15 +28,20 @@
 #
 
--include ../../../Makefile.common
--include ../../../Makefile.config
+USPACE_PREFIX = ../..
+ROOT_PATH = $(USPACE_PREFIX)/..
+
+COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
+CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
+
+-include $(COMMON_MAKEFILE)
+-include $(CONFIG_MAKEFILE)
 -include arch/$(UARCH)/Makefile.inc
 
-USPACE_PREFIX = ../..
-LIBS = $(LIBC_PREFIX)/libc.a
-EXTRA_CFLAGS += -Iinclude
-LINK_SCRIPT = arch/$(UARCH)/_link.ld
+LINKER_SCRIPT = arch/$(UARCH)/_link.ld
+EXTRA_CLEAN = $(LINKER_SCRIPT)
 
-OUTPUT = loader
-EXTRA_OUTPUT = $(LINK_SCRIPT)
+EXTRA_CFLAGS = -Iinclude
+
+BINARY = loader
 
 GENERIC_SOURCES = \
@@ -45,9 +50,10 @@
 	interp.s
 
-SOURCES := $(GENERIC_SOURCES) $(ARCH_SOURCES)
-OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
+SOURCES = \
+	$(GENERIC_SOURCES) \
+	$(ARCH_SOURCES)
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
 
-$(LINK_SCRIPT): $(LINK_SCRIPT).in
+$(LINKER_SCRIPT): $(LINKER_SCRIPT).in
 	$(GCC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@
Index: uspace/srv/loader/arch/abs32le/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/abs32le/Makefile.inc	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/loader/arch/abs32le/Makefile.inc	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -27,3 +27,3 @@
 #
 
-ARCH_SOURCES := arch/$(UARCH)/abs32le.c
+ARCH_SOURCES = arch/$(UARCH)/abs32le.c
Index: uspace/srv/loader/arch/amd64/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/amd64/Makefile.inc	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/loader/arch/amd64/Makefile.inc	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -27,3 +27,3 @@
 #
 
-ARCH_SOURCES := arch/$(UARCH)/amd64.s
+ARCH_SOURCES = arch/$(UARCH)/amd64.s
Index: uspace/srv/loader/arch/arm32/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/arm32/Makefile.inc	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/loader/arch/arm32/Makefile.inc	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -27,3 +27,3 @@
 #
 
-ARCH_SOURCES := arch/$(UARCH)/arm32.s
+ARCH_SOURCES = arch/$(UARCH)/arm32.s
Index: uspace/srv/loader/arch/ia32/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/ia32/Makefile.inc	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/loader/arch/ia32/Makefile.inc	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -27,3 +27,3 @@
 #
 
-ARCH_SOURCES := arch/$(UARCH)/ia32.s
+ARCH_SOURCES = arch/$(UARCH)/ia32.s
Index: uspace/srv/loader/arch/ia64/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/ia64/Makefile.inc	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/loader/arch/ia64/Makefile.inc	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -27,4 +27,4 @@
 #
 
-ARCH_SOURCES := arch/$(UARCH)/ia64.s
+ARCH_SOURCES = arch/$(UARCH)/ia64.s
 AFLAGS += -xexplicit
Index: uspace/srv/loader/arch/mips32/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/mips32/Makefile.inc	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/loader/arch/mips32/Makefile.inc	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -27,3 +27,3 @@
 #
 
-ARCH_SOURCES := arch/$(UARCH)/mips32.s
+ARCH_SOURCES = arch/$(UARCH)/mips32.s
Index: uspace/srv/loader/arch/ppc32/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/ppc32/Makefile.inc	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/loader/arch/ppc32/Makefile.inc	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -27,3 +27,3 @@
 #
 
-ARCH_SOURCES := arch/$(UARCH)/ppc32.s
+ARCH_SOURCES = arch/$(UARCH)/ppc32.s
Index: uspace/srv/loader/arch/sparc64/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/sparc64/Makefile.inc	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/loader/arch/sparc64/Makefile.inc	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -27,3 +27,3 @@
 #
 
-ARCH_SOURCES := arch/$(UARCH)/sparc64.s
+ARCH_SOURCES = arch/$(UARCH)/sparc64.s
Index: pace/srv/net/Makefile
===================================================================
--- uspace/srv/net/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ 	(revision )
@@ -1,92 +1,0 @@
-#
-# Copyright (c) 2009 Lukas Mejdrech
-# 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.
-#
-
-include ../../../Makefile.common
-include ../../../Makefile.config
-
-# keep netif drivers before nil modules
-# in order to support networking architectures build
-
-ifeq ($(CONFIG_NETIF_DP8390),y)
-	DIRS = netif/dp8390
-else
-	DIRS =
-endif
-
-DIRS += \
-	netif/lo \
-	nil/eth \
-	nil/nildummy \
-	net \
-	net/start \
-	socket \
-	app/echo \
-	app/ping \
-	app/nettest1 \
-	app/nettest2
-
-DIRS_MODULAR = \
-		il/arp \
-		il/ip \
-		tl/icmp \
-		tl/udp \
-		tl/tcp \
-
-DIRS_ALL = $(DIRS) $(DIRS_MODULAR)
-
-ifeq ($(NETWORKING), module)
-	BUILDS := $(addsuffix .build,$(DIRS))
-else
-ifeq ($(NETWORKING), modular)
-	BUILDS := $(addsuffix .build,$(DIRS_ALL))
-endif
-endif
-
-CLEANS := $(addsuffix .clean,$(DIRS_ALL))
-
-CHECKS := $(addsuffix .check,$(basename $(BUILDS)))
-
-.PHONY: all build $(BUILDS) $(CLEANS) clean
-
-all: $(BUILDS)
-
-build: $(BUILDS)
-
-check: $(CHECKS)
-
-clean: $(CLEANS)
-	find $(DIRS_ALL) ./ -name '*.o' -follow -exec rm \{\} \;
-
-$(CHECKS):
-	-$(MAKE) -C $(basename $@) check
-
-$(CLEANS):
-	-$(MAKE) -C $(basename $@) clean
-
-$(BUILDS):
-	$(MAKE) -C $(basename $@) all
Index: pace/srv/net/Makefile.module
===================================================================
--- uspace/srv/net/Makefile.module	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ 	(revision )
@@ -1,86 +1,0 @@
-#
-# Copyright (c) 2009 Lukas Mejdrech
-# 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.
-#
-
-## Setup toolchain
-#
-
-LIBC_PREFIX = $(NET_BASE)../../lib/libc
-SOFTINT_PREFIX = $(NET_BASE)../../lib/softint
-include $(LIBC_PREFIX)/Makefile.toolchain
-
-CFLAGS += -Iinclude -I../libadt/include
-CFLAGS += -Wno-strict-aliasing
-
-CHECK_CFLAGS = -fsyntax-only -Wextra -Wno-div-by-zero -Wsystem-headers -Wfloat-equal -Wdeclaration-after-statement -Wundef -Wno-endif-labels -Wshadow -Wlarger-than-1500 -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wmissing-field-initializers -Wmissing-noreturn -Wmissing-format-attribute -Wno-multichar -Wno-deprecated-declarations -Wpacked -Wpadded -Wredundant-decls -Wnested-externs -Wunreachable-code -Winline -Winvalid-pch -Wlong-long -Wvariadic-macros -Wdisabled-optimization -Wno-pointer-sign
-#-Wtraditional
-
-LIBS += $(LIBC_PREFIX)/libc.a
-
-DEPEND = Makefile.depend
-DEPEND_PREV = $(DEPEND).prev
-
-DEFS += $(NET_DEFS)
-
-OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
-DISASMS := $(addsuffix .disasm,$(basename $(OUTPUT)))
-
-.PHONY: all clean disasm
-
-all: $(OUTPUT) $(LIB) $(DISASMS)
-
-check:
-	$(CC) $(DEFS) $(CFLAGS) $(CHECK_CFLAGS) *.c
-
--include $(DEPEND)
-
-clean:
-	-rm -f $(OUTPUT) $(LIB) $(OUTPUT).map $(addsuffix .map,$(basename $(SOURCES))) $(DISASMS) $(DEPEND)
-
-$(OUTPUT): $(OBJECTS) $(LIBS)
-	$(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
-
-$(LIB): $(OBJECTS)
-	$(AR) rc $(LIB) $(OBJECTS)
-
-disasm: $(DISASMS)
-
-%.disasm: %
-	$(OBJDUMP) -d $< >$@
-
-%.o: %.S
-	$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
-
-%.o: %.s
-	$(AS) $(AFLAGS) $< -o $@
-
-%.o: %.c $(DEPEND)
-	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
-
-$(DEPEND):
-	makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
-	-[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
Index: uspace/srv/net/app/echo/Makefile
===================================================================
--- uspace/srv/net/app/echo/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/net/app/echo/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,4 +1,5 @@
 #
-# Copyright (c) 2009 Lukas Mejdrech
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
 # All rights reserved.
 #
@@ -27,22 +28,13 @@
 #
 
-NAME = echo
+NET_BASE = ../..
+USPACE_PREFIX = ../../../..
+LIBS = $(NET_BASE)/socket/libsocket.a
+BINARY = echo
 
-NET_BASE = ../../
-STRUCTURES = $(NET_BASE)structures/
+SOURCES = \
+	echo.c \
+	$(NET_BASE)/app/parse.c \
+	$(NET_BASE)/app/print_error.c
 
-include ../../../../../Makefile.common
-include ../../../../../Makefile.config
-
-## Sources
-#
-
-OUTPUT = $(NAME)
-SOURCES = \
-	$(NAME).c \
-	$(NET_BASE)app/parse.c \
-	$(NET_BASE)app/print_error.c
-
-LIBS += ../../socket/libsocket.a
-
-include $(NET_BASE)Makefile.module
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/net/app/nettest1/Makefile
===================================================================
--- uspace/srv/net/app/nettest1/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/net/app/nettest1/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,4 +1,5 @@
 #
-# Copyright (c) 2009 Lukas Mejdrech
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
 # All rights reserved.
 #
@@ -27,23 +28,14 @@
 #
 
-NAME = nettest1
+NET_BASE = ../..
+USPACE_PREFIX = ../../../..
+LIBS = $(NET_BASE)/socket/libsocket.a
+BINARY = nettest1
 
-NET_BASE = ../../
-STRUCTURES = $(NET_BASE)structures/
+SOURCES = \
+	nettest1.c \
+	$(NET_BASE)/app/nettest.c \
+	$(NET_BASE)/app/parse.c \
+	$(NET_BASE)/app/print_error.c
 
-include ../../../../../Makefile.common
-include ../../../../../Makefile.config
-
-## Sources
-#
-
-OUTPUT = $(NAME)
-SOURCES = \
-	$(NAME).c \
-	$(NET_BASE)app/nettest.c \
-	$(NET_BASE)app/parse.c \
-	$(NET_BASE)app/print_error.c
-
-LIBS += ../../socket/libsocket.a
-
-include $(NET_BASE)Makefile.module
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/net/app/nettest2/Makefile
===================================================================
--- uspace/srv/net/app/nettest2/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/net/app/nettest2/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,4 +1,5 @@
 #
-# Copyright (c) 2009 Lukas Mejdrech
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
 # All rights reserved.
 #
@@ -27,23 +28,14 @@
 #
 
-NAME = nettest2
+NET_BASE = ../..
+USPACE_PREFIX = ../../../..
+LIBS = $(NET_BASE)/socket/libsocket.a
+BINARY = nettest2
 
-NET_BASE = ../../
-STRUCTURES = $(NET_BASE)structures/
+SOURCES = \
+	nettest2.c \
+	$(NET_BASE)/app/nettest.c \
+	$(NET_BASE)/app/parse.c \
+	$(NET_BASE)/app/print_error.c
 
-include ../../../../../Makefile.common
-include ../../../../../Makefile.config
-
-## Sources
-#
-
-OUTPUT = $(NAME)
-SOURCES = \
-	$(NAME).c \
-	$(NET_BASE)app/nettest.c \
-	$(NET_BASE)app/parse.c \
-	$(NET_BASE)app/print_error.c
-
-LIBS += ../../socket/libsocket.a
-
-include $(NET_BASE)Makefile.module
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/net/app/ping/Makefile
===================================================================
--- uspace/srv/net/app/ping/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/net/app/ping/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,4 +1,5 @@
 #
-# Copyright (c) 2009 Lukas Mejdrech
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
 # All rights reserved.
 #
@@ -27,24 +28,17 @@
 #
 
-NAME = ping
+NET_BASE = ../..
+USPACE_PREFIX = ../../../..
+LIBS = $(NET_BASE)/socket/libsocket.a
+BINARY = ping
 
-NET_BASE = ../../
-STRUCTURES = $(NET_BASE)structures/
+SOURCES = \
+	ping.c \
+	$(NET_BASE)/app/parse.c \
+	$(NET_BASE)/app/print_error.c \
+	$(NET_BASE)/inet.c \
+	$(NET_BASE)/modules.c \
+	$(NET_BASE)/tl/icmp/icmp_api.c \
+	$(NET_BASE)/tl/icmp/icmp_common.c
 
-include ../../../../../Makefile.common
-include ../../../../../Makefile.config
-
-## Sources
-#
-
-OUTPUT = $(NAME)
-SOURCES = \
-	$(NAME).c \
-	$(NET_BASE)app/parse.c \
-	$(NET_BASE)app/print_error.c \
-	$(NET_BASE)inet.c \
-	$(NET_BASE)modules.c \
-	$(NET_BASE)tl/icmp/icmp_api.c \
-	$(NET_BASE)tl/icmp/icmp_common.c
-
-include $(NET_BASE)Makefile.module
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/net/il/arp/Makefile
===================================================================
--- uspace/srv/net/il/arp/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/net/il/arp/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,4 +1,5 @@
 #
-# Copyright (c) 2009 Lukas Mejdrech
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
 # All rights reserved.
 #
@@ -27,25 +28,20 @@
 #
 
-NAME = arp
+NET_BASE = ../..
+USPACE_PREFIX = ../../../..
+BINARY = arp
 
-NET_BASE = ../../
-STRUCTURES = $(NET_BASE)structures/
+SOURCES = \
+	arp.c \
+	arp_module.c \
+	$(NET_BASE)/module.c \
+	$(NET_BASE)/modules.c \
+	$(NET_BASE)/net/net_remote.c \
+	$(NET_BASE)/nil/nil_remote.c \
+	$(NET_BASE)/structures/char_map.c \
+	$(NET_BASE)/structures/measured_strings.c \
+	$(NET_BASE)/structures/packet/packet.c \
+	$(NET_BASE)/structures/packet/packet_client.c \
+	$(NET_BASE)/structures/packet/packet_remote.c
 
-## Sources
-#
-
-OUTPUT = $(NAME)
-SOURCES = \
-	$(NAME).c \
-	$(NAME)_module.c \
-	$(NET_BASE)module.c \
-	$(NET_BASE)modules.c \
-	$(NET_BASE)net/net_remote.c \
-	$(NET_BASE)nil/nil_remote.c \
-	$(STRUCTURES)char_map.c \
-	$(STRUCTURES)measured_strings.c \
-	$(STRUCTURES)packet/packet.c \
-	$(STRUCTURES)packet/packet_client.c \
-	$(STRUCTURES)packet/packet_remote.c
-
-include $(NET_BASE)Makefile.module
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/net/il/ip/Makefile
===================================================================
--- uspace/srv/net/il/ip/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/net/il/ip/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,4 +1,5 @@
 #
-# Copyright (c) 2009 Lukas Mejdrech
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
 # All rights reserved.
 #
@@ -27,33 +28,28 @@
 #
 
-NAME = ip
+NET_BASE = ../..
+USPACE_PREFIX = ../../../..
+BINARY = ip
 
-NET_BASE = ../../
-STRUCTURES = $(NET_BASE)structures/
+SOURCES = \
+	ip.c \
+	ip_client.c \
+	ip_module.c \
+	$(NET_BASE)/checksum.c \
+	$(NET_BASE)/inet.c \
+	$(NET_BASE)/module.c \
+	$(NET_BASE)/modules.c \
+	$(NET_BASE)/il/arp/arp_remote.c \
+	$(NET_BASE)/nil/nil_remote.c \
+	$(NET_BASE)/net/net_remote.c \
+	$(NET_BASE)/tl/icmp/icmp_client.c \
+	$(NET_BASE)/tl/icmp/icmp_common.c \
+	$(NET_BASE)/tl/icmp/icmp_remote.c \
+	$(NET_BASE)/structures/char_map.c \
+	$(NET_BASE)/structures/measured_strings.c \
+	$(NET_BASE)/structures/module_map.c \
+	$(NET_BASE)/structures/packet/packet.c \
+	$(NET_BASE)/structures/packet/packet_client.c \
+	$(NET_BASE)/structures/packet/packet_remote.c
 
-## Sources
-#
-
-OUTPUT = $(NAME)
-SOURCES = \
-	$(NAME).c \
-	$(NAME)_client.c \
-	$(NAME)_module.c \
-	$(NET_BASE)checksum.c \
-	$(NET_BASE)inet.c \
-	$(NET_BASE)module.c \
-	$(NET_BASE)modules.c \
-	$(NET_BASE)il/arp/arp_remote.c \
-	$(NET_BASE)nil/nil_remote.c \
-	$(NET_BASE)net/net_remote.c \
-	$(NET_BASE)tl/icmp/icmp_client.c \
-	$(NET_BASE)tl/icmp/icmp_common.c \
-	$(NET_BASE)tl/icmp/icmp_remote.c \
-	$(STRUCTURES)char_map.c \
-	$(STRUCTURES)measured_strings.c \
-	$(STRUCTURES)module_map.c \
-	$(STRUCTURES)packet/packet.c \
-	$(STRUCTURES)packet/packet_client.c \
-	$(STRUCTURES)packet/packet_remote.c
-
-include $(NET_BASE)Makefile.module
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/net/net/Makefile
===================================================================
--- uspace/srv/net/net/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/net/net/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,4 +1,5 @@
 #
-# Copyright (c) 2009 Lukas Mejdrech
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
 # All rights reserved.
 #
@@ -27,50 +28,50 @@
 #
 
-NAME = net
+NET_BASE = ..
+USPACE_PREFIX = ../../..
+ROOT_PATH = $(USPACE_PREFIX)/..
 
-NET_BASE = ../
-STRUCTURES = $(NET_BASE)structures/
+COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
+CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
 
-include $(NET_BASE)../../../Makefile.common
-include $(NET_BASE)../../../Makefile.config
+BINARY = net
 
-## Sources
-#
+-include $(COMMON_MAKEFILE)
+-include $(CONFIG_MAKEFILE)
 
-OUTPUT = $(NAME)
 SOURCES = \
-	$(NAME).c \
-	$(NET_BASE)module.c \
-	$(NET_BASE)modules.c \
-	$(NET_BASE)netif/netif_remote.c \
-	$(STRUCTURES)char_map.c \
-	$(STRUCTURES)measured_strings.c \
-	$(STRUCTURES)module_map.c \
-	$(STRUCTURES)packet/packet.c \
-	$(STRUCTURES)packet/packet_client.c \
-	$(STRUCTURES)packet/packet_server.c
+	net.c \
+	$(NET_BASE)/module.c \
+	$(NET_BASE)/modules.c \
+	$(NET_BASE)/netif/netif_remote.c \
+	$(NET_BASE)/structures/char_map.c \
+	$(NET_BASE)/structures/measured_strings.c \
+	$(NET_BASE)/structures/module_map.c \
+	$(NET_BASE)/structures/packet/packet.c \
+	$(NET_BASE)/structures/packet/packet_client.c \
+	$(NET_BASE)/structures/packet/packet_server.c
 
-ifeq ($(NETWORKING), module)
-
-	SOURCES +=	$(NAME)_bundle.c \
-				$(NET_BASE)checksum.c \
-				$(NET_BASE)inet.c \
-				$(NET_BASE)il/arp/arp.c \
-				$(NET_BASE)il/ip/ip.c \
-				$(NET_BASE)il/ip/ip_client.c \
-				$(NET_BASE)socket/socket_core.c \
-				$(NET_BASE)tl/icmp/icmp.c \
-				$(NET_BASE)tl/icmp/icmp_client.c \
-				$(NET_BASE)tl/tcp/tcp.c \
-				$(NET_BASE)tl/tl_common.c \
-				$(NET_BASE)tl/udp/udp.c \
-				$(STRUCTURES)dynamic_fifo.c
-
-else
-
-	SOURCES +=	$(NAME)_standalone.c \
-				$(NET_BASE)il/ip/ip_remote.c
-
+ifeq ($(CONFIG_NETWORKING),module)
+	SOURCES += \
+		net_bundle.c \
+		$(NET_BASE)/checksum.c \
+		$(NET_BASE)/inet.c \
+		$(NET_BASE)/il/arp/arp.c \
+		$(NET_BASE)/il/ip/ip.c \
+		$(NET_BASE)/il/ip/ip_client.c \
+		$(NET_BASE)/socket/socket_core.c \
+		$(NET_BASE)/tl/icmp/icmp.c \
+		$(NET_BASE)/tl/icmp/icmp_client.c \
+		$(NET_BASE)/tl/tcp/tcp.c \
+		$(NET_BASE)/tl/tl_common.c \
+		$(NET_BASE)/tl/udp/udp.c \
+		$(NET_BASE)/structures/dynamic_fifo.c
 endif
 
-include $(NET_BASE)Makefile.module
+ifeq ($(CONFIG_NETWORKING),modular)
+	SOURCES += \
+		net_standalone.c \
+		$(NET_BASE)/il/ip/ip_remote.c
+endif
+
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/net/net/start/Makefile
===================================================================
--- uspace/srv/net/net/start/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/net/net/start/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,4 +1,5 @@
 #
-# Copyright (c) 2009 Lukas Mejdrech
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
 # All rights reserved.
 #
@@ -27,24 +28,16 @@
 #
 
-NAME = netstart
+NET_BASE = ../..
+USPACE_PREFIX = ../../../..
+BINARY = netstart
 
-NET_BASE = ../../
-STRUCTURES = $(NET_BASE)structures/
+SOURCES = \
+	netstart.c \
+	$(NET_BASE)/checksum.c \
+	$(NET_BASE)/modules.c \
+	$(NET_BASE)/self_test.c \
+	$(NET_BASE)/structures/char_map.c \
+	$(NET_BASE)/structures/dynamic_fifo.c \
+	$(NET_BASE)/structures/measured_strings.c
 
-include ../../../../../Makefile.common
-include ../../../../../Makefile.config
-
-## Sources
-#
-
-OUTPUT = $(NAME)
-SOURCES = \
-	$(NAME).c \
-	$(NET_BASE)checksum.c \
-	$(NET_BASE)modules.c \
-	$(NET_BASE)self_test.c \
-	$(STRUCTURES)char_map.c \
-	$(STRUCTURES)dynamic_fifo.c \
-	$(STRUCTURES)measured_strings.c
-
-include $(NET_BASE)Makefile.module
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/net/netif/dp8390/Makefile
===================================================================
--- uspace/srv/net/netif/dp8390/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/net/netif/dp8390/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,4 +1,5 @@
 #
-# Copyright (c) 2009 Lukas Mejdrech
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
 # All rights reserved.
 #
@@ -27,41 +28,41 @@
 #
 
-NAME = dp8390
+NET_BASE = ../..
+USPACE_PREFIX = ../../../..
+ROOT_PATH = $(USPACE_PREFIX)/..
 
-NET_BASE = ../../
-STRUCTURES = $(NET_BASE)structures/
+COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
+CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
 
-include $(NET_BASE)../../../Makefile.common
-include $(NET_BASE)../../../Makefile.config
+BINARY = dp8390
 
-## Sources
-#
+-include $(COMMON_MAKEFILE)
+-include $(CONFIG_MAKEFILE)
 
-OUTPUT = $(NAME)
 SOURCES = \
-	$(NAME).c \
-	$(NAME)_module.c \
+	dp8390.c \
+	dp8390_module.c \
 	ne2000.c \
-	$(NET_BASE)module.c \
-	$(NET_BASE)modules.c \
-	$(NET_BASE)netif/netif.c \
-	$(STRUCTURES)measured_strings.c \
-	$(STRUCTURES)packet/packet.c \
-	$(STRUCTURES)packet/packet_client.c \
-	$(STRUCTURES)packet/packet_remote.c
+	$(NET_BASE)/module.c \
+	$(NET_BASE)/modules.c \
+	$(NET_BASE)/netif/netif.c \
+	$(NET_BASE)/structures/measured_strings.c \
+	$(NET_BASE)/structures/packet/packet.c \
+	$(NET_BASE)/structures/packet/packet_client.c \
+	$(NET_BASE)/structures/packet/packet_remote.c
 
-ifeq ($(NETWORKING), module)
-
-	SOURCES +=	$(NET_BASE)checksum.c \
-				$(NET_BASE)nil/eth/eth.c \
-				$(NET_BASE)net/net_remote.c \
-				$(NET_BASE)netif/netif_nil_bundle.c
-
-else
-
-	SOURCES += 	$(NET_BASE)nil/nil_remote.c \
-				$(NET_BASE)netif/netif_standalone.c
-
+ifeq ($(CONFIG_NETWORKING),module)
+	SOURCES += \
+		$(NET_BASE)/checksum.c \
+		$(NET_BASE)/nil/eth/eth.c \
+		$(NET_BASE)/net/net_remote.c \
+		$(NET_BASE)/netif/netif_nil_bundle.c
 endif
 
-include $(NET_BASE)Makefile.module
+ifeq ($(CONFIG_NETWORKING),modular)
+	SOURCES += \
+		$(NET_BASE)/nil/nil_remote.c \
+		$(NET_BASE)/netif/netif_standalone.c
+endif
+
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/net/netif/lo/Makefile
===================================================================
--- uspace/srv/net/netif/lo/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/net/netif/lo/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,4 +1,5 @@
 #
-# Copyright (c) 2009 Lukas Mejdrech
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
 # All rights reserved.
 #
@@ -27,38 +28,38 @@
 #
 
-NAME = lo
+NET_BASE = ../..
+USPACE_PREFIX = ../../../..
+ROOT_PATH = $(USPACE_PREFIX)/..
 
-NET_BASE = ../../
-STRUCTURES = $(NET_BASE)structures/
+COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
+CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
 
-include $(NET_BASE)../../../Makefile.common
-include $(NET_BASE)../../../Makefile.config
+BINARY = lo
 
-## Sources
-#
+-include $(COMMON_MAKEFILE)
+-include $(CONFIG_MAKEFILE)
 
-OUTPUT = $(NAME)
 SOURCES = \
-	$(NAME).c \
-	$(NET_BASE)module.c \
-	$(NET_BASE)modules.c \
-	$(NET_BASE)net/net_remote.c \
-	$(NET_BASE)netif/netif.c \
-	$(STRUCTURES)measured_strings.c \
-	$(STRUCTURES)packet/packet.c \
-	$(STRUCTURES)packet/packet_client.c \
-	$(STRUCTURES)packet/packet_remote.c
+	lo.c \
+	$(NET_BASE)/module.c \
+	$(NET_BASE)/modules.c \
+	$(NET_BASE)/net/net_remote.c \
+	$(NET_BASE)/netif/netif.c \
+	$(NET_BASE)/structures/measured_strings.c \
+	$(NET_BASE)/structures/packet/packet.c \
+	$(NET_BASE)/structures/packet/packet_client.c \
+	$(NET_BASE)/structures/packet/packet_remote.c
 
-ifeq ($(NETWORKING), module)
-
-	SOURCES +=	$(NET_BASE)nil/nildummy/nildummy.c \
-				$(NET_BASE)netif/netif_nil_bundle.c
-
-else
-
-	SOURCES += 	$(NET_BASE)nil/nil_remote.c \
-				$(NET_BASE)netif/netif_standalone.c
-
+ifeq ($(CONFIG_NETWORKING),module)
+	SOURCES += \
+		$(NET_BASE)/nil/nildummy/nildummy.c \
+		$(NET_BASE)/netif/netif_nil_bundle.c
 endif
 
-include $(NET_BASE)Makefile.module
+ifeq ($(CONFIG_NETWORKING),modular)
+	SOURCES += \
+		$(NET_BASE)/nil/nil_remote.c \
+		$(NET_BASE)/netif/netif_standalone.c
+endif
+
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/net/nil/eth/Makefile
===================================================================
--- uspace/srv/net/nil/eth/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/net/nil/eth/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,4 +1,5 @@
 #
-# Copyright (c) 2009 Lukas Mejdrech
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
 # All rights reserved.
 #
@@ -27,22 +28,20 @@
 #
 
-NAME = eth
+NET_BASE = ../..
+USPACE_PREFIX = ../../../..
+BINARY = eth
 
-NET_BASE = ../../
-STRUCTURES = $(NET_BASE)structures/
+SOURCES = \
+	eth.c \
+	eth_module.c \
+	$(NET_BASE)/checksum.c \
+	$(NET_BASE)/module.c \
+	$(NET_BASE)/modules.c \
+	$(NET_BASE)/net/net_remote.c \
+	$(NET_BASE)/netif/netif_remote.c \
+	$(NET_BASE)/structures/measured_strings.c \
+	$(NET_BASE)/structures/packet/packet.c \
+	$(NET_BASE)/structures/packet/packet_client.c \
+	$(NET_BASE)/structures/packet/packet_remote.c
 
-OUTPUT = $(NAME)
-SOURCES = \
-	$(NAME).c \
-	$(NAME)_module.c \
-	$(NET_BASE)checksum.c \
-	$(NET_BASE)module.c \
-	$(NET_BASE)modules.c \
-	$(NET_BASE)net/net_remote.c \
-	$(NET_BASE)netif/netif_remote.c \
-	$(STRUCTURES)measured_strings.c \
-	$(STRUCTURES)packet/packet.c \
-	$(STRUCTURES)packet/packet_client.c \
-	$(STRUCTURES)packet/packet_remote.c
-
-include $(NET_BASE)Makefile.module
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/net/nil/nildummy/Makefile
===================================================================
--- uspace/srv/net/nil/nildummy/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/net/nil/nildummy/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,4 +1,5 @@
 #
-# Copyright (c) 2009 Lukas Mejdrech
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
 # All rights reserved.
 #
@@ -27,21 +28,19 @@
 #
 
-NAME = nildummy
+NET_BASE = ../..
+USPACE_PREFIX = ../../../..
+BINARY = nildummy
 
-NET_BASE = ../../
-STRUCTURES = $(NET_BASE)structures/
+SOURCES = \
+	nildummy.c \
+	nildummy_module.c \
+	$(NET_BASE)/module.c \
+	$(NET_BASE)/modules.c \
+	$(NET_BASE)/net/net_remote.c \
+	$(NET_BASE)/netif/netif_remote.c \
+	$(NET_BASE)/structures/measured_strings.c \
+	$(NET_BASE)/structures/packet/packet.c \
+	$(NET_BASE)/structures/packet/packet_client.c \
+	$(NET_BASE)/structures/packet/packet_remote.c
 
-OUTPUT = $(NAME)
-SOURCES = \
-	$(NAME).c \
-	$(NAME)_module.c \
-	$(NET_BASE)module.c \
-	$(NET_BASE)modules.c \
-	$(NET_BASE)net/net_remote.c \
-	$(NET_BASE)netif/netif_remote.c \
-	$(STRUCTURES)measured_strings.c \
-	$(STRUCTURES)packet/packet.c \
-	$(STRUCTURES)packet/packet_client.c \
-	$(STRUCTURES)packet/packet_remote.c
-
-include $(NET_BASE)Makefile.module
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/net/socket/Makefile
===================================================================
--- uspace/srv/net/socket/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/net/socket/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,4 +1,5 @@
 #
-# Copyright (c) 2009 Lukas Mejdrech
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
 # All rights reserved.
 #
@@ -27,18 +28,13 @@
 #
 
-NAME = socket
+NET_BASE = ..
+USPACE_PREFIX = ../../..
+LIBRARY = libsocket
 
-NET_BASE = ../
-STRUCTURES = $(NET_BASE)structures/
+SOURCES = \
+	socket_client.c \
+	$(NET_BASE)/inet.c \
+	$(NET_BASE)/modules.c \
+	$(NET_BASE)/structures/dynamic_fifo.c
 
-## Sources
-#
-
-LIB = lib$(NAME).a
-SOURCES = \
-	$(NAME)_client.c \
-	$(NET_BASE)inet.c \
-	$(NET_BASE)modules.c \
-	$(STRUCTURES)dynamic_fifo.c
-
-include $(NET_BASE)Makefile.module
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/net/tl/icmp/Makefile
===================================================================
--- uspace/srv/net/tl/icmp/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/net/tl/icmp/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,4 +1,5 @@
 #
-# Copyright (c) 2009 Lukas Mejdrech
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
 # All rights reserved.
 #
@@ -27,27 +28,22 @@
 #
 
-NAME = icmp
+NET_BASE = ../..
+USPACE_PREFIX = ../../../..
+BINARY = icmp
 
-NET_BASE = ../../
-STRUCTURES = $(NET_BASE)structures/
+SOURCES = \
+	icmp.c \
+	icmp_module.c \
+	icmp_client.c \
+	$(NET_BASE)/checksum.c \
+	$(NET_BASE)/module.c \
+	$(NET_BASE)/modules.c \
+	$(NET_BASE)/il/ip/ip_client.c \
+	$(NET_BASE)/il/ip/ip_remote.c \
+	$(NET_BASE)/net/net_remote.c \
+	$(NET_BASE)/structures/measured_strings.c \
+	$(NET_BASE)/structures/packet/packet.c \
+	$(NET_BASE)/structures/packet/packet_client.c \
+	$(NET_BASE)/structures/packet/packet_remote.c
 
-## Sources
-#
-
-OUTPUT = $(NAME)
-SOURCES = \
-	$(NAME).c \
-	$(NAME)_module.c \
-	$(NAME)_client.c \
-	$(NET_BASE)checksum.c \
-	$(NET_BASE)module.c \
-	$(NET_BASE)modules.c \
-	$(NET_BASE)il/ip/ip_client.c \
-	$(NET_BASE)il/ip/ip_remote.c \
-	$(NET_BASE)net/net_remote.c \
-	$(STRUCTURES)measured_strings.c \
-	$(STRUCTURES)packet/packet.c \
-	$(STRUCTURES)packet/packet_client.c \
-	$(STRUCTURES)packet/packet_remote.c
-
-include $(NET_BASE)Makefile.module
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/net/tl/tcp/Makefile
===================================================================
--- uspace/srv/net/tl/tcp/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/net/tl/tcp/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,4 +1,5 @@
 #
-# Copyright (c) 2009 Lukas Mejdrech
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
 # All rights reserved.
 #
@@ -27,33 +28,28 @@
 #
 
-NAME = tcp
+NET_BASE = ../..
+USPACE_PREFIX = ../../../..
+BINARY = tcp
 
-NET_BASE = ../../
-STRUCTURES = $(NET_BASE)structures/
+SOURCES = \
+	tcp.c \
+	tcp_module.c \
+	$(NET_BASE)/checksum.c \
+	$(NET_BASE)/module.c \
+	$(NET_BASE)/modules.c \
+	$(NET_BASE)/il/ip/ip_client.c \
+	$(NET_BASE)/il/ip/ip_remote.c \
+	$(NET_BASE)/net/net_remote.c \
+	$(NET_BASE)/socket/socket_core.c \
+	$(NET_BASE)/tl/icmp/icmp_client.c \
+	$(NET_BASE)/tl/icmp/icmp_common.c \
+	$(NET_BASE)/tl/icmp/icmp_remote.c \
+	$(NET_BASE)/tl/tl_common.c \
+	$(NET_BASE)/structures/char_map.c \
+	$(NET_BASE)/structures/dynamic_fifo.c \
+	$(NET_BASE)/structures/measured_strings.c \
+	$(NET_BASE)/structures/packet/packet.c \
+	$(NET_BASE)/structures/packet/packet_client.c \
+	$(NET_BASE)/structures/packet/packet_remote.c
 
-## Sources
-#
-
-OUTPUT = $(NAME)
-SOURCES = \
-	$(NAME).c \
-	$(NAME)_module.c \
-	$(NET_BASE)checksum.c \
-	$(NET_BASE)module.c \
-	$(NET_BASE)modules.c \
-	$(NET_BASE)il/ip/ip_client.c \
-	$(NET_BASE)il/ip/ip_remote.c \
-	$(NET_BASE)net/net_remote.c \
-	$(NET_BASE)socket/socket_core.c \
-	$(NET_BASE)tl/icmp/icmp_client.c \
-	$(NET_BASE)tl/icmp/icmp_common.c \
-	$(NET_BASE)tl/icmp/icmp_remote.c \
-	$(NET_BASE)tl/tl_common.c \
-	$(STRUCTURES)char_map.c \
-	$(STRUCTURES)dynamic_fifo.c \
-	$(STRUCTURES)measured_strings.c \
-	$(STRUCTURES)packet/packet.c \
-	$(STRUCTURES)packet/packet_client.c \
-	$(STRUCTURES)packet/packet_remote.c
-
-include $(NET_BASE)Makefile.module
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/net/tl/udp/Makefile
===================================================================
--- uspace/srv/net/tl/udp/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/net/tl/udp/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -1,4 +1,5 @@
 #
-# Copyright (c) 2009 Lukas Mejdrech
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2007 Jakub Jermar
 # All rights reserved.
 #
@@ -27,33 +28,28 @@
 #
 
-NAME = udp
+NET_BASE = ../..
+USPACE_PREFIX = ../../../..
+BINARY = udp
 
-NET_BASE = ../../
-STRUCTURES = $(NET_BASE)structures/
+SOURCES = \
+	udp.c \
+	udp_module.c \
+	$(NET_BASE)/checksum.c \
+	$(NET_BASE)/module.c \
+	$(NET_BASE)/modules.c \
+	$(NET_BASE)/il/ip/ip_client.c \
+	$(NET_BASE)/il/ip/ip_remote.c \
+	$(NET_BASE)/net/net_remote.c \
+	$(NET_BASE)/socket/socket_core.c \
+	$(NET_BASE)/tl/icmp/icmp_client.c \
+	$(NET_BASE)/tl/icmp/icmp_common.c \
+	$(NET_BASE)/tl/icmp/icmp_remote.c \
+	$(NET_BASE)/tl/tl_common.c \
+	$(NET_BASE)/structures/char_map.c \
+	$(NET_BASE)/structures/dynamic_fifo.c \
+	$(NET_BASE)/structures/measured_strings.c \
+	$(NET_BASE)/structures/packet/packet.c \
+	$(NET_BASE)/structures/packet/packet_client.c \
+	$(NET_BASE)/structures/packet/packet_remote.c
 
-## Sources
-#
-
-OUTPUT = $(NAME)
-SOURCES = \
-	$(NAME).c \
-	$(NAME)_module.c \
-	$(NET_BASE)checksum.c \
-	$(NET_BASE)module.c \
-	$(NET_BASE)modules.c \
-	$(NET_BASE)il/ip/ip_client.c \
-	$(NET_BASE)il/ip/ip_remote.c \
-	$(NET_BASE)net/net_remote.c \
-	$(NET_BASE)socket/socket_core.c \
-	$(NET_BASE)tl/icmp/icmp_client.c \
-	$(NET_BASE)tl/icmp/icmp_common.c \
-	$(NET_BASE)tl/icmp/icmp_remote.c \
-	$(NET_BASE)tl/tl_common.c \
-	$(STRUCTURES)char_map.c \
-	$(STRUCTURES)dynamic_fifo.c \
-	$(STRUCTURES)measured_strings.c \
-	$(STRUCTURES)packet/packet.c \
-	$(STRUCTURES)packet/packet_client.c \
-	$(STRUCTURES)packet/packet_remote.c
-
-include $(NET_BASE)Makefile.module
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/ns/Makefile
===================================================================
--- uspace/srv/ns/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/ns/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,7 +29,5 @@
 
 USPACE_PREFIX = ../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = ns
+BINARY = ns
 
 SOURCES = \
@@ -39,3 +37,3 @@
 	task.c
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/taskmon/Makefile
===================================================================
--- uspace/srv/taskmon/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/taskmon/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -28,10 +28,8 @@
 
 USPACE_PREFIX = ../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = taskmon
+BINARY = taskmon
 
 SOURCES = \
 	taskmon.c
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/vfs/Makefile
===================================================================
--- uspace/srv/vfs/Makefile	(revision d99c1d2ba8c7b2c687d430f2e9fd237046606545)
+++ uspace/srv/vfs/Makefile	(revision 1b1164e8b3cea0b45a167fb0933b14cf0c22c374)
@@ -29,7 +29,5 @@
 
 USPACE_PREFIX = ../..
-LIBS = $(LIBC_PREFIX)/libc.a
-
-OUTPUT = vfs
+BINARY = vfs
 
 SOURCES = \
@@ -41,3 +39,3 @@
 	vfs_register.c
 
-include ../Makefile.common
+include $(USPACE_PREFIX)/Makefile.common
