#
# To restore the kernel configuration installed on this machine, please
# do
#
# make restore
# make dep
# make bzImage
# make modules
#
# If you want to customize the kernel, you have to first comment out
#
#ifneq (1,$(NRPROC))
#EXTRAVERSION:=$(EXTRAVERSION)smp
#endif
#
# in this file and change "EXTRAVERSION" to something like
#
#EXTRAVERSION:=$(EXTRAVERSION)-customized
# 
# Otherwise, you will override the default kernel with your customized
# one, which will lead to machine malfunction. Then please do
#
# make restore
# make [xconfig|menuconfig|config]
# make dep
# make bzImage
# make modules
# make modules_install
#
# You should copy arch/i386/boot/bzImage and System.map to /boot. Also
# you need to edit /etc/lilo.conf and run lilo.

include Makefile

NRPROC=$(shell /usr/bin/getconf _NPROCESSORS_ONLN)
NJOBS=$(shell expr $(NRPROC) + $(NRPROC))
MAKE=make -j $(NJOBS)

# Comment these out and change EXTRAVERSION to something different if
# you want to customize the kernel. See above
ifneq (1,$(NRPROC))
EXTRAVERSION:=$(EXTRAVERSION)smp
endif

#EXTRAVERSION:=$(EXTRAVERSION)-customized

restore:
	$(MAKE) mrproper
	cpu=`head -10 /proc/cpuinfo | grep "family" | cut -d':' -f2`; \
	cpu=`expr $$cpu`; \
	case $$cpu in \
	5) cpu=i586;; \
	6) cpu=i686;; \
	*) cpu=i386;; \
	esac; \
	if [ $(NRPROC) -ne 1 ] ; then smp=-smp; fi; \
	cp -af configs/kernel-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)-$${cpu}$${smp}.config .config
	$(MAKE) oldconfig
