Index: uspace/srv/loader/Makefile
===================================================================
--- uspace/srv/loader/Makefile	(revision 8786aa5c151fa5280b899437cecc4930c636823b)
+++ uspace/srv/loader/Makefile	(revision cec261e15336368b331f25ad66db617f355bb801)
@@ -28,13 +28,20 @@
 #
 
-include Makefile.common
+-include ../../../Makefile.config
+include arch/$(UARCH)/Makefile.inc
 
-.PHONY: all clean
+USPACE_PREFIX = ../..
+LIBS = $(LIBC_PREFIX)/libc.a
+EXTRA_CFLAGS += -Iinclude
 
-all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS)
-	-[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV)
-	$(MAKE) -f Makefile.build PRECHECK=$(PRECHECK)
+OUTPUT = loader
 
-clean:
-	rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm arch/*/_link.ld
-	find . -name '*.o' -follow -exec rm \{\} \;
+GENERIC_SOURCES = \
+	main.c \
+	elf_load.c \
+	interp.s
+
+SOURCES := $(GENERIC_SOURCES) $(ARCH_SOURCES)
+OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
+
+include ../Makefile.common
Index: uspace/srv/loader/Makefile.build
===================================================================
--- uspace/srv/loader/Makefile.build	(revision 8786aa5c151fa5280b899437cecc4930c636823b)
+++ 	(revision )
@@ -1,80 +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
-include arch/$(UARCH)/Makefile.inc
-
-CFLAGS += -Iinclude
-LINK = arch/$(UARCH)/_link.ld
-
-## Sources
-#
-
-GENERIC_SOURCES = \
-	main.c \
-	elf_load.c \
-	interp.s
-
-SOURCES := $(GENERIC_SOURCES) $(ARCH_SOURCES)
-OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
-
-.PHONY: all
-
-all: $(OUTPUT) $(OUTPUT).disasm
-
--include $(DEPEND)
-
-$(OUTPUT).disasm: $(OUTPUT)
-	$(OBJDUMP) -d $< > $@
-
-$(OUTPUT): $(OBJECTS) $(LIBS) $(LINK)
-	$(LD) -T $(LINK) $(LFLAGS) $(OBJECTS) $(LIBS) -o $@ -Map $(OUTPUT).map
-
-$(LINK): $(LINK).in
-	$(GCC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@
-
-%.o: %.c $(DEPEND)
-	$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
-ifeq ($(PRECHECK),y)
-	$(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS)
-endif
-
-%.o: %.s $(DEPEND)
-	$(AS) $(AFLAGS) $< -o $@
-ifeq ($(PRECHECK),y)
-	$(JOBFILE) $(JOB) $< $@ as asm $(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/loader/Makefile.common
===================================================================
--- uspace/srv/loader/Makefile.common	(revision 8786aa5c151fa5280b899437cecc4930c636823b)
+++ 	(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 $(SOFTINT_PREFIX)/libsoftint.a
-
-DEPEND = Makefile.depend
-DEPEND_PREV = $(DEPEND).prev
-JOB = loader.job
-OUTPUT = loader
Index: uspace/srv/loader/arch/amd64/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/amd64/Makefile.inc	(revision 8786aa5c151fa5280b899437cecc4930c636823b)
+++ uspace/srv/loader/arch/amd64/Makefile.inc	(revision cec261e15336368b331f25ad66db617f355bb801)
@@ -27,4 +27,4 @@
 #
 
-CFLAGS += -D__64_BITS__
+EXTRA_CFLAGS = -D__64_BITS__
 ARCH_SOURCES := arch/$(UARCH)/amd64.s
Index: uspace/srv/loader/arch/arm32/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/arm32/Makefile.inc	(revision 8786aa5c151fa5280b899437cecc4930c636823b)
+++ uspace/srv/loader/arch/arm32/Makefile.inc	(revision cec261e15336368b331f25ad66db617f355bb801)
@@ -27,4 +27,4 @@
 #
 
-CFLAGS += -D__32_BITS__
+EXTRA_CFLAGS = -D__32_BITS__
 ARCH_SOURCES := arch/$(UARCH)/arm32.s
Index: uspace/srv/loader/arch/ia32/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/ia32/Makefile.inc	(revision 8786aa5c151fa5280b899437cecc4930c636823b)
+++ uspace/srv/loader/arch/ia32/Makefile.inc	(revision cec261e15336368b331f25ad66db617f355bb801)
@@ -27,4 +27,4 @@
 #
 
-CFLAGS += -D__32_BITS__
+EXTRA_CFLAGS = -D__32_BITS__
 ARCH_SOURCES := arch/$(UARCH)/ia32.s
Index: uspace/srv/loader/arch/ia64/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/ia64/Makefile.inc	(revision 8786aa5c151fa5280b899437cecc4930c636823b)
+++ uspace/srv/loader/arch/ia64/Makefile.inc	(revision cec261e15336368b331f25ad66db617f355bb801)
@@ -27,5 +27,5 @@
 #
 
-CFLAGS += -D__64_BITS__
+EXTRA_CFLAGS = -D__64_BITS__
 ARCH_SOURCES := arch/$(UARCH)/ia64.s
 AFLAGS += -xexplicit
Index: uspace/srv/loader/arch/mips32/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/mips32/Makefile.inc	(revision 8786aa5c151fa5280b899437cecc4930c636823b)
+++ uspace/srv/loader/arch/mips32/Makefile.inc	(revision cec261e15336368b331f25ad66db617f355bb801)
@@ -27,4 +27,4 @@
 #
 
-CFLAGS += -D__32_BITS__
+EXTRA_CFLAGS = -D__32_BITS__
 ARCH_SOURCES := arch/$(UARCH)/mips32.s
Index: uspace/srv/loader/arch/ppc32/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/ppc32/Makefile.inc	(revision 8786aa5c151fa5280b899437cecc4930c636823b)
+++ uspace/srv/loader/arch/ppc32/Makefile.inc	(revision cec261e15336368b331f25ad66db617f355bb801)
@@ -27,4 +27,4 @@
 #
 
-CFLAGS += -D__32_BITS__
+EXTRA_CFLAGS = -D__32_BITS__
 ARCH_SOURCES := arch/$(UARCH)/ppc32.s
Index: uspace/srv/loader/arch/sparc64/Makefile.inc
===================================================================
--- uspace/srv/loader/arch/sparc64/Makefile.inc	(revision 8786aa5c151fa5280b899437cecc4930c636823b)
+++ uspace/srv/loader/arch/sparc64/Makefile.inc	(revision cec261e15336368b331f25ad66db617f355bb801)
@@ -27,4 +27,4 @@
 #
 
-CFLAGS += -D__64_BITS__
+EXTRA_CFLAGS = -D__64_BITS__
 ARCH_SOURCES := arch/$(UARCH)/sparc64.s
