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
/media
/media.o \
127 drivers
/parport
/parport.a
128 LIBS
=$(TOPDIR
)/lib
/lib.a
129 SUBDIRS
=kernel drivers mm fs net ipc lib
136 DRIVERS-
$(CONFIG_AGP
) += drivers
/char
/agp
/agp.o
137 DRIVERS-
$(CONFIG_DRM
) += drivers
/char
/drm
/drm.o
138 DRIVERS-
$(CONFIG_NUBUS
) += drivers
/nubus
/nubus.a
139 DRIVERS-
$(CONFIG_ISDN
) += drivers
/isdn
/isdn.a
140 DRIVERS-
$(CONFIG_NET_FC
) += drivers
/net
/fc/fc.o
141 DRIVERS-
$(CONFIG_APPLETALK
) += drivers
/net
/appletalk
/appletalk.a
142 DRIVERS-
$(CONFIG_TR
) += drivers
/net
/tokenring
/tr.a
143 DRIVERS-
$(CONFIG_WAN
) += drivers
/net
/wan
/wan.o
144 DRIVERS-
$(CONFIG_ARCNET
) += drivers
/net
/arcnet
/arcnet.a
145 DRIVERS-
$(CONFIG_ATM
) += drivers
/atm
/atm.o
146 DRIVERS-
$(CONFIG_IDE
) += drivers
/ide
/idedriver.o
147 DRIVERS-
$(CONFIG_SCSI
) += drivers
/scsi
/scsidrv.o
148 DRIVERS-
$(CONFIG_IEEE1394
) += drivers
/ieee1394
/ieee1394.a
150 ifneq ($(CONFIG_CD_NO_IDESCSI
)$(CONFIG_BLK_DEV_IDECD
)$(CONFIG_BLK_DEV_SR
)$(CONFIG_PARIDE_PCD
),)
151 DRIVERS-y
+= drivers
/cdrom
/cdrom.a
154 DRIVERS-
$(CONFIG_SOUND
) += drivers
/sound
/sounddrivers.o
155 DRIVERS-
$(CONFIG_PCI
) += drivers
/pci
/pci.a
156 DRIVERS-
$(CONFIG_MTD
) += drivers
/mtd
/mtdlink.o
157 DRIVERS-
$(CONFIG_PCMCIA
) += drivers
/pcmcia
/pcmcia.o
158 DRIVERS-
$(CONFIG_PCMCIA_NETCARD
) += drivers
/net
/pcmcia
/pcmcia_net.o
159 DRIVERS-
$(CONFIG_PCMCIA_CHRDEV
) += drivers
/char
/pcmcia
/pcmcia_char.o
160 DRIVERS-
$(CONFIG_DIO
) += drivers
/dio
/dio.a
161 DRIVERS-
$(CONFIG_SBUS
) += drivers
/sbus
/sbus.a
162 DRIVERS-
$(CONFIG_ZORRO
) += drivers
/zorro
/zorro.a
163 DRIVERS-
$(CONFIG_FC4
) += drivers
/fc4
/fc4.a
164 DRIVERS-
$(CONFIG_PPC
) += drivers
/macintosh
/macintosh.o
165 DRIVERS-
$(CONFIG_MAC
) += drivers
/macintosh
/macintosh.o
166 DRIVERS-
$(CONFIG_ISAPNP
) += drivers
/pnp
/pnp.o
167 DRIVERS-
$(CONFIG_SGI_IP22
) += drivers
/sgi
/sgi.a
168 DRIVERS-
$(CONFIG_VT
) += drivers
/video
/video.o
169 DRIVERS-
$(CONFIG_PARIDE
) += drivers
/block
/paride
/paride.a
170 DRIVERS-
$(CONFIG_HAMRADIO
) += drivers
/net
/hamradio
/hamradio.o
171 DRIVERS-
$(CONFIG_TC
) += drivers
/tc
/tc.a
172 DRIVERS-
$(CONFIG_USB
) += drivers
/usb
/usbdrv.o
173 DRIVERS-
$(CONFIG_INPUT
) += drivers
/input
/inputdrv.o
174 DRIVERS-
$(CONFIG_I2O
) += drivers
/i2o
/i2o.o
175 DRIVERS-
$(CONFIG_IRDA
) += drivers
/net
/irda
/irda.o
176 DRIVERS-
$(CONFIG_I2C
) += drivers
/i2c
/i2c.o
177 DRIVERS-
$(CONFIG_PHONE
) += drivers
/telephony
/telephony.a
178 DRIVERS-
$(CONFIG_ACPI_INTERPRETER
) += drivers
/acpi
/acpi.o
180 DRIVERS
+= $(DRIVERS-y
)
182 include arch
/$(ARCH
)/Makefile
184 # use '-fno-strict-aliasing', but only if the compiler can take it
185 CFLAGS
+= $(shell if
$(CC
) -fno-strict-aliasing
-S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-fno-strict-aliasing"; fi
)
187 export CPPFLAGS CFLAGS AFLAGS
189 export NETWORKS DRIVERS LIBS HEAD LDFLAGS LINKFLAGS MAKEBOOT ASFLAGS
192 $(CPP
) $(AFLAGS
) -traditional
-o
$*.s
$<
194 $(CC
) $(AFLAGS
) -traditional
-c
-o
$*.o
$<
197 @
rm -f
include/linux
/compile.h
200 @
$(MAKE
) CFLAGS
="$(CFLAGS) $(CFLAGS_KERNEL)" -C arch
/$(ARCH
)/boot
202 vmlinux
: $(CONFIGURATION
) init
/main.o init
/version.o linuxsubdirs
203 $(LD
) $(LINKFLAGS
) $(HEAD
) init
/main.o init
/version.o \
211 $(NM
) vmlinux | grep
-v
'\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' |
sort > System.map
215 ( cd
include ; ln
-sf asm-
$(ARCH
) asm
)
216 @if
[ ! -d
include/linux
/modules
]; then \
217 mkdir
include/linux
/modules
; \
221 $(CONFIG_SHELL
) scripts
/Configure
-d arch
/$(ARCH
)/config.in
224 $(MAKE
) -C scripts kconfig.tk
225 wish
-f scripts
/kconfig.tk
227 menuconfig
: include/linux
/version.h symlinks
228 $(MAKE
) -C scripts
/lxdialog
all
229 $(CONFIG_SHELL
) scripts
/Menuconfig arch
/$(ARCH
)/config.in
232 $(CONFIG_SHELL
) scripts
/Configure arch
/$(ARCH
)/config.in
234 include/config
/MARKER
: scripts
/split-include
include/linux
/autoconf.h
235 scripts
/split-include
include/linux
/autoconf.h
include/config
236 @ touch
include/config
/MARKER
238 linuxsubdirs
: $(patsubst %, _dir_
%, $(SUBDIRS
))
240 $(patsubst %, _dir_
%, $(SUBDIRS
)) : dummy
include/linux
/version.h
include/config
/MARKER
241 $(MAKE
) CFLAGS
="$(CFLAGS) $(CFLAGS_KERNEL)" -C
$(patsubst _dir_
%, %, $@
)
243 $(TOPDIR
)/include/linux
/version.h
: include/linux
/version.h
244 $(TOPDIR
)/include/linux
/compile.h
: include/linux
/compile.h
247 @if
[ ! -f .version
]; then \
250 expr
0`cat .version` + 1 > .version
; \
253 include/linux
/compile.h
: $(CONFIGURATION
) include/linux
/version.h newversion
254 @echo
-n \
#define UTS_VERSION \"\#`cat .version` > .ver
255 @if
[ -n
"$(CONFIG_SMP)" ] ; then echo
-n
" SMP" >> .ver
; fi
256 @if
[ -f .name
]; then echo
-n \
-`cat .name` >> .ver
; fi
257 @echo
' '`date`'"' >> .ver
258 @echo \
#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
259 @echo \
#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
260 @echo \
#define LINUX_COMPILE_HOST \"`hostname`\" >> .ver
261 @if
[ -x
/bin
/dnsdomainname
]; then \
262 echo \
#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\"; \
263 elif
[ -x
/bin
/domainname
]; then \
264 echo \
#define LINUX_COMPILE_DOMAIN \"`domainname`\"; \
266 echo \
#define LINUX_COMPILE_DOMAIN ; \
268 @echo \
#define LINUX_COMPILER \"`$(CC) $(CFLAGS) -v 2>&1 | tail -1`\" >> .ver
271 include/linux
/version.h
: .
/Makefile
272 @echo \
#define UTS_RELEASE \"$(KERNELRELEASE)\" > .ver
273 @echo \
#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
274 @echo
'#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
277 init
/version.o
: init
/version.c
include/linux
/compile.h
include/config
/MARKER
278 $(CC
) $(CFLAGS
) $(CFLAGS_KERNEL
) -DUTS_MACHINE
='"$(ARCH)"' -c
-o init
/version.o init
/version.c
280 init
/main.o
: init
/main.c
include/config
/MARKER
281 $(CC
) $(CFLAGS
) $(CFLAGS_KERNEL
) $(PROFILING
) -c
-o
$*.o
$<
283 fs lib mm ipc kernel drivers net
: dummy
284 $(MAKE
) CFLAGS
="$(CFLAGS) $(CFLAGS_KERNEL)" $(subst $@
, _dir_
$@
, $@
)
287 etags
`find include/asm-$(ARCH) -name '*.h'`
288 find
include -type d \
( -name
"asm-*" -o
-name config \
) -prune
-o
-name
'*.h' -print | xargs etags
-a
289 find
$(SUBDIRS
) init
-name
'*.c' | xargs etags
-a
291 # Exuberant ctags works better with -I
293 CTAGSF
=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__initlocaldata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
294 ctags
$$CTAGSF `find include/asm-$(ARCH) -name '*.h'` && \
295 find
include -type d \
( -name
"asm-*" -o
-name config \
) -prune
-o
-name
'*.h' -print | xargs ctags
$$CTAGSF -a
&& \
296 find
$(SUBDIRS
) init
-name
'*.c' | xargs ctags
$$CTAGSF -a
299 ifdef CONFIG_MODVERSIONS
300 MODFLAGS
+= -DMODVERSIONS
-include $(HPATH
)/linux
/modversions.h
304 modules
: $(patsubst %, _mod_
%, $(SUBDIRS
))
306 .PHONY
: $(patsubst %, _mod_
%, $(SUBDIRS
))
307 $(patsubst %, _mod_
%, $(SUBDIRS
)) : include/linux
/version.h
include/config
/MARKER
308 $(MAKE
) -C
$(patsubst _mod_
%, %, $@
) CFLAGS
="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES
=1 modules
310 .PHONY
: modules_install
311 modules_install
: _modinst_
$(patsubst %, _modinst_
%, $(SUBDIRS
)) _modinst_post
315 @
rm -rf
$(MODLIB
)/kernel
316 @
rm -f
$(MODLIB
)/build
317 @mkdir
-p
$(MODLIB
)/kernel
318 @ln
-s
$(TOPDIR
) $(MODLIB
)/build
320 # If System.map exists, run depmod. This deliberately does not have a
321 # dependency on System.map since that would run the dependency tree on
322 # vmlinux. This depmod is only for convenience to give the initial
323 # boot a modules.dep even before / is mounted read-write. However the
324 # boot script depmod is the master version.
325 ifeq "$(strip $(INSTALL_MOD_PATH))" ""
328 depmod_opts
:= -b
$(INSTALL_MOD_PATH
) -r
330 .PHONY
: _modinst_post
331 _modinst_post
: _modinst_post_pcmcia
332 if
[ -r System.map
]; then
$(DEPMOD
) -ae
-F System.map
$(depmod_opts
) $(KERNELRELEASE
); fi
334 # Backwards compatibilty symlinks for people still using old versions
335 # of pcmcia-cs with hard coded pathnames on insmod. Remove
336 # _modinst_post_pcmcia for kernel 2.4.1.
337 .PHONY
: _modinst_post_pcmcia
338 _modinst_post_pcmcia
:
341 find kernel
-path
'*/pcmcia/*' -name
'*.o' | xargs
-i
-r ln
-sf ..
/{} pcmcia
343 .PHONY
: $(patsubst %, _modinst_
%, $(SUBDIRS
))
344 $(patsubst %, _modinst_
%, $(SUBDIRS
)) :
345 $(MAKE
) -C
$(patsubst _modinst_
%, %, $@
) modules_install
347 # modules disabled....
350 modules modules_install
: dummy
352 @echo
"The present kernel configuration has modules disabled."
353 @echo
"Type 'make config' and enable loadable module support."
354 @echo
"Then build a kernel with module support enabled."
360 rm -f kernel
/ksyms.lst
include/linux
/compile.h
361 find .
-name
'*.[oas]' -type f
-print | grep
-v lxdialog
/ | xargs
rm -f
362 rm -f core
`find . -type f -name 'core' -print`
363 rm -f core
`find . -type f -name '.*.flags' -print`
364 rm -f vmlinux System.map
366 rm -f drivers
/char
/consolemap_deftbl.c drivers
/video
/promcon_tbl.c
367 rm -f drivers
/char
/conmakehash
368 rm -f drivers
/pci
/devlist.h drivers
/pci
/classlist.h drivers
/pci
/gen-devlist
369 rm -f drivers
/sound
/bin2hex drivers
/sound
/hex2hex
370 rm -f drivers
/atm
/fore200e_mkfirm drivers
/atm
/{pca
,sba
}*{.bin
,.bin1
,.bin2
}
371 rm -f net
/khttpd
/make_times_h
372 rm -f net
/khttpd
/times.h
375 $(MAKE
) -C Documentation
/DocBook
clean
377 mrproper
: clean archmrproper
378 rm -f
include/linux
/autoconf.h
include/linux
/version.h
379 rm -f drivers
/net
/hamradio
/soundmodem
/sm_tbl_
{afsk1200
,afsk2666
,fsk9600
}.h
380 rm -f drivers
/net
/hamradio
/soundmodem
/sm_tbl_
{hapn4800
,psk4800
}.h
381 rm -f drivers
/net
/hamradio
/soundmodem
/sm_tbl_
{afsk2400_7
,afsk2400_8
}.h
382 rm -f drivers
/net
/hamradio
/soundmodem
/gentbl
383 rm -f drivers
/char
/hfmodem
/gentbl drivers
/char
/hfmodem
/tables.h
384 rm -f drivers
/sound
/*_boot.h drivers
/sound
/.
*.boot
385 rm -f drivers
/sound
/msndinit.c
386 rm -f drivers
/sound
/msndperm.c
387 rm -f drivers
/sound
/pndsperm.c
388 rm -f drivers
/sound
/pndspini.c
389 rm -f drivers
/atm
/fore200e_
*_fw.c drivers
/atm
/.fore200e_
*.fw
390 rm -f .version .config
* config.in config.old
391 rm -f scripts
/tkparse scripts
/kconfig.tk scripts
/kconfig.tmp
392 rm -f scripts
/lxdialog
/*.o scripts
/lxdialog
/lxdialog
393 rm -f .menuconfig.log
395 rm -rf
include/config
396 rm -f .depend
`find . -type f -name .depend -print`
397 rm -f core
`find . -type f -size 0 -print`
398 rm -f .hdepend scripts
/mkdep scripts
/split-include scripts
/docproc
399 rm -f
$(TOPDIR
)/include/linux
/modversions.h
400 rm -rf
$(TOPDIR
)/include/linux
/modules
401 $(MAKE
) -C Documentation
/DocBook mrproper
403 rm -f core
`find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
404 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
405 -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print` TAGS
tags
408 cd ..
&& tar cf
- linux
/ | gzip
-9 > backup.gz
412 chmod
755 $(TOPDIR
)/scripts
/docgen
413 chmod
755 $(TOPDIR
)/scripts
/gen-all-syms
414 chmod
755 $(TOPDIR
)/scripts
/kernel-doc
415 $(MAKE
) -C
$(TOPDIR
)/Documentation
/DocBook books
418 $(MAKE
) -C Documentation
/DocBook ps
421 $(MAKE
) -C Documentation
/DocBook pdf
424 $(MAKE
) -C Documentation
/DocBook html
427 find .
-type f
-print |
sort | xargs sum
> .SUMS
429 dep-files
: scripts
/mkdep archdep
include/linux
/version.h
430 scripts
/mkdep init
/*.c
> .depend
431 scripts
/mkdep
`find $(FINDHPATH) -name SCCS -prune -o -follow -name \*.h ! -name modversions.h -print` > .hdepend
432 $(MAKE
) $(patsubst %,_sfdep_
%,$(SUBDIRS
)) _FASTDEP_ALL_SUB_DIRS
="$(SUBDIRS)"
433 ifdef CONFIG_MODVERSIONS
434 $(MAKE
) update-modverfile
437 ifdef CONFIG_MODVERSIONS
438 MODVERFILE
:= $(TOPDIR
)/include/linux
/modversions.h
444 depend dep
: dep-files
446 # make checkconfig: Prune 'scripts' directory to avoid "false positives".
448 find
* -name
'*.[hcS]' -type f
-print | grep
-v scripts
/ |
sort | xargs
$(PERL
) -w scripts
/checkconfig.pl
451 find
* -name
[cC
]onfig.in
-print |
sort | xargs
$(PERL
) -w scripts
/checkhelp.pl
454 find
* -name
'*.[hcS]' -type f
-print |
sort | xargs
$(PERL
) -w scripts
/checkincludes.pl
459 @echo
"You have a bad or nonexistent" .
$(CONFIGURATION
) ": running 'make" $(CONFIGURATION
)"'"
461 $(MAKE
) $(CONFIGURATION
)
463 @echo
"Successful. Try re-making (ignore the error that follows)"
467 #dummy: ..$(CONFIGURATION)
479 # This generates dependencies for the .h files.
482 scripts
/mkdep
: scripts
/mkdep.c
483 $(HOSTCC
) $(HOSTCFLAGS
) -o scripts
/mkdep scripts
/mkdep.c
485 scripts
/split-include
: scripts
/split-include.c
486 $(HOSTCC
) $(HOSTCFLAGS
) -o scripts
/split-include scripts
/split-include.c