Index: floppyfw/Makefile
===================================================================
--- floppyfw/Makefile	(revision 126)
+++ floppyfw/Makefile	(revision 128)
@@ -1,273 +1,72 @@
- 
-# Makefile for floppyfw.
-# As you can see, this is based on the buildroot/busybox/uClibc Make system.
-# 
-# Changes are Copyright (C) 2003-2004 Thomas Lundquist <thomasez@zelow.no>
-#
-
-# Makefile for a simple busybox/uClibc root filesystem
-#
-# Copyright (C) 2001-2003 Erik Andersen <andersen@codepoet.org>
-# Copyright (C) 2002 by Tim Riker <Tim@Rikers.org>
+# Makefile for buildroot2
+#
+# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
 #
 # This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Library General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA
-
-# $Id: Makefile,v 1.31 2005/12/07 19:50:42 thomasez Exp $
-
-#############################################################
-#
-# EDIT this stuff to suit your system and preferences
-#
-# Use := when possible to get precomputation, thereby 
-# speeding up the build process.
-#
-#############################################################
-
-# Which version of floppyfw is this?
-FLOPPYFW_VERSION=3.0.0
-
-# What sortof target system shall we compile this for?
-ARCH:=i386
-#ARCH:=arm
-#ARCH:=mips
-#ARCH:=mipsel
-#ARCH:=powerpc
-#ARCH:=sh4
-#ARCH:=cris
-#ARCH:=m68k
-#ARCH:=v850
-#ARCH:=sparc
-#ARCH:=sh64
-#ARCH:=whatever
-
-# If you want to add FPU/MATH emulation, set this to true;
-# (Not properly tested yet.)
-EMULATE_FPU=false
-
-# Command used to download source code
-WGET:=wget --passive-ftp
-
-# Optimize toolchain for which type of CPU?
-# WARNING!!!  CURRENTLY BROKEN!!! LEAVE IT AS $(ARCH)!!!
-OPTIMIZE_FOR_CPU=$(ARCH)
-# WARNING!!!  CURRENTLY BROKEN!!! LEAVE IT AS $(ARCH)!!!
-#OPTIMIZE_FOR_CPU=i486
-#OPTIMIZE_FOR_CPU=strongarm
-#OPTIMIZE_FOR_CPU=whatever
-
-TARGET_OPTIMIZATION=-Os
-TARGET_DEBUGGING= #-g
-
-# Any additional gcc options you may want to include....
-EXTRA_GCC_CONFIG_OPTIONS=
-
-# For SMP machines some stuff can be run in parallel
-# This one sets j<amount of CPUs> but it may be just as good or even better
-# with amount +1
-JLEVEL=-j$(shell expr $(shell grep -i -c '^processor[[:space:]]*:[[:space:]]*[0-9]\+' /proc/cpuinfo) \+ 1)
-# Or if running distcc: 
-# JLEVEL=-j5
-
-# Sourceforge-mirror:
-SF_HOST=superb-east
-SF_MIRROR=http://$(SF_HOST).dl.sourceforge.net
-
-# NICs you want in the nics.ffw module package separated by a space.
-# If you want options to the module, put them in a () after the module.
-NIC_MODULES=3c509 3c59x 8139cp 8139too pcnet32 r8169 e100 e1000 ne ne2k-pci forcedeth tulip
-
-#############################################################
-#
-# The list of stuff to build for the target filesystem
-#
-#############################################################
-
-TARGETS+=uclibc
-
-# Probably a good thing even if you choose not to patch anything.
-# This target only unpacks. The linux target does the patching.
-TARGETS+=patch-o-matic
-
-# POM-patches to add:
-# I could have used base but some of the patches has a problem.
-# It's alot here, probably not so smart, cut back later.
-POM_PATCHES=h323-conntrack-nat quake3-conntrack-nat connlimit dstlimit pptp-conntrack-nat directx8-conntrack-nat time cuseeme-nat rtsp-conntrack iprange random ipp2p mms-conntrack-nat connrate msnp-conntrack-nat nth sip-conntrack-nat set expire psd time TARPIT
-
-# After switching to a newer p-o-m;
-# 
-# Did not apply cleanly: dropped-table tproxy
-#
-# Did not compile cleanly: 
-#   policy: (ipt_policy.c:15:22: net/xfrm.h: No such file or directory)
-#
-#   osf: (extensions/libipt_osf.c: In function `help':
-#   extensions/libipt_osf.c:46: warning: too many arguments for format
-#   extensions/libipt_osf.c: In function `parse':
-#   extensions/libipt_osf.c:107: error: `IPT_OSF_CONNECTOR' undeclared (first use in this function)
-#   extensions/libipt_osf.c:107: error: (Each undeclared identifier is reported only once
-#   )
-#
-# Missing: string
-
-# IPTABLES_MODULES: this is a result of the patches you have chosen above and
-# also the included modules in the kernel (also check the kernel config.)
-# This works the same way as NIC_MODULES.
-# If you want options to the module, put them in a () after the module.
-IPTABLES_MODULES=arp_tables arptable_filter iptable_mangle ipt_DSCP ipt_ECN ipt_LOG ipt_MARK ipt_REDIRECT ipt_TCPMSS ipt_TOS ipt_ULOG ipt_conntrack ipt_connlimit ipt_dscp ipt_ecn ipt_helper ipt_length ipt_limit ipt_mac ipt_mark ipt_physdev ipt_pkttype ipt_tcpmss ipt_tos ipt_ttl ipt_unclean ip_conntrack_ftp ip_nat_ftp ip_conntrack_irc(ports=6666,6667,6668,7000) ip_nat_irc sch_htb ip_conntrack_h323 ip_conntrack_rtsp ip_conntrack_pptp ip_conntrack_quake3 ipt_iprange ipt_multiport
-
-#ipt_MIRROR 
-#ip_queue 
-#ipt_string 
-#ip_nat_tftp
-#ip_conntrack_tftp
-#ip_nat_amanda
-#ip_conntrack_amanda
-
-TARGETS+=linux
-
-TARGETS+=busybox
-USE_BUSYBOX_SNAPSHOT=false
-
-TARGETS+=iptables
-
-TARGETS+=ipset
-
-TARGETS+=iproute2
-
-TARGETS+=dnsmasq
-
-TARGETS+=bridgeutils
-
-# TARGETS+=modutils
-
-TARGETS+=pppd
-
-TARGETS+=pppoe
-
-TARGETS+=pcmcia
-
-TARGETS+=wireless-tools
-
-TARGETS+=dropbear
-
-TARGETS+=ethtool
-
-# This one will be installed in add.ffw, alas, the floppy base itself and
-# not it's own package.
-#TARGETS+=mii-diag
-
-TARGETS+=e3
-
-TARGETS+=noip2
-
-TARGETS+=nanotop
-
-TARGETS+=wsmenu
-
-# These needs to be tested.
-TARGETS+=siproxd
-TARGETS+=ucarp
-TARGETS+=lineserv
-# TARGETS+=madwifi
-
-# The hostap target will add patches to the kernel and build a hostap.ffw
-# package with hostapd, hostap-driver and wpa_supplicant and hostap-utils
-# if you set it here.
-# TARGETS+=hostap
-# TARGETS+=hostap-utils
-
-# Not yet
-# TARGETS+=ebtables
-
-# And at last:
-TARGETS+=module-packages
-TARGETS+=floppy
-
-#############################################################
-#
-# You should probably leave this stuff alone unless you know 
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+#--------------------------------------------------------------
+# Just run 'make menuconfig', configure stuff, then run 'make'.
+# You shouldn't need to mess with anything beyond this point...
+#--------------------------------------------------------------
+TOPDIR=./
+CONFIG_CONFIG_IN = Config.in
+CONFIG_DEFCONFIG = .defconfig
+CONFIG = scripts/kconfig
+
+noconfig_targets := menuconfig config oldconfig randconfig \
+	defconfig allyesconfig allnoconfig release tags    \
+	$(shell find . -name *_defconfig |sed 's/.*\///')
+
+# Pull in the user's configuration file
+ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
+-include $(TOPDIR).config
+endif
+
+ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
+
+#############################################################
+#
+# The list of stuff to build for the target toolchain
+# along with the packages to build for the target.
+#
+##############################################################
+TARGETS:=uclibc busybox
+include package/Makefile.in
+
+#############################################################
+#
+# You should probably leave this stuff alone unless you know
 # what you are doing.
 #
 #############################################################
 
-TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) $(TARGET_SOFT_FLOAT)
-# TARGET_CC=distcc gcc
-TARGET_CC=gcc
-TARGET_CX=g++
-
-HOSTCC:=distcc gcc
-BASE_DIR:=${shell pwd}
-SOURCE_DIR:=$(BASE_DIR)/sources
-FILES_DIR:=$(FILES_DIR)/scripts
-SCRIPTS_DIR:=$(BASE_DIR)/scripts
-CONFIG_DIR:=$(BASE_DIR)/configs
-LICENSES_DIR:=$(BASE_DIR)/licenses
-MODULES_BASE_DIR:=$(BASE_DIR)/modules
-MODULES_DIR:=$(MODULES_BASE_DIR)/2.4-std
-DL_DIR:=$(BASE_DIR)/downloads
-PATCH_DIR=$(BASE_DIR)/patches
-PACKAGES_DIR=$(BASE_DIR)/packages
-PACKAGES_INI_DIR=$(PACKAGES_DIR)/scripts
-PACKAGES_SKELETON_DIR=$(PACKAGES_DIR)/skeleton
-INITRD_DIR=$(BASE_DIR)/initrd
-INITRD_MASTER=$(INITRD_DIR)/master
-ADD_DIR=$(BASE_DIR)/add
-ADD_MASTER=$(ADD_DIR)/master
-
-TMP_DIR=$(BASE_DIR)/tmp
-
-# Need another name maybe?
-BUILD_DIR:=$(BASE_DIR)/build_$(ARCH)$(ARCH_FPU_SUFFIX)
-
-TARFLAGS=--format oldgnu
-
-#TAR_VERBOSE=--verbose
-RM=rm -f
-
-# This may be a problem to use but I'll try.
-# --strip-unneeded
-STRIP=strip --strip-unneeded -g --remove-section=.comment --remove-section=.note 
-STRIP_KMOD=strip --strip-debug --remove-section=.comment --remove-section=.note
-STRIP=$(STRIP_KMOD) --strip-unneeded
-
-SSTRIP=$(shell command type sstrip >/dev/null 2>&1 && echo sstrip || echo $(STRIP))
-
-DEPMOD=(cd $(LINUX_DIR); \
-	/sbin/depmod -ae -F System.map -b $(MODULES_DIR) -r $(LINUX_VERSION))
-
-# SED=/bin/sed -i -e
-SED=/usr/bin/perl -p -i -e
-LZMAD=lzmacat
-LZMAC=lzmacomp
-MAKE=/usr/bin/make $(JLEVEL)
-HOST_ARCH:=$(shell $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \
-	-e 's/sparc.*/sparc/' \
-	-e 's/arm.*/arm/g' \
-	-e 's/m68k.*/m68k/' \
-	-e 's/ppc/powerpc/g' \
-	-e 's/v850.*/v850/g' \
-	-e 's/sh[234]/sh/' \
-	-e 's/mips-.*/mips/' \
-	-e 's/mipsel-.*/mipsel/' \
-	-e 's/cris.*/cris/' \
-	-e 's/i[3-9]86/i386/' \
-	)
-
-GNU_HOST_NAME:=$(HOST_ARCH)-pc-linux-gnu
+
 
 all:   world
+
+# In this section, we need .config
+include .config.cmd
+
+# We also need the various per-package makefiles, which also add
+# each selected package to TARGETS if that package was selected
+# in the .config file.
+include package/*/*.mk
+include target/*/*.mk
+
+# target stuff is last so it can override anything else
+include target/Makefile.in
 
 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
@@ -275,44 +74,45 @@
 TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
 
-world: $(ADD_MASTER) $(INITRD_MASTER) $(DL_DIR) $(TMP_DIR) $(BUILD_DIR) $(PACKAGES_DIR) $(TARGETS)
+world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
+	$(TARGET_PACKAGES_DIR) $(TARGETS)
 
 .PHONY: all world clean dirclean distclean source $(TARGETS) \
-	$(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE)
-
-include makefiles/*.mk
-
-#############################################################
-#
-# staging and target directories do NOT list these as 
-# dependancies anywhere else
-#
-#############################################################
-$(TMP_DIR):
-	mkdir -p $(TMP_DIR)
-
+	$(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \
+	$(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR)
+
+#############################################################
+#
+# staging and target directories do NOT list these as
+# dependencies anywhere else
+#
+#############################################################
 $(DL_DIR):
-	mkdir -p $(DL_DIR)
+	@mkdir -p $(DL_DIR)
 
 $(BUILD_DIR):
-	mkdir -p $(BUILD_DIR)
-
-$(PACKAGES_DIR):
-	mkdir -p $(PACKAGES_DIR)
-
-$(MODULES_BASE_DIR):
-	mkdir -p $(MODULES_BASE_DIR)
-
-$(MODULES_DIR):
-	mkdir -p $(MODULES_DIR)
-
-$(ADD_MASTER):
-	cp -a $(ADD_DIR)/skeleton $(ADD_MASTER)
-	-find $(ADD_MASTER) -type d -name CVS -exec $(RM) -r {} \; > /dev/null 2>&1
-	-find $(ADD_MASTER) -type d -name .svn -exec $(RM) -r {} \; > /dev/null 2>&1
-
-$(INITRD_MASTER):
-	cp -a $(INITRD_DIR)/skeleton $(INITRD_MASTER)
-	-find $(INITRD_MASTER) -type d -name CVS -exec $(RM) -r {} \; > /dev/null 2>&1
-	-find $(INITRD_MASTER) -type d -name .svn -exec $(RM) -r {} \; > /dev/null 2>&1
+	@mkdir -p $(BUILD_DIR)
+
+$(TOOL_BUILD_DIR):
+	@mkdir -p $(TOOL_BUILD_DIR)
+
+$(STAGING_DIR):
+	@mkdir -p $(STAGING_DIR)/lib
+	@mkdir -p $(STAGING_DIR)/include
+	@mkdir -p $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)
+	@ln -snf ../lib $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib
+
+$(TARGET_DIR):
+	if [ -f "$(TARGET_SKELETON)" ] ; then \
+		$(ZCAT) $(TARGET_SKELETON) | tar -C $(BUILD_DIR) -xf -; \
+	fi;
+	if [ -d "$(TARGET_SKEL_DIR)" ] ; then \
+		cp -fa $(TARGET_SKEL_DIR)/* $(TARGET_DIR)/; \
+	fi;
+	touch $(STAGING_DIR)/.fakeroot.00000
+	-find $(TARGET_DIR) -type d -name CVS | xargs rm -rf
+	-find $(TARGET_DIR) -type d -name .svn | xargs rm -rf
+
+$(TARGET_PACKAGES_DIR):
+	@mkdir -p $(TARGET_PACKAGES_DIR)
 
 source: $(TARGETS_SOURCE)
@@ -321,66 +121,88 @@
 #
 # Cleanup and misc junk
-# 
-# Fix later.. (yeah!)
 #
 #############################################################
 clean: $(TARGETS_CLEAN)
-	$(RM) -r $(INITRD_MASTER) $(ADD_MASTER) 
+	rm -rf $(STAGING_DIR) $(TARGET_PACKAGES_DIR) $(TARGET_DIR) $(IMAGE)
 
 dirclean: $(TARGETS_DIRCLEAN)
-	$(RM) -r $(INITRD_MASTER) $(ADD_MASTER) 
+	rm -rf $(STAGING_DIR) $(TARGET_PACKAGES_DIR) $(TARGET_DIR) $(IMAGE)
 
 distclean:
-	$(RM) -r $(DL_DIR) $(BUILD_DIR)
-
-veryclean:
-	$(RM) -r $(INITRD_MASTER) 
-	$(RM) -r $(INITRD_DIR)/initrd.sq 
-	$(RM) -r $(ADD_MASTER) 
-	$(RM) $(ADD_DIR)/*.ffw $(ADD_DIR)/*.bz2
-	$(RM) -r $(BUILD_DIR)
-	$(RM) -r $(MODULES_BASE_DIR)
-	# Should have the skeleton or packages somewhere else.
-	$(RM) $(PACKAGES_DIR)/*.ffw $(PACKAGES_DIR)/*.bz2
-	$(RM) -r isoimage*
-	$(RM) -r soekris.tar.bz2
-	$(RM) -r flash.tar.bz2
-	# Dangerous..
-	$(RM) -r floppy*
-
-sourceball: 
-	$(RM) -r $(BUILD_DIR)
+ifeq ($(DL_DIR),$(BASE_DIR)/dl)
+	rm -rf $(DL_DIR)
+endif
+	rm -rf $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE)
+
+sourceball:
+	rm -rf $(BUILD_DIR)
 	set -e; \
 	cd ..; \
-	$(RM) buildroot.tar.bz2; \
+	rm -f buildroot.tar.bz2; \
 	tar -cvf buildroot.tar buildroot; \
-	bzip2 -9 buildroot.tar
-
-list-targets:
-	@(echo "DIRS:"; \
-		for t in $(TMP_DIR) $(DL_DIR) $(BUILD_DIR) \
-		$(MODULES_BASE_DIR) $(MODULES_DIR) \
-		$(ADD_MASTER) $(INITRD_MASTER) $(PACKAGES_DIR); do \
-		echo -e "\t$$t"; \
-	  done \
-	)
-	@echo "TARGETS:"
-	@(for t in $(TARGETS); do \
-		echo -e "\t$$t"; \
-	  done \
-	)
-	@echo "TARGETS_SOURCE:"
-	@(for t in $(TARGETS_SOURCE); do \
-		echo -e "\t$$t"; \
-	  done \
-	)
-	@echo "TARGETS_CLEAN:"
-	@(for t in $(TARGETS_CLEAN); do \
-		echo -e "\t$$t"; \
-	  done \
-	)
-	@echo "TARGETS_DIRCLEAN:"
-	@(for t in $(TARGETS_DIRCLEAN); do \
-		echo -e "\t$$t"; \
-	  done \
-	)
+	bzip2 -9 buildroot.tar; \
+
+
+else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
+
+all: menuconfig
+
+# configuration
+# ---------------------------------------------------------------------------
+
+$(CONFIG)/conf:
+	$(MAKE) -C $(CONFIG) conf
+	-@if [ ! -f .config ] ; then \
+		cp $(CONFIG_DEFCONFIG) .config; \
+	fi
+$(CONFIG)/mconf:
+	$(MAKE) -C $(CONFIG) ncurses conf mconf
+	-@if [ ! -f .config ] ; then \
+		cp $(CONFIG_DEFCONFIG) .config; \
+	fi
+
+menuconfig: $(CONFIG)/mconf
+	@$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
+
+config: $(CONFIG)/conf
+	@$(CONFIG)/conf $(CONFIG_CONFIG_IN)
+
+oldconfig: $(CONFIG)/conf
+	@$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
+
+randconfig: $(CONFIG)/conf
+	@$(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
+
+allyesconfig: $(CONFIG)/conf
+	#@$(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
+	#sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config
+	@$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
+
+allnoconfig: $(CONFIG)/conf
+	@$(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
+
+defconfig: $(CONFIG)/conf
+	@$(CONFIG)/conf -d $(CONFIG_CONFIG_IN)
+
+%_defconfig: $(CONFIG)/conf
+	cp $(shell find . -name $@) .config
+	@$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
+
+#############################################################
+#
+# Cleanup and misc junk
+#
+#############################################################
+clean:
+	rm -f .config .config.old .config.cmd .tmpconfig.h
+	- $(MAKE) -C $(CONFIG) clean
+
+distclean: clean
+	rm -rf sources/*
+
+endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
+
+.PHONY: dummy subdirs release distclean clean config oldconfig \
+	menuconfig tags check test depend defconfig
+
+
