1VERSION = 2
2PATCHLEVEL = 4
3SUBLEVEL = 37
4EXTRAVERSION = .9
5
6KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
7
8ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
9KERNELPATH=kernel-$(shell echo $(KERNELRELEASE) | sed -e "s/-//g")
10
11CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
12	  else if [ -x /bin/bash ]; then echo /bin/bash; \
13	  else echo sh; fi ; fi)
14TOPDIR	:= $(shell /bin/pwd)
15
16HPATH   	= $(TOPDIR)/include
17FINDHPATH	= $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net $(HPATH)/math-emu
18
19HOSTCC  	= gcc
20HOSTCFLAGS	= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
21
22CROSS_COMPILE 	=
23
24#
25# Include the make variables (CC, etc...)
26#
27
28AS		= $(CROSS_COMPILE)as
29LD		= $(CROSS_COMPILE)ld
30CC		= $(CROSS_COMPILE)gcc
31CPP		= $(CC) -E
32AR		= $(CROSS_COMPILE)ar
33NM		= $(CROSS_COMPILE)nm
34STRIP		= $(CROSS_COMPILE)strip
35OBJCOPY		= $(CROSS_COMPILE)objcopy
36OBJDUMP		= $(CROSS_COMPILE)objdump
37MAKEFILES	= $(TOPDIR)/.config
38GENKSYMS	= /sbin/genksyms
39DEPMOD		= /sbin/depmod
40MODFLAGS	= -DMODULE
41CFLAGS_KERNEL	=
42PERL		= perl
43AWK		= awk
44RPM 		:= $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
45		    	else echo rpm; fi)
46
47export	VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
48	CONFIG_SHELL TOPDIR HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
49	CPP AR NM STRIP OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS MODFLAGS PERL AWK
50
51all:	do-it-all
52
53#
54# Make "config" the default target if there is no configuration file or
55# "depend" the target if there is no top-level dependency information.
56#
57
58ifeq (.config,$(wildcard .config))
59include .config
60ifeq (.depend,$(wildcard .depend))
61include .depend
62do-it-all:	Version vmlinux
63else
64CONFIGURATION = depend
65do-it-all:	depend
66endif
67else
68CONFIGURATION = config
69do-it-all:	config
70endif
71
72#
73# INSTALL_PATH specifies where to place the updated kernel and system map
74# images.  Uncomment if you want to place them anywhere other than root.
75#
76
77#export	INSTALL_PATH=/boot
78
79#
80# INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
81# relocations required by build roots.  This is not defined in the
82# makefile but the arguement can be passed to make if needed.
83#
84
85MODLIB	:= $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
86export MODLIB
87
88#
89# standard CFLAGS
90#
91
92CPPFLAGS := -D__KERNEL__ -I$(HPATH)
93
94CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
95	  -fno-strict-aliasing -fno-common
96CFLAGS += -fno-builtin-strpbrk -fno-builtin-sprintf
97ifndef CONFIG_FRAME_POINTER
98CFLAGS += -fomit-frame-pointer
99endif
100AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS)
101
102check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
103if_gcc4 = $(shell if echo __GNUC__ | $(CC) -E -xc - | grep -q '^4$$' > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
104
105# disable pointer signedness warnings in gcc 4.0
106CFLAGS += $(call check_gcc,-Wno-pointer-sign,)
107
108# disable stupid and dangerous "optimization" in gcc 3.2+
109CFLAGS += $(call check_gcc,-fno-delete-null-pointer-checks,)
110
111#
112# ROOT_DEV specifies the default root-device when making the image.
113# This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
114# the default of FLOPPY is used by 'build'.
115# This is i386 specific.
116#
117
118export ROOT_DEV = CURRENT
119
120#
121# If you want to preset the SVGA mode, uncomment the next line and
122# set SVGA_MODE to whatever number you want.
123# Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
124# The number is the same as you would ordinarily press at bootup.
125# This is i386 specific.
126#
127
128export SVGA_MODE = -DSVGA_MODE=NORMAL_VGA
129
130#
131# If you want the RAM disk device, define this to be the size in blocks.
132# This is i386 specific.
133#
134
135#export RAMDISK = -DRAMDISK=512
136
137CORE_FILES	=kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o
138NETWORKS	=net/network.o
139
140LIBS		=$(TOPDIR)/lib/lib.a
141SUBDIRS		=kernel drivers mm fs net ipc lib crypto
142
143DRIVERS-n :=
144DRIVERS-y :=
145DRIVERS-m :=
146DRIVERS-  :=
147
148DRIVERS-$(CONFIG_ACPI_BOOT) += drivers/acpi/acpi.o
149DRIVERS-$(CONFIG_PARPORT) += drivers/parport/driver.o
150DRIVERS-y += drivers/char/char.o \
151	drivers/block/block.o \
152	drivers/misc/misc.o \
153	drivers/net/net.o
154DRIVERS-$(CONFIG_AGP) += drivers/char/agp/agp.o
155DRIVERS-$(CONFIG_DRM_NEW) += drivers/char/drm/drm.o
156DRIVERS-$(CONFIG_DRM_OLD) += drivers/char/drm-4.0/drm.o
157DRIVERS-$(CONFIG_NUBUS) += drivers/nubus/nubus.a
158DRIVERS-$(CONFIG_NET_FC) += drivers/net/fc/fc.o
159DRIVERS-$(CONFIG_DEV_APPLETALK) += drivers/net/appletalk/appletalk.o
160DRIVERS-$(CONFIG_TR) += drivers/net/tokenring/tr.o
161DRIVERS-$(CONFIG_WAN) += drivers/net/wan/wan.o
162DRIVERS-$(CONFIG_ARCNET) += drivers/net/arcnet/arcnetdrv.o
163DRIVERS-$(CONFIG_ATM) += drivers/atm/atm.o
164DRIVERS-$(CONFIG_IDE) += drivers/ide/idedriver.o
165DRIVERS-$(CONFIG_FC4) += drivers/fc4/fc4.a
166DRIVERS-$(CONFIG_SCSI) += drivers/scsi/scsidrv.o
167DRIVERS-$(CONFIG_FUSION_BOOT) += drivers/message/fusion/fusion.o
168DRIVERS-$(CONFIG_IEEE1394) += drivers/ieee1394/ieee1394drv.o
169
170ifneq ($(CONFIG_CD_NO_IDESCSI)$(CONFIG_BLK_DEV_IDECD)$(CONFIG_BLK_DEV_SR)$(CONFIG_PARIDE_PCD),)
171DRIVERS-y += drivers/cdrom/driver.o
172endif
173
174DRIVERS-$(CONFIG_SOUND) += drivers/sound/sounddrivers.o
175DRIVERS-$(CONFIG_PCI) += drivers/pci/driver.o
176DRIVERS-$(CONFIG_MTD) += drivers/mtd/mtdlink.o
177DRIVERS-$(CONFIG_PCMCIA) += drivers/pcmcia/pcmcia.o
178DRIVERS-$(CONFIG_NET_PCMCIA) += drivers/net/pcmcia/pcmcia_net.o
179DRIVERS-$(CONFIG_NET_WIRELESS) += drivers/net/wireless/wireless_net.o
180DRIVERS-$(CONFIG_PCMCIA_CHRDEV) += drivers/char/pcmcia/pcmcia_char.o
181DRIVERS-$(CONFIG_DIO) += drivers/dio/dio.a
182DRIVERS-$(CONFIG_SBUS) += drivers/sbus/sbus_all.o
183DRIVERS-$(CONFIG_ZORRO) += drivers/zorro/driver.o
184DRIVERS-$(CONFIG_FC4) += drivers/fc4/fc4.a
185DRIVERS-$(CONFIG_PPC32) += drivers/macintosh/macintosh.o
186DRIVERS-$(CONFIG_MAC) += drivers/macintosh/macintosh.o
187DRIVERS-$(CONFIG_ISAPNP) += drivers/pnp/pnp.o
188DRIVERS-$(CONFIG_I2C) += drivers/i2c/i2c.o
189DRIVERS-$(CONFIG_VT) += drivers/video/video.o
190DRIVERS-$(CONFIG_PARIDE) += drivers/block/paride/paride.a
191DRIVERS-$(CONFIG_HAMRADIO) += drivers/net/hamradio/hamradio.o
192DRIVERS-$(CONFIG_TC) += drivers/tc/tc.a
193DRIVERS-$(CONFIG_USB) += drivers/usb/usbdrv.o
194DRIVERS-$(CONFIG_USB_GADGET) += drivers/usb/gadget/built-in.o
195DRIVERS-y +=drivers/media/media.o
196DRIVERS-$(CONFIG_INPUT) += drivers/input/inputdrv.o
197DRIVERS-$(CONFIG_HIL) += drivers/hil/hil.o
198DRIVERS-$(CONFIG_I2O) += drivers/message/i2o/i2o.o
199DRIVERS-$(CONFIG_IRDA) += drivers/net/irda/irda.o
200DRIVERS-$(CONFIG_PHONE) += drivers/telephony/telephony.o
201DRIVERS-$(CONFIG_MD) += drivers/md/mddev.o
202DRIVERS-$(CONFIG_GSC) += drivers/gsc/gscbus.o
203DRIVERS-$(CONFIG_BLUEZ) += drivers/bluetooth/bluetooth.o
204DRIVERS-$(CONFIG_HOTPLUG_PCI) += drivers/hotplug/vmlinux-obj.o
205DRIVERS-$(CONFIG_ISDN_BOOL) += drivers/isdn/vmlinux-obj.o
206DRIVERS-$(CONFIG_CRYPTO) += crypto/crypto.o
207
208DRIVERS := $(DRIVERS-y)
209
210
211# files removed with 'make clean'
212CLEAN_FILES = \
213	kernel/ksyms.lst include/linux/compile.h \
214	vmlinux System.map \
215	.tmp* \
216	drivers/char/consolemap_deftbl.c drivers/video/promcon_tbl.c \
217	drivers/char/conmakehash \
218	drivers/char/drm/*-mod.c \
219	drivers/pci/devlist.h drivers/pci/classlist.h drivers/pci/gen-devlist \
220	drivers/zorro/devlist.h drivers/zorro/gen-devlist \
221	drivers/sound/bin2hex drivers/sound/hex2hex \
222	drivers/atm/fore200e_mkfirm drivers/atm/{pca,sba}*{.bin,.bin1,.bin2} \
223	drivers/scsi/aic7xxx/aicasm/aicasm \
224	drivers/scsi/aic7xxx/aicasm/aicasm_gram.c \
225	drivers/scsi/aic7xxx/aicasm/aicasm_gram.h \
226	drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.c \
227	drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.h \
228	drivers/scsi/aic7xxx/aicasm/aicasm_macro_scan.c \
229	drivers/scsi/aic7xxx/aicasm/aicasm_scan.c \
230	drivers/scsi/aic7xxx/aicasm/aicdb.h \
231	drivers/scsi/aic7xxx/aicasm/y.tab.h \
232	drivers/scsi/53c700_d.h \
233	drivers/tc/lk201-map.c \
234	net/khttpd/make_times_h \
235	net/khttpd/times.h \
236	submenu* \
237	drivers/ieee1394/oui.c
238# directories removed with 'make clean'
239CLEAN_DIRS = \
240	modules
241
242# files removed with 'make mrproper'
243MRPROPER_FILES = \
244	include/linux/autoconf.h include/linux/version.h \
245	lib/crc32table.h lib/gen_crc32table \
246	drivers/net/hamradio/soundmodem/sm_tbl_{afsk1200,afsk2666,fsk9600}.h \
247	drivers/net/hamradio/soundmodem/sm_tbl_{hapn4800,psk4800}.h \
248	drivers/net/hamradio/soundmodem/sm_tbl_{afsk2400_7,afsk2400_8}.h \
249	drivers/net/hamradio/soundmodem/gentbl \
250	drivers/sound/*_boot.h drivers/sound/.*.boot \
251	drivers/sound/msndinit.c \
252	drivers/sound/msndperm.c \
253	drivers/sound/pndsperm.c \
254	drivers/sound/pndspini.c \
255	drivers/atm/fore200e_*_fw.c drivers/atm/.fore200e_*.fw \
256	.version .config* config.in config.old \
257	scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp \
258	scripts/lxdialog/*.o scripts/lxdialog/lxdialog \
259	.menuconfig.log \
260	include/asm \
261	.hdepend scripts/mkdep scripts/split-include scripts/docproc \
262	$(TOPDIR)/include/linux/modversions.h \
263	kernel.spec
264
265# directories removed with 'make mrproper'
266MRPROPER_DIRS = \
267	include/config \
268	$(TOPDIR)/include/linux/modules
269
270
271include arch/$(ARCH)/Makefile
272
273# Extra cflags for kbuild 2.4.  The default is to forbid includes by kernel code
274# from user space headers.  Some UML code requires user space headers, in the
275# UML Makefiles add 'kbuild_2_4_nostdinc :=' before include Rules.make.  No
276# other kernel code should include user space headers, if you need
277# 'kbuild_2_4_nostdinc :=' or -I/usr/include for kernel code and you are not UML
278# then your code is broken!  KAO.
279
280kbuild_2_4_nostdinc	:= -nostdinc -iwithprefix include
281export kbuild_2_4_nostdinc
282
283export	CPPFLAGS CFLAGS CFLAGS_KERNEL AFLAGS AFLAGS_KERNEL
284
285export	NETWORKS DRIVERS LIBS HEAD LDFLAGS LINKFLAGS MAKEBOOT ASFLAGS
286
287.S.s:
288	$(CPP) $(AFLAGS) $(AFLAGS_KERNEL) -traditional -o $*.s $<
289.S.o:
290	$(CC) $(AFLAGS) $(AFLAGS_KERNEL) -traditional -c -o $*.o $<
291
292Version: dummy
293	@rm -f include/linux/compile.h
294
295boot: vmlinux
296	@$(MAKE) CFLAGS="$(CFLAGS) $(CFLAGS_KERNEL)" -C arch/$(ARCH)/boot
297
298vmlinux: include/linux/version.h $(CONFIGURATION) init/main.o init/version.o init/do_mounts.o linuxsubdirs
299	$(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o init/do_mounts.o \
300		--start-group \
301		$(CORE_FILES) \
302		$(DRIVERS) \
303		$(NETWORKS) \
304		$(LIBS) \
305		--end-group \
306		-o vmlinux
307	$(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
308
309symlinks:
310	rm -f include/asm
311	( cd include ; ln -sf asm-$(ARCH) asm)
312	@if [ ! -d include/linux/modules ]; then \
313		mkdir include/linux/modules; \
314	fi
315
316oldconfig: symlinks
317	$(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
318
319xconfig: symlinks
320	$(MAKE) -C scripts kconfig.tk
321	wish -f scripts/kconfig.tk
322
323menuconfig: include/linux/version.h symlinks
324	$(MAKE) -C scripts/lxdialog all
325	$(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
326
327config: symlinks
328	$(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
329
330include/config/MARKER: scripts/split-include include/linux/autoconf.h
331	scripts/split-include include/linux/autoconf.h include/config
332	@ touch include/config/MARKER
333
334linuxsubdirs: $(patsubst %, _dir_%, $(SUBDIRS))
335
336$(patsubst %, _dir_%, $(SUBDIRS)) : dummy include/linux/version.h include/config/MARKER
337	$(MAKE) CFLAGS="$(CFLAGS) $(CFLAGS_KERNEL)" -C $(patsubst _dir_%, %, $@)
338
339$(TOPDIR)/include/linux/version.h: include/linux/version.h
340$(TOPDIR)/include/linux/compile.h: include/linux/compile.h
341
342newversion:
343	. scripts/mkversion > .tmpversion
344	@mv -f .tmpversion .version
345
346uts_len		:= 64
347uts_truncate	:= sed -e 's/\(.\{1,$(uts_len)\}\).*/\1/'
348
349include/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion
350	@echo -n \#`cat .version` > .ver1
351	@if [ -n "$(CONFIG_SMP)" ] ; then echo -n " SMP" >> .ver1; fi
352	@if [ -f .name ]; then  echo -n \-`cat .name` >> .ver1; fi
353	@LANG=C echo ' '`date` >> .ver1
354	@echo \#define UTS_VERSION \"`cat .ver1 | $(uts_truncate)`\" > .ver
355	@LANG=C echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
356	@echo \#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
357	@echo \#define LINUX_COMPILE_HOST \"`hostname | $(uts_truncate)`\" >> .ver
358	@([ -x /bin/dnsdomainname ] && /bin/dnsdomainname > .ver1) || \
359	 ([ -x /bin/domainname ] && /bin/domainname > .ver1) || \
360	 echo > .ver1
361	@echo \#define LINUX_COMPILE_DOMAIN \"`cat .ver1 | $(uts_truncate)`\" >> .ver
362	@echo \#define LINUX_COMPILER \"`$(CC) $(CFLAGS) -v 2>&1 | tail -n 1`\" >> .ver
363	@mv -f .ver $@
364	@rm -f .ver1
365
366include/linux/version.h: ./Makefile
367	@expr length "$(KERNELRELEASE)" \<= $(uts_len) > /dev/null || \
368	  (echo KERNELRELEASE \"$(KERNELRELEASE)\" exceeds $(uts_len) characters >&2; false)
369	@echo \#define UTS_RELEASE \"$(KERNELRELEASE)\" > .ver
370	@echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
371	@echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
372	@mv -f .ver $@
373
374comma	:= ,
375
376init/version.o: init/version.c include/linux/compile.h include/config/MARKER
377	$(CC) $(CFLAGS) $(CFLAGS_KERNEL) -DUTS_MACHINE='"$(ARCH)"' -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c -o init/version.o init/version.c
378
379init/main.o: init/main.c include/config/MARKER
380	$(CC) $(CFLAGS) $(CFLAGS_KERNEL) $(PROFILING) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c -o $@ $<
381
382init/do_mounts.o: init/do_mounts.c include/config/MARKER
383	$(CC) $(CFLAGS) $(CFLAGS_KERNEL) $(PROFILING) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c -o $@ $<
384
385fs lib mm ipc kernel drivers net: dummy
386	$(MAKE) CFLAGS="$(CFLAGS) $(CFLAGS_KERNEL)" $(subst $@, _dir_$@, $@)
387
388TAGS: dummy
389	{ find include/asm-${ARCH} -name '*.h' -print ; \
390	find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print ; \
391	find $(SUBDIRS) init arch/${ARCH} -name '*.[chS]' ; } | grep -v SCCS | grep -v '\.svn' | etags -
392
393# Exuberant ctags works better with -I
394tags: dummy
395	CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
396	ctags $$CTAGSF `find include/asm-$(ARCH) -name '*.h'` && \
397	find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print | xargs ctags $$CTAGSF -a && \
398	find $(SUBDIRS) init -name '*.[ch]' | xargs ctags $$CTAGSF -a
399
400cscope: dummy
401	(echo \-k; echo \-q; find * -name '*.[chS]') > cscope.files
402	cscope -b -f cscope.out
403
404ifdef CONFIG_MODULES
405ifdef CONFIG_MODVERSIONS
406MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
407endif
408
409.PHONY: modules
410modules: $(patsubst %, _mod_%, $(SUBDIRS))
411
412.PHONY: $(patsubst %, _mod_%, $(SUBDIRS))
413$(patsubst %, _mod_%, $(SUBDIRS)) : include/linux/version.h include/config/MARKER
414	$(MAKE) -C $(patsubst _mod_%, %, $@) CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules
415
416.PHONY: modules_install
417modules_install: _modinst_ $(patsubst %, _modinst_%, $(SUBDIRS)) _modinst_post
418
419.PHONY: _modinst_
420_modinst_:
421	@rm -rf $(MODLIB)/kernel
422	@rm -f $(MODLIB)/build
423	@mkdir -p $(MODLIB)/kernel
424	@ln -s $(TOPDIR) $(MODLIB)/build
425
426# If System.map exists, run depmod.  This deliberately does not have a
427# dependency on System.map since that would run the dependency tree on
428# vmlinux.  This depmod is only for convenience to give the initial
429# boot a modules.dep even before / is mounted read-write.  However the
430# boot script depmod is the master version.
431ifeq "$(strip $(INSTALL_MOD_PATH))" ""
432depmod_opts	:=
433else
434depmod_opts	:= -b $(INSTALL_MOD_PATH) -r
435endif
436.PHONY: _modinst_post
437_modinst_post: _modinst_post_pcmcia
438	if [ -r System.map ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi
439
440# Backwards compatibilty symlinks for people still using old versions
441# of pcmcia-cs with hard coded pathnames on insmod.  Remove
442# _modinst_post_pcmcia for kernel 2.4.1.
443.PHONY: _modinst_post_pcmcia
444_modinst_post_pcmcia:
445	cd $(MODLIB); \
446	mkdir -p pcmcia; \
447	find kernel -path '*/pcmcia/*' -name '*.o' | xargs -i -r ln -sf ../{} pcmcia
448
449.PHONY: $(patsubst %, _modinst_%, $(SUBDIRS))
450$(patsubst %, _modinst_%, $(SUBDIRS)) :
451	$(MAKE) -C $(patsubst _modinst_%, %, $@) modules_install
452
453# modules disabled....
454
455else
456modules modules_install: dummy
457	@echo
458	@echo "The present kernel configuration has modules disabled."
459	@echo "Type 'make config' and enable loadable module support."
460	@echo "Then build a kernel with module support enabled."
461	@echo
462	@exit 1
463endif
464
465clean:	archclean
466	find . \( -name '*.[oas]' -o -name core -o -name '.*.flags' \) -type f -print \
467		| grep -v lxdialog/ | xargs rm -f
468	rm -f $(CLEAN_FILES)
469	rm -rf $(CLEAN_DIRS)
470	$(MAKE) -C Documentation/DocBook clean
471
472mrproper: clean archmrproper
473	find . \( -size 0 -o -name .depend \) -type f -print | xargs rm -f
474	rm -f $(MRPROPER_FILES)
475	rm -rf $(MRPROPER_DIRS)
476	$(MAKE) -C Documentation/DocBook mrproper
477
478distclean: mrproper
479	rm -f core `find . \( -not -type d \) -and \
480		\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
481		-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
482		-o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -type f -print` TAGS tags cscope*
483
484backup: mrproper
485	cd .. && tar cf - linux/ | gzip -9 > backup.gz
486	sync
487
488sgmldocs:
489	chmod 755 $(TOPDIR)/scripts/docgen
490	chmod 755 $(TOPDIR)/scripts/gen-all-syms
491	chmod 755 $(TOPDIR)/scripts/kernel-doc
492	$(MAKE) -C $(TOPDIR)/Documentation/DocBook books
493
494psdocs: sgmldocs
495	$(MAKE) -C Documentation/DocBook ps
496
497pdfdocs: sgmldocs
498	$(MAKE) -C Documentation/DocBook pdf
499
500htmldocs: sgmldocs
501	$(MAKE) -C Documentation/DocBook html
502
503mandocs:
504	chmod 755 $(TOPDIR)/scripts/kernel-doc
505	chmod 755 $(TOPDIR)/scripts/split-man
506	$(MAKE) -C Documentation/DocBook man
507
508sums:
509	find . -type f -print | sort | xargs sum > .SUMS
510
511dep-files: scripts/mkdep archdep include/linux/version.h
512	rm -f .depend .hdepend
513	$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) _FASTDEP_ALL_SUB_DIRS="$(SUBDIRS)"
514ifdef CONFIG_MODVERSIONS
515	$(MAKE) update-modverfile
516endif
517	scripts/mkdep -- `find $(FINDHPATH) \( -name SCCS -o -name .svn \) -prune -o -follow -name \*.h ! -name modversions.h -print` > .hdepend
518	scripts/mkdep -- init/*.c > .depend
519
520ifdef CONFIG_MODVERSIONS
521MODVERFILE := $(TOPDIR)/include/linux/modversions.h
522else
523MODVERFILE :=
524endif
525export	MODVERFILE
526
527depend dep: dep-files
528
529checkconfig:
530	find * -name '*.[hcS]' -type f -print | sort | xargs $(PERL) -w scripts/checkconfig.pl
531
532checkhelp:
533	find * -name [cC]onfig.in -print | sort | xargs $(PERL) -w scripts/checkhelp.pl
534
535checkincludes:
536	find * -name '*.[hcS]' -type f -print | sort | xargs $(PERL) -w scripts/checkincludes.pl
537
538ifdef CONFIGURATION
539..$(CONFIGURATION):
540	@echo
541	@echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
542	@echo
543	$(MAKE) $(CONFIGURATION)
544	@echo
545	@echo "Successful. Try re-making (ignore the error that follows)"
546	@echo
547	exit 1
548
549#dummy: ..$(CONFIGURATION)
550dummy:
551
552else
553
554dummy:
555
556endif
557
558include Rules.make
559
560#
561# This generates dependencies for the .h files.
562#
563
564scripts/mkdep: scripts/mkdep.c
565	$(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
566
567scripts/split-include: scripts/split-include.c
568	$(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c
569
570#
571# RPM target
572#
573#	If you do a make spec before packing the tarball you can rpm -ta it
574#
575spec:
576	. scripts/mkspec >kernel.spec
577
578#
579#	Build a tar ball, generate an rpm from it and pack the result
580#	There arw two bits of magic here
581#	1) The use of /. to avoid tar packing just the symlink
582#	2) Removing the .dep files as they have source paths in them that
583#	   will become invalid
584#
585rpm:	clean spec
586	find . \( -size 0 -o -name .depend -o -name .hdepend \) -type f -print | xargs rm -f
587	set -e; \
588	cd $(TOPDIR)/.. ; \
589	ln -sf $(TOPDIR) $(KERNELPATH) ; \
590	tar -cvz --exclude CVS -f $(KERNELPATH).tar.gz $(KERNELPATH)/. ; \
591	rm $(KERNELPATH) ; \
592	cd $(TOPDIR) ; \
593	. scripts/mkversion > .version ; \
594	$(RPM) -ta $(TOPDIR)/../$(KERNELPATH).tar.gz ; \
595	rm $(TOPDIR)/../$(KERNELPATH).tar.gz
596