Index: util/kconfig/Makefile
===================================================================
--- util/kconfig/Makefile	(revision 135)
+++ util/kconfig/Makefile	(working copy)
@@ -12,162 +12,119 @@
 
 Kconfig := Config.in
 
-FILO_CONFIG := $(src)/.config
 LIB_CONFIG  := $(src)/lib.config
 HAVE_FILO_CONFIG := $(wildcard $(FILO_CONFIG))
 HAVE_LIB_CONFIG := $(wildcard $(LIB_CONFIG))
 
-ifneq ($(strip $(HAVE_FILO_CONFIG)),)
+################# xconfig ###########################
 ifneq ($(strip $(HAVE_LIB_CONFIG)),)
 xconfig: prepare $(objk)/qconf
 	$(Q)printf "Libpayload config for FILO.\n"
-	$(Q)mv $(FILO_CONFIG) $(FILO_CONFIG)."temp"
-	$(Q)mv $(LIB_CONFIG) $(FILO_CONFIG)
-	$(Q)$(objk)/qconf $(LIBCONFIG_PATH)/Config.in
-	$(Q)mv $(FILO_CONFIG) $(LIB_CONFIG)
+	$(Q)cp $(LIB_CONFIG) $(LIBCONFIG_PATH)/.config
+	$(Q)make -C $(LIBCONFIG_PATH) xconfig
+	$(Q)cp $(LIBCONFIG_PATH)/.config $(LIB_CONFIG)
 	$(Q)printf "Libpayload config done.\n"
-	$(Q)mv $(FILO_CONFIG)."temp" $(FILO_CONFIG)
 	$(Q)$(objk)/qconf $(Kconfig)
 else
 xconfig: prepare $(objk)/qconf
 	$(Q)printf "Lost libpayload config file.\n"
-	$(Q)rm -f $(FILO_CONFIG)
-endif
-else
-xconfig: prepare $(objk)/qconf
-	$(Q)printf "Libpayload config for FILO.\n"
-	$(Q)$(objk)/qconf $(LIBCONFIG_PATH)/Config.in
-	$(Q)mv $(FILO_CONFIG) $(LIB_CONFIG)
+	$(Q)make -C $(LIBCONFIG_PATH) xconfig
+	$(Q)cp $(LIBCONFIG_PATH)/.config $(LIB_CONFIG)
 	$(Q)printf "Libpayload config done.\n"
 	$(Q)$(objk)/qconf $(Kconfig)
 endif
 
-ifneq ($(strip $(HAVE_FILO_CONFIG)),)
+################ gconfig ############################
 ifneq ($(strip $(HAVE_LIB_CONFIG)),)
 gconfig: prepare $(objk)/gconf
 	$(Q)printf "Libpayload config for FILO.\n"
-	$(Q)mv $(FILO_CONFIG) $(FILO_CONFIG)."temp"
-	$(Q)mv $(LIB_CONFIG) $(FILO_CONFIG)
-	$(Q)$(objk)/gconf $(LIBCONFIG_PATH)/Config.in
-	$(Q)mv $(FILO_CONFIG) $(LIB_CONFIG)
+	$(Q)cp $(LIB_CONFIG) $(LIBCONFIG_PATH)/.config
+	$(Q)make -C $(LIBCONFIG_PATH) gconfig
+	$(Q)cp $(LIBCONFIG_PATH)/.config $(LIB_CONFIG)
 	$(Q)printf "Libpayload config done.\n"
-	$(Q)mv $(FILO_CONFIG)."temp" $(FILO_CONFIG)
 	$(Q)$(objk)/gconf $(Kconfig)
 else
 gconfig: prepare $(objk)/gconf
 	$(Q)printf "Lost libpayload config file.\n"
-	$(Q)rm -f $(FILO_CONFIG)
-endif
-else
-gconfig: prepare $(objk)/gconf
-	$(Q)printf "Libpayload config for FILO.\n"
-	$(Q)$(objk)/gconf $(LIBCONFIG_PATH)/Config.in
-	$(Q)mv $(FILO_CONFIG) $(LIB_CONFIG)
+	$(Q)make -C $(LIBCONFIG_PATH) gconfig
+	$(Q)cp $(LIBCONFIG_PATH)/.config $(LIB_CONFIG)
 	$(Q)printf "Libpayload config done.\n"
 	$(Q)$(objk)/gconf $(Kconfig)
 endif
 
-ifneq ($(strip $(HAVE_FILO_CONFIG)),)
+################### menuconfig ########################
 ifneq ($(strip $(HAVE_LIB_CONFIG)),)
 menuconfig: prepare $(objk)/mconf
 	$(Q)printf "Libpayload config for FILO.\n"
-	$(Q)mv $(FILO_CONFIG) $(FILO_CONFIG)."temp"
-	$(Q)mv $(LIB_CONFIG) $(FILO_CONFIG)
-	$(Q)$(objk)/mconf $(LIBCONFIG_PATH)/Config.in
-	$(Q)mv $(FILO_CONFIG) $(LIB_CONFIG)
+	$(Q)cp $(LIB_CONFIG) $(LIBCONFIG_PATH)/.config
+	$(Q)make -C $(LIBCONFIG_PATH) menuconfig
+	$(Q)cp $(LIBCONFIG_PATH)/.config $(LIB_CONFIG)
 	$(Q)printf "Libpayload config done.\n"
-	$(Q)mv $(FILO_CONFIG)."temp" $(FILO_CONFIG)
 	$(Q)$(objk)/mconf $(Kconfig)
 else
 menuconfig: prepare $(objk)/mconf
 	$(Q)printf "Lost libpayload config file.\n"
-	$(Q)rm -f $(FILO_CONFIG)
-endif
-else
-menuconfig: prepare $(objk)/mconf
-	$(Q)printf "Libpayload config for FILO.\n"
-	$(Q)$(objk)/mconf $(LIBCONFIG_PATH)/Config.in
-	$(Q)mv $(FILO_CONFIG) $(LIB_CONFIG)
+	$(Q)make -C $(LIBCONFIG_PATH) menuconfig
+	$(Q)cp $(LIBCONFIG_PATH)/.config $(LIB_CONFIG)
 	$(Q)printf "Libpayload config done.\n"
 	$(Q)$(objk)/mconf $(Kconfig)
 endif
 
-ifneq ($(strip $(HAVE_FILO_CONFIG)),)
+################## config ############################
 ifneq ($(strip $(HAVE_LIB_CONFIG)),)
 config: prepare $(objk)/conf
 	$(Q)printf "Libpayload config for FILO.\n"
-	$(Q)mv $(FILO_CONFIG) $(FILO_CONFIG)."temp"
-	$(Q)mv $(LIB_CONFIG) $(FILO_CONFIG)
-	$(Q)$(objk)/conf $(LIBCONFIG_PATH)/Config.in
-	$(Q)mv $(FILO_CONFIG) $(LIB_CONFIG)
+	$(Q)cp $(LIB_CONFIG) $(LIBCONFIG_PATH)/.config
+	$(Q)make -C $(LIBCONFIG_PATH) config
+	$(Q)cp $(LIBCONFIG_PATH)/.config $(LIB_CONFIG)
 	$(Q)printf "Libpayload config done.\n"
-	$(Q)mv $(FILO_CONFIG)."temp" $(FILO_CONFIG)
-	$(Q)$(objk)/conf $(Kconfig)
+	$(Q)$(objk)/qconf $(Kconfig)
 else
 config: prepare $(objk)/conf
 	$(Q)printf "Lost libpayload config file.\n"
-	$(Q)rm -f $(FILO_CONFIG)
-endif
-else
-config: prepare $(objk)/conf
-	$(Q)printf "Libpayload config for FILO.\n"
-	$(Q)$(objk)/conf $(LIBCONFIG_PATH)/Config.in
-	$(Q)mv $(FILO_CONFIG) $(LIB_CONFIG)
+	$(Q)make -C $(LIBCONFIG_PATH) config
+	$(Q)cp $(LIBCONFIG_PATH)/.config $(LIB_CONFIG)
 	$(Q)printf "Libpayload config done.\n"
 	$(Q)$(objk)/conf $(Kconfig)
 endif
 
-ifneq ($(strip $(HAVE_FILO_CONFIG)),)
+################# oldconfig #########################
 ifneq ($(strip $(HAVE_LIB_CONFIG)),)
 oldconfig: prepare $(objk)/conf
 	$(Q)printf "Libpayload config for FILO.\n"
-	$(Q)mv $(FILO_CONFIG) $(FILO_CONFIG)."temp"
-	$(Q)mv $(LIB_CONFIG) $(FILO_CONFIG)
-	$(Q)$(objk)/conf -o $(LIBCONFIG_PATH)/Config.in
-	$(Q)mv $(FILO_CONFIG) $(LIB_CONFIG)
+	$(Q)cp $(LIB_CONFIG) $(LIBCONFIG_PATH)/.config
+	$(Q)make -C $(LIBCONFIG_PATH) oldconfig
+	$(Q)cp $(LIBCONFIG_PATH)/.config $(LIB_CONFIG)
 	$(Q)printf "Libpayload config done.\n"
-	$(Q)mv $(FILO_CONFIG)."temp" $(FILO_CONFIG)
 	$(Q)$(objk)/conf -o $(Kconfig)
 else
 oldconfig: prepare $(objk)/conf
 	$(Q)printf "Lost libpayload config file.\n"
-	$(Q)rm -f $(FILO_CONFIG)
-endif
-else
-oldconfig: prepare $(objk)/conf
-	$(Q)printf "Libpayload config for FILO.\n"
-	$(Q)$(objk)/conf -o $(LIBCONFIG_PATH)/Config.in
-	$(Q)mv .config $(LIB_CONFIG)
+	$(Q)make -C $(LIBCONFIG_PATH) oldconfig
+	$(Q)cp $(LIBCONFIG_PATH)/.config $(LIB_CONFIG)
 	$(Q)printf "Libpayload config done.\n"
 	$(Q)$(objk)/conf -o $(Kconfig)
 endif
 
-ifneq ($(strip $(HAVE_FILO_CONFIG)),)
+################ silentoldconfig ####################
 ifneq ($(strip $(HAVE_LIB_CONFIG)),)
 silentoldconfig: prepare $(objk)/conf
 	$(Q)printf "Libpayload config for FILO.\n"
-	$(Q)mv $(FILO_CONFIG) $(FILO_CONFIG)."temp"
-	$(Q)mv $(LIB_CONFIG) $(FILO_CONFIG)
-	$(Q)$(objk)/conf -s $(LIBCONFIG_PATH)/Config.in
-	$(Q)mv $(FILO_CONFIG) $(LIB_CONFIG)
+	$(Q)cp $(LIB_CONFIG) $(LIBCONFIG_PATH)/.config
+	$(Q)make -C $(LIBCONFIG_PATH) silentoldconfig
+	$(Q)cp $(LIBCONFIG_PATH)/.config $(LIB_CONFIG)
 	$(Q)printf "Libpayload config done.\n"
-	$(Q)mv $(FILO_CONFIG)."temp" $(FILO_CONFIG)
 	$(Q)$(objk)/conf -s $(Kconfig)
 else
 silentoldconfig: prepare $(objk)/conf
 	$(Q)printf "Lost libpayload config file.\n"
-	$(Q)rm -f $(FILO_CONFIG)
-endif
-else
-silentoldconfig: prepare $(objk)/conf
-	$(Q)printf "Libpayload config for FILO.\n"
-	$(Q)$(objk)/conf -s $(LIBCONFIG_PATH)/Config.in
-	$(Q)mv .config $(LIB_CONFIG)
+	$(Q)make -C $(LIBCONFIG_PATH) xconfig
+	$(Q)cp $(LIBCONFIG_PATH)/.config $(LIB_CONFIG)
 	$(Q)printf "Libpayload config done.\n"
 	$(Q)$(objk)/conf -s $(Kconfig)
-
 endif
 
+
 # --- UNUSED, ignore ----------------------------------------------------------
 # Create new linux.pot file
 # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
Index: Makefile
===================================================================
--- Makefile	(revision 135)
+++ Makefile	(working copy)
@@ -105,7 +105,7 @@
 
 HAVE_LIBCONFIG := $(wildcard $(LIBCONFIG_PATH))
 
-all: prepare $(obj)/version.h $(TARGET)
+all: prepare libpayload $(obj)/version.h $(TARGET)
 
 
 HAVE_LIBPAYLOAD := $(wildcard $(LIBPAYLOAD))
@@ -113,19 +113,15 @@
 libpayload:
 	@printf "Found Libpayload $(LIBPAYLOAD).\n"
 else
-libpayload: $(src)/$(LIB_CONFIG)
-	$(Q)printf "building libpayload.\n"
-	$(Q)make -C $(LIBCONFIG_PATH) distclean
-	$(Q)cp lib.config $(LIBCONFIG_PATH)/.config
-	$(Q)make -C $(LIBCONFIG_PATH) oldconfig
+libpayload:
 	$(Q)make -C $(LIBCONFIG_PATH) DESTDIR=$(src)/build install
 endif
 
-$(obj)/filo: $(src)/.config $(OBJS)  libpayload
+$(obj)/filo: $(src)/.config $(OBJS)
 	$(Q)printf "  LD      $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)$(LD) -N -T $(ARCHDIR-y)/ldscript -o $@ $(OBJS) $(LIBPAYLOAD) $(LIBGCC)
 
-$(TARGET): $(obj)/filo libpayload
+$(TARGET): $(obj)/filo
 	$(Q)cp $(obj)/filo $@
 	$(Q)$(NM) $(obj)/filo | sort > $(obj)/filo.map
 	$(Q)printf "  STRIP   $(subst $(shell pwd)/,,$(@))\n"
@@ -133,7 +129,7 @@
 
 include util/kconfig/Makefile
 
-$(obj)/%.o: $(src)/%.c libpayload
+$(obj)/%.o: $(src)/%.c 
 	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)$(CC) -MMD $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
