6 KERNELRELEASE
=$(VERSION
).
$(PATCHLEVEL
).
$(SUBLEVEL
)$(EXTRAVERSION
)
8 ARCH
:= $(shell uname
-m | sed
-e s
/i
.86/i386
/ -e s
/sun4u
/sparc64
/ -e s
/arm.
*/arm
/ -e s
/sa110
/arm
/)
10 CONFIG_SHELL
:= $(shell if
[ -x
"$$BASH" ]; then echo
$$BASH; \
11 else if
[ -x
/bin
/bash
]; then echo
/bin
/bash
; \
12 else echo sh
; fi
; fi
)
13 TOPDIR
:= $(shell if
[ "$$PWD" != "" ]; then echo
$$PWD; else pwd
; fi
)
15 HPATH
= $(TOPDIR
)/include
16 FINDHPATH
= $(HPATH
)/asm
$(HPATH
)/linux
$(HPATH
)/scsi
$(HPATH
)/net
19 HOSTCFLAGS
= -Wall
-Wstrict-prototypes
-O2
-fomit-frame-pointer
24 # Include the make variables (CC, etc...)
27 AS
= $(CROSS_COMPILE
)as
28 LD
= $(CROSS_COMPILE
)ld
29 CC
= $(CROSS_COMPILE
)gcc
31 AR
= $(CROSS_COMPILE
)ar
32 NM
= $(CROSS_COMPILE
)nm
33 STRIP
= $(CROSS_COMPILE
)strip
34 OBJCOPY
= $(CROSS_COMPILE
)objcopy
35 OBJDUMP
= $(CROSS_COMPILE
)objdump
36 MAKEFILES
= $(TOPDIR
)/.config
37 GENKSYMS
= /sbin
/genksyms
43 export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
44 CONFIG_SHELL TOPDIR HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
45 CPP AR NM STRIP OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS MODFLAGS PERL
50 # Make "config" the default target if there is no configuration file or
51 # "depend" the target if there is no top-level dependency information.
54 ifeq (.config
,$(wildcard .config
))
56 ifeq (.depend
,$(wildcard .depend
))
58 do-it-all
: Version vmlinux
60 CONFIGURATION
= depend
64 CONFIGURATION
= config
69 # INSTALL_PATH specifies where to place the updated kernel and system map
70 # images. Uncomment if you want to place them anywhere other than root.
73 #export INSTALL_PATH=/boot
76 # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
77 # relocations required by build roots. This is not defined in the
78 # makefile but the arguement can be passed to make if needed.
81 MODLIB
:= $(INSTALL_MOD_PATH
)/lib
/modules
/$(KERNELRELEASE
)
88 CPPFLAGS
:= -D__KERNEL__
-I
$(HPATH
)
90 CFLAGS
:= $(CPPFLAGS
) -Wall
-Wstrict-prototypes
-O2
-fomit-frame-pointer
91 AFLAGS
:= -D__ASSEMBLY__
$(CPPFLAGS
)
94 # ROOT_DEV specifies the default root-device when making the image.
95 # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
96 # the default of FLOPPY is used by 'build'.
97 # This is i386 specific.
100 export ROOT_DEV
= CURRENT
103 # If you want to preset the SVGA mode, uncomment the next line and
104 # set SVGA_MODE to whatever number you want.
105 # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
106 # The number is the same as you would ordinarily press at bootup.
107 # This is i386 specific.
110 export SVGA_MODE
= -DSVGA_MODE
=NORMAL_VGA
113 # if you want the RAM disk device, define this to be the
115 # This is i386 specific.
118 #export RAMDISK = -DRAMDISK=512
120 CORE_FILES
=kernel
/kernel.o mm
/mm.o fs
/fs.o ipc
/ipc.o
121 NETWORKS
=net
/network.o
122 DRIVERS
=drivers
/block
/block.o \
123 drivers
/char
/char.o \
124 drivers
/misc
/misc.o \
126 drivers
/parport
/parport.a
127 LIBS
=$(TOPDIR
)/lib
/lib.a
128 SUBDIRS
=kernel drivers mm fs net ipc lib
135 DRIVERS-
$(CONFIG_AGP
) += drivers
/char
/agp
/agp.o
136 DRIVERS-
$(CONFIG_DRM
) += drivers
/char
/drm
/drm.o
137 DRIVERS-
$(CONFIG_NUBUS
) += drivers
/nubus
/nubus.a
138 DRIVERS-
$(CONFIG_ISDN
) += drivers
/isdn
/isdn.a
139 DRIVERS-
$(CONFIG_NET_FC
) += drivers
/net
/fc/fc.o
140 DRIVERS-
$(CONFIG_APPLETALK
) += drivers
/net
/appletalk
/appletalk.a
141 DRIVERS-
$(CONFIG_TR
) += drivers
/net
/tokenring
/tr.a
142 DRIVERS-
$(CONFIG_WAN
) += drivers
/net
/wan
/wan.o
143 DRIVERS-
$(CONFIG_ARCNET
) += drivers
/net
/arcnet
/arcnet.a
144 DRIVERS-
$(CONFIG_ATM
) += drivers
/atm
/atm.o
145 DRIVERS-
$(CONFIG_IDE
) += drivers
/ide
/idedriver.o
146 DRIVERS-
$(CONFIG_SCSI
) += drivers
/scsi
/scsidrv.o
147 DRIVERS-
$(CONFIG_IEEE1394
) += drivers
/ieee1394
/ieee1394.a
149 ifneq ($(CONFIG_CD_NO_IDESCSI
)$(CONFIG_BLK_DEV_IDECD
)$(CONFIG_BLK_DEV_SR
)$(CONFIG_PARIDE_PCD
),)
150 DRIVERS-y
+= drivers
/cdrom
/cdrom.a
153 DRIVERS-
$(CONFIG_SOUND
) += drivers
/sound
/sounddrivers.o
154 DRIVERS-
$(CONFIG_PCI
) += drivers
/pci
/pci.a
155 DRIVERS-
$(CONFIG_MTD
) += drivers
/mtd
/mtdlink.o
156 DRIVERS-
$(CONFIG_PCMCIA
) += drivers
/pcmcia
/pcmcia.o
157 DRIVERS-
$(CONFIG_PCMCIA_NETCARD
) += drivers
/net
/pcmcia
/pcmcia_net.o
158 DRIVERS-
$(CONFIG_PCMCIA_CHRDEV
) += drivers
/char
/pcmcia
/pcmcia_char.o
159 DRIVERS-
$(CONFIG_DIO
) += drivers
/dio
/dio.a
160 DRIVERS-
$(CONFIG_SBUS
) += drivers
/sbus
/sbus.a
161 DRIVERS-
$(CONFIG_ZORRO
) += drivers
/zorro
/zorro.a
162 DRIVERS-
$(CONFIG_FC4
) += drivers
/fc4
/fc4.a
163 DRIVERS-
$(CONFIG_PPC
) += drivers
/macintosh
/macintosh.o
164 DRIVERS-
$(CONFIG_MAC
) += drivers
/macintosh
/macintosh.o
165 DRIVERS-
$(CONFIG_ISAPNP
) += drivers
/pnp
/pnp.o
166 DRIVERS-
$(CONFIG_SGI_IP22
) += drivers
/sgi
/sgi.a
167 DRIVERS-
$(CONFIG_VT
) += drivers
/video
/video.o
168 DRIVERS-
$(CONFIG_PARIDE
) += drivers
/block
/paride
/paride.a
169 DRIVERS-
$(CONFIG_HAMRADIO
) += drivers
/net
/hamradio
/hamradio.o
170 DRIVERS-
$(CONFIG_TC
) += drivers
/tc
/tc.a
171 DRIVERS-
$(CONFIG_USB
) += drivers
/usb
/usbdrv.o
172 DRIVERS-
$(CONFIG_I2O
) += drivers
/i2o
/i2o.o
173 DRIVERS-
$(CONFIG_IRDA
) += drivers
/net
/irda
/irda.o
174 DRIVERS-
$(CONFIG_I2C
) += drivers
/i2c
/i2c.o
175 DRIVERS-
$(CONFIG_PHONE
) += drivers
/telephony
/telephony.a
176 DRIVERS-
$(CONFIG_ACPI_INTERPRETER
) += drivers
/acpi
/acpi.o
178 DRIVERS
+= $(DRIVERS-y
)
180 include arch
/$(ARCH
)/Makefile
182 # use '-fno-strict-aliasing', but only if the compiler can take it
183 CFLAGS
+= $(shell if
$(CC
) -fno-strict-aliasing
-S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-fno-strict-aliasing"; fi
)
185 export CPPFLAGS CFLAGS AFLAGS
187 export NETWORKS DRIVERS LIBS HEAD LDFLAGS LINKFLAGS MAKEBOOT ASFLAGS
190 $(CPP
) $(AFLAGS
) -traditional
-o
$*.s
$<
192 $(CC
) $(AFLAGS
) -traditional
-c
-o
$*.o
$<
195 @
rm -f
include/linux
/compile.h
198 @
$(MAKE
) CFLAGS
="$(CFLAGS) $(CFLAGS_KERNEL)" -C arch
/$(ARCH
)/boot
200 vmlinux
: $(CONFIGURATION
) init
/main.o init
/version.o linuxsubdirs
201 $(LD
) $(LINKFLAGS
) $(HEAD
) init
/main.o init
/version.o \
209 $(NM
) vmlinux | grep
-v
'\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' |
sort > System.map
213 ( cd
include ; ln
-sf asm-
$(ARCH
) asm
)
214 @if
[ ! -d
include/linux
/modules
]; then \
215 mkdir
include/linux
/modules
; \
219 $(CONFIG_SHELL
) scripts
/Configure
-d arch
/$(ARCH
)/config.in
222 $(MAKE
) -C scripts kconfig.tk
223 wish
-f scripts
/kconfig.tk
225 menuconfig
: include/linux
/version.h symlinks
226 $(MAKE
) -C scripts
/lxdialog
all
227 $(CONFIG_SHELL
) scripts
/Menuconfig arch
/$(ARCH
)/config.in
230 $(CONFIG_SHELL
) scripts
/Configure arch
/$(ARCH
)/config.in
232 include/config
/MARKER
: scripts
/split-include
include/linux
/autoconf.h
233 scripts
/split-include
include/linux
/autoconf.h
include/config
234 @ touch
include/config
/MARKER
236 linuxsubdirs
: $(patsubst %, _dir_
%, $(SUBDIRS
))
238 $(patsubst %, _dir_
%, $(SUBDIRS
)) : dummy
include/linux
/version.h
include/config
/MARKER
239 $(MAKE
) CFLAGS
="$(CFLAGS) $(CFLAGS_KERNEL)" -C
$(patsubst _dir_
%, %, $@
)
241 $(TOPDIR
)/include/linux
/version.h
: include/linux
/version.h
242 $(TOPDIR
)/include/linux
/compile.h
: include/linux
/compile.h
245 @if
[ ! -f .version
]; then \
248 expr
0`cat .version` + 1 > .version
; \
251 include/linux
/compile.h
: $(CONFIGURATION
) include/linux
/version.h newversion
252 @echo
-n \
#define UTS_VERSION \"\#`cat .version` > .ver
253 @if
[ -n
"$(CONFIG_SMP)" ] ; then echo
-n
" SMP" >> .ver
; fi
254 @if
[ -f .name
]; then echo
-n \
-`cat .name` >> .ver
; fi
255 @echo
' '`date`'"' >> .ver
256 @echo \
#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
257 @echo \
#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
258 @echo \
#define LINUX_COMPILE_HOST \"`hostname`\" >> .ver
259 @if
[ -x
/bin
/dnsdomainname
]; then \
260 echo \
#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\"; \
261 elif
[ -x
/bin
/domainname
]; then \
262 echo \
#define LINUX_COMPILE_DOMAIN \"`domainname`\"; \
264 echo \
#define LINUX_COMPILE_DOMAIN ; \
266 @echo \
#define LINUX_COMPILER \"`$(CC) $(CFLAGS) -v 2>&1 | tail -1`\" >> .ver
269 include/linux
/version.h
: .
/Makefile
270 @echo \
#define UTS_RELEASE \"$(KERNELRELEASE)\" > .ver
271 @echo \
#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
272 @echo
'#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
275 init
/version.o
: init
/version.c
include/linux
/compile.h
include/config
/MARKER
276 $(CC
) $(CFLAGS
) $(CFLAGS_KERNEL
) -DUTS_MACHINE
='"$(ARCH)"' -c
-o init
/version.o init
/version.c
278 init
/main.o
: init
/main.c
include/config
/MARKER
279 $(CC
) $(CFLAGS
) $(CFLAGS_KERNEL
) $(PROFILING
) -c
-o
$*.o
$<
281 fs lib mm ipc kernel drivers net
: dummy
282 $(MAKE
) CFLAGS
="$(CFLAGS) $(CFLAGS_KERNEL)" $(subst $@
, _dir_
$@
, $@
)
285 etags
`find include/asm-$(ARCH) -name '*.h'`
286 find
include -type d \
( -name
"asm-*" -o
-name config \
) -prune
-o
-name
'*.h' -print | xargs etags
-a
287 find
$(SUBDIRS
) init
-name
'*.c' | xargs etags
-a
289 # Exuberant ctags works better with -I
291 CTAGSF
=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__initlocaldata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
292 ctags
$$CTAGSF `find include/asm-$(ARCH) -name '*.h'` && \
293 find
include -type d \
( -name
"asm-*" -o
-name config \
) -prune
-o
-name
'*.h' -print | xargs ctags
$$CTAGSF -a
&& \
294 find
$(SUBDIRS
) init
-name
'*.c' | xargs ctags
$$CTAGSF -a
297 ifdef CONFIG_MODVERSIONS
298 MODFLAGS
+= -DMODVERSIONS
-include $(HPATH
)/linux
/modversions.h
302 modules
: $(patsubst %, _mod_
%, $(SUBDIRS
))
304 .PHONY
: $(patsubst %, _mod_
%, $(SUBDIRS
))
305 $(patsubst %, _mod_
%, $(SUBDIRS
)) : include/linux
/version.h
include/config
/MARKER
306 $(MAKE
) -C
$(patsubst _mod_
%, %, $@
) CFLAGS
="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES
=1 modules
308 .PHONY
: modules_install
309 modules_install
: _modinst_
$(patsubst %, _modinst_
%, $(SUBDIRS
)) _modinst_post
313 @
rm -rf
$(MODLIB
)/kernel
314 @
rm -f
$(MODLIB
)/build
315 @mkdir
-p
$(MODLIB
)/kernel
316 @ln
-s
$(TOPDIR
) $(MODLIB
)/build
318 # If System.map exists, run depmod. This deliberately does not have a
319 # dependency on System.map since that would run the dependency tree on
320 # vmlinux. This depmod is only for convenience to give the initial
321 # boot a modules.dep even before / is mounted read-write. However the
322 # boot script depmod is the master version.
323 ifeq "$(strip $(INSTALL_MOD_PATH))" ""
326 depmod_opts
:= -b
$(INSTALL_MOD_PATH
) -r
328 .PHONY
: _modinst_post
329 _modinst_post
: _modinst_post_pcmcia
330 if
[ -r System.map
]; then
$(DEPMOD
) -ae
-F System.map
$(depmod_opts
) $(KERNELRELEASE
); fi
332 # Backwards compatibilty symlinks for people still using old versions
333 # of pcmcia-cs with hard coded pathnames on insmod. Remove
334 # _modinst_post_pcmcia for kernel 2.4.1.
335 .PHONY
: _modinst_post_pcmcia
336 _modinst_post_pcmcia
:
339 find kernel
-path
'*/pcmcia/*' -name
'*.o' | xargs
-i
-r ln
-sf ..
/{} pcmcia
341 .PHONY
: $(patsubst %, _modinst_
%, $(SUBDIRS
))
342 $(patsubst %, _modinst_
%, $(SUBDIRS
)) :
343 $(MAKE
) -C
$(patsubst _modinst_
%, %, $@
) modules_install
345 # modules disabled....
348 modules modules_install
: dummy
350 @echo
"The present kernel configuration has modules disabled."
351 @echo
"Type 'make config' and enable loadable module support."
352 @echo
"Then build a kernel with module support enabled."
358 rm -f kernel
/ksyms.lst
include/linux
/compile.h
359 find .
-name
'*.[oas]' -type f
-print | grep
-v lxdialog
/ | xargs
rm -f
360 rm -f core
`find . -type f -name 'core' -print`
361 rm -f core
`find . -type f -name '.*.flags' -print`
362 rm -f vmlinux System.map
364 rm -f drivers
/char
/consolemap_deftbl.c drivers
/video
/promcon_tbl.c
365 rm -f drivers
/char
/conmakehash
366 rm -f drivers
/pci
/devlist.h drivers
/pci
/classlist.h drivers
/pci
/gen-devlist
367 rm -f drivers
/sound
/bin2hex drivers
/sound
/hex2hex
368 rm -f drivers
/atm
/fore200e_mkfirm drivers
/atm
/{pca
,sba
}*{.bin
,.bin1
,.bin2
}
369 rm -f net
/khttpd
/make_times_h
370 rm -f net
/khttpd
/times.h
373 $(MAKE
) -C Documentation
/DocBook
clean
375 mrproper
: clean archmrproper
376 rm -f
include/linux
/autoconf.h
include/linux
/version.h
377 rm -f drivers
/net
/hamradio
/soundmodem
/sm_tbl_
{afsk1200
,afsk2666
,fsk9600
}.h
378 rm -f drivers
/net
/hamradio
/soundmodem
/sm_tbl_
{hapn4800
,psk4800
}.h
379 rm -f drivers
/net
/hamradio
/soundmodem
/sm_tbl_
{afsk2400_7
,afsk2400_8
}.h
380 rm -f drivers
/net
/hamradio
/soundmodem
/gentbl
381 rm -f drivers
/char
/hfmodem
/gentbl drivers
/char
/hfmodem
/tables.h
382 rm -f drivers
/sound
/*_boot.h drivers
/sound
/.
*.boot
383 rm -f drivers
/sound
/msndinit.c
384 rm -f drivers
/sound
/msndperm.c
385 rm -f drivers
/sound
/pndsperm.c
386 rm -f drivers
/sound
/pndspini.c
387 rm -f drivers
/atm
/fore200e_
*_fw.c drivers
/atm
/.fore200e_
*.fw
388 rm -f .version .config
* config.in config.old
389 rm -f scripts
/tkparse scripts
/kconfig.tk scripts
/kconfig.tmp
390 rm -f scripts
/lxdialog
/*.o scripts
/lxdialog
/lxdialog
391 rm -f .menuconfig.log
393 rm -rf
include/config
394 rm -f .depend
`find . -type f -name .depend -print`
395 rm -f core
`find . -type f -size 0 -print`
396 rm -f .hdepend scripts
/mkdep scripts
/split-include scripts
/docproc
397 rm -f
$(TOPDIR
)/include/linux
/modversions.h
398 rm -rf
$(TOPDIR
)/include/linux
/modules
399 $(MAKE
) -C Documentation
/DocBook mrproper
401 rm -f core
`find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
402 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
403 -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print` TAGS
tags
406 cd ..
&& tar cf
- linux
/ | gzip
-9 > backup.gz
410 chmod
755 $(TOPDIR
)/scripts
/docgen
411 chmod
755 $(TOPDIR
)/scripts
/gen-all-syms
412 chmod
755 $(TOPDIR
)/scripts
/kernel-doc
413 $(MAKE
) -C
$(TOPDIR
)/Documentation
/DocBook books
416 $(MAKE
) -C Documentation
/DocBook ps
419 $(MAKE
) -C Documentation
/DocBook pdf
422 $(MAKE
) -C Documentation
/DocBook html
425 find .
-type f
-print |
sort | xargs sum
> .SUMS
427 dep-files
: scripts
/mkdep archdep
include/linux
/version.h
428 scripts
/mkdep init
/*.c
> .depend
429 scripts
/mkdep
`find $(FINDHPATH) -name SCCS -prune -o -follow -name \*.h ! -name modversions.h -print` > .hdepend
430 $(MAKE
) $(patsubst %,_sfdep_
%,$(SUBDIRS
)) _FASTDEP_ALL_SUB_DIRS
="$(SUBDIRS)"
431 ifdef CONFIG_MODVERSIONS
432 $(MAKE
) update-modverfile
435 ifdef CONFIG_MODVERSIONS
436 MODVERFILE
:= $(TOPDIR
)/include/linux
/modversions.h
442 depend dep
: dep-files
444 # make checkconfig: Prune 'scripts' directory to avoid "false positives".
446 find
* -name
'*.[hcS]' -type f
-print | grep
-v scripts
/ |
sort | xargs
$(PERL
) -w scripts
/checkconfig.pl
449 find
* -name
[cC
]onfig.in
-print |
sort | xargs
$(PERL
) -w scripts
/checkhelp.pl
452 find
* -name
'*.[hcS]' -type f
-print |
sort | xargs
$(PERL
) -w scripts
/checkincludes.pl
457 @echo
"You have a bad or nonexistent" .
$(CONFIGURATION
) ": running 'make" $(CONFIGURATION
)"'"
459 $(MAKE
) $(CONFIGURATION
)
461 @echo
"Successful. Try re-making (ignore the error that follows)"
465 #dummy: ..$(CONFIGURATION)
477 # This generates dependencies for the .h files.
480 scripts
/mkdep
: scripts
/mkdep.c
481 $(HOSTCC
) $(HOSTCFLAGS
) -o scripts
/mkdep scripts
/mkdep.c
483 scripts
/split-include
: scripts
/split-include.c
484 $(HOSTCC
) $(HOSTCFLAGS
) -o scripts
/split-include scripts
/split-include.c