OSDN Git Service

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