Makefile at [1dddebba6a]

File kernel/Makefile artifact e8365af227 part of check-in 1dddebba6a


KERNEL_VERSION = 3.4.7
KERNEL_URL = http://www.kernel.org/pub/linux/kernel/v3.0/linux-$(KERNEL_VERSION).tar.bz2
PLATFORM = x86
MODULES_LIST = kernel/drivers/usb/storage/*.ko kernel/drivers/message/fusion/*.ko kernel/drivers/scsi/*.ko kernel/drivers/scsi/*/*.ko kernel/drivers/ata/*.ko kernel/drivers/ata/*/*.ko

all: vmlinuz modules modules-all

vmlinuz modules-all: linux-$(KERNEL_VERSION) linux-$(KERNEL_VERSION)/.config
	$(MAKE) -C linux-$(KERNEL_VERSION)
	rm -rf boot modules-all
	mkdir boot modules-all
	-$(MAKE) -C linux-$(KERNEL_VERSION) INSTALL_PATH="$(shell pwd)/boot" install
	$(MAKE) -C linux-$(KERNEL_VERSION) INSTALL_MOD_PATH="$(shell pwd)/modules-all" modules_install
	cp boot/vmlinuz .

modules: modules-all
	rm -rf modules
	mkdir modules/modules modules/firmware
	./generate_modules_dir 'modules-all/lib/modules/$(KERNEL_VERSION)-appbox' modules/modules '$(MODULES_LIST)'
	cp -rp modules-all/lib/firmware modules/

linux-$(KERNEL_VERSION)/.config: linux-$(KERNEL_VERSION)-$(PLATFORM)-config linux-$(KERNEL_VERSION)
	cp linux-$(KERNEL_VERSION)-$(PLATFORM)-config linux-$(KERNEL_VERSION)/.config

linux-$(KERNEL_VERSION): linux-$(KERNEL_VERSION).tar.bz2
	tar -xf linux-$(KERNEL_VERSION).tar.bz2

linux-$(KERNEL_VERSION).tar.bz2:
	wget -O "$@.new" $(KERNEL_URL)
	tar -tf "$@.new" >/dev/null
	mv "$@.new" "$@"

clean:
	rm -rf boot modules-all modules
	rm -rf linux-$(KERNEL_VERSION)
	rm -f linux-$(KERNEL_VERSION).tar.bz2.new
	rm -f vmlinuz

distclean: clean
	rm -f linux-$(KERNEL_VERSION).tar.bz2

.PHONY: all clean distclean