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
41 export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
42 CONFIG_SHELL TOPDIR HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
43 CPP AR NM STRIP OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS MODFLAGS PERL
48 # Make "config" the default target if there is no configuration file or
49 # "depend" the target if there is no top-level dependency information.
52 ifeq (.config
,$(wildcard .config
))
54 ifeq (.depend
,$(wildcard .depend
))
56 do-it-all
: Version vmlinux
58 CONFIGURATION
= depend
62 CONFIGURATION
= config
67 # INSTALL_PATH specifies where to place the updated kernel and system map
68 # images. Uncomment if you want to place them anywhere other than root.
71 #export INSTALL_PATH=/boot
74 # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
75 # relocations required by build roots. This is not defined in the
76 # makefile but the arguement can be passed to make if needed.
83 CPPFLAGS
:= -D__KERNEL__
-I
$(HPATH
)
85 CFLAGS
:= $(CPPFLAGS
) -Wall
-Wstrict-prototypes
-O2
-fomit-frame-pointer
86 AFLAGS
:= -D__ASSEMBLY__
$(CPPFLAGS
)
88 # use '-fno-strict-aliasing', but only if the compiler can take it
89 CFLAGS
+= $(shell if
$(CC
) -fno-strict-aliasing
-S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-fno-strict-aliasing"; fi
)
91 export CPPFLAGS CFLAGS AFLAGS
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.a
122 DRIVERS
=drivers
/block
/block.a \
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_DRM
) += drivers
/char
/drm
/drm.o
136 DRIVERS-
$(CONFIG_AGP
) += drivers
/char
/agp
/agp.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.a
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.a
143 DRIVERS-
$(CONFIG_ARCNET
) += drivers
/net
/arcnet
/arcnet.a
144 DRIVERS-
$(CONFIG_ATM
) += drivers
/atm
/atm.o
145 DRIVERS-
$(CONFIG_IDE
) += drivers
/ide
/ide.a
146 DRIVERS-
$(CONFIG_SCSI
) += drivers
/scsi
/scsi.a
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_PCMCIA
) += drivers
/pcmcia
/pcmcia.o
156 DRIVERS-
$(CONFIG_PCMCIA_NETCARD
) += drivers
/net
/pcmcia
/pcmcia_net.o
157 DRIVERS-
$(CONFIG_PCMCIA_CHRDEV
) += drivers
/char
/pcmcia
/pcmcia_char.o
158 DRIVERS-
$(CONFIG_DIO
) += drivers
/dio
/dio.a
159 DRIVERS-
$(CONFIG_SBUS
) += drivers
/sbus
/sbus.a
160 DRIVERS-
$(CONFIG_ZORRO
) += drivers
/zorro
/zorro.a
161 DRIVERS-
$(CONFIG_FC4
) += drivers
/fc4
/fc4.a
162 DRIVERS-
$(CONFIG_PPC
) += drivers
/macintosh
/macintosh.o
163 DRIVERS-
$(CONFIG_MAC
) += drivers
/macintosh
/macintosh.o
164 DRIVERS-
$(CONFIG_ISAPNP
) += drivers
/pnp
/pnp.o
165 DRIVERS-
$(CONFIG_SGI_IP22
) += drivers
/sgi
/sgi.a
166 DRIVERS-
$(CONFIG_VT
) += drivers
/video
/video.o
167 DRIVERS-
$(CONFIG_PARIDE
) += drivers
/block
/paride
/paride.a
168 DRIVERS-
$(CONFIG_HAMRADIO
) += drivers
/net
/hamradio
/hamradio.o
169 DRIVERS-
$(CONFIG_TC
) += drivers
/tc
/tc.a
170 DRIVERS-
$(CONFIG_USB
) += drivers
/usb
/usbdrv.o
171 DRIVERS-
$(CONFIG_I2O
) += drivers
/i2o
/i2o.a
172 DRIVERS-
$(CONFIG_IRDA
) += drivers
/net
/irda
/irda_drivers.a
173 DRIVERS-
$(CONFIG_I2C
) += drivers
/i2c
/i2c.a
174 DRIVERS-
$(CONFIG_PHONE
) += drivers
/telephony
/telephony.a
176 DRIVERS
+= $(DRIVERS-y
)
178 include arch
/$(ARCH
)/Makefile
180 export NETWORKS DRIVERS LIBS HEAD LDFLAGS LINKFLAGS MAKEBOOT ASFLAGS
183 $(CPP
) $(AFLAGS
) -traditional
-o
$*.s
$<
185 $(CC
) $(AFLAGS
) -traditional
-c
-o
$*.o
$<
188 @
rm -f
include/linux
/compile.h
191 @
$(MAKE
) -C arch
/$(ARCH
)/boot
193 vmlinux
: $(CONFIGURATION
) init
/main.o init
/version.o linuxsubdirs
194 $(LD
) $(LINKFLAGS
) $(HEAD
) init
/main.o init
/version.o \
202 $(NM
) vmlinux | grep
-v
'\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' |
sort > System.map
206 ( cd
include ; ln
-sf asm-
$(ARCH
) asm
)
207 @if
[ ! -d
include/linux
/modules
]; then \
208 mkdir
include/linux
/modules
; \
212 $(CONFIG_SHELL
) scripts
/Configure
-d arch
/$(ARCH
)/config.in
215 $(MAKE
) -C scripts kconfig.tk
216 wish
-f scripts
/kconfig.tk
218 menuconfig
: include/linux
/version.h symlinks
219 $(MAKE
) -C scripts
/lxdialog
all
220 $(CONFIG_SHELL
) scripts
/Menuconfig arch
/$(ARCH
)/config.in
223 $(CONFIG_SHELL
) scripts
/Configure arch
/$(ARCH
)/config.in
225 include/config
/MARKER
: scripts
/split-include
include/linux
/autoconf.h
226 scripts
/split-include
include/linux
/autoconf.h
include/config
227 @ touch
include/config
/MARKER
229 linuxsubdirs
: $(patsubst %, _dir_
%, $(SUBDIRS
))
231 $(patsubst %, _dir_
%, $(SUBDIRS
)) : dummy
include/config
/MARKER
232 $(MAKE
) -C
$(patsubst _dir_
%, %, $@
)
234 $(TOPDIR
)/include/linux
/version.h
: include/linux
/version.h
235 $(TOPDIR
)/include/linux
/compile.h
: include/linux
/compile.h
238 @if
[ ! -f .version
]; then \
241 expr
0`cat .version` + 1 > .version
; \
244 include/linux
/compile.h
: $(CONFIGURATION
) include/linux
/version.h newversion
245 @echo
-n \
#define UTS_VERSION \"\#`cat .version` > .ver
246 @if
[ -n
"$(CONFIG_SMP)" ] ; then echo
-n
" SMP" >> .ver
; fi
247 @if
[ -f .name
]; then echo
-n \
-`cat .name` >> .ver
; fi
248 @echo
' '`date`'"' >> .ver
249 @echo \
#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
250 @echo \
#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
251 @echo \
#define LINUX_COMPILE_HOST \"`hostname`\" >> .ver
252 @if
[ -x
/bin
/dnsdomainname
]; then \
253 echo \
#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\"; \
254 elif
[ -x
/bin
/domainname
]; then \
255 echo \
#define LINUX_COMPILE_DOMAIN \"`domainname`\"; \
257 echo \
#define LINUX_COMPILE_DOMAIN ; \
259 @echo \
#define LINUX_COMPILER \"`$(CC) $(CFLAGS) -v 2>&1 | tail -1`\" >> .ver
262 include/linux
/version.h
: .
/Makefile
263 @echo \
#define UTS_RELEASE \"$(KERNELRELEASE)\" > .ver
264 @echo \
#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
265 @echo
'#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
268 init
/version.o
: init
/version.c
include/linux
/compile.h
include/config
/MARKER
269 $(CC
) $(CFLAGS
) -DUTS_MACHINE
='"$(ARCH)"' -c
-o init
/version.o init
/version.c
271 init
/main.o
: init
/main.c
include/config
/MARKER
272 $(CC
) $(CFLAGS
) $(PROFILING
) -c
-o
$*.o
$<
274 fs lib mm ipc kernel drivers net
: dummy
275 $(MAKE
) $(subst $@
, _dir_
$@
, $@
)
278 etags
`find include/asm-$(ARCH) -name '*.h'`
279 find
include -type d \
( -name
"asm-*" -o
-name config \
) -prune
-o
-name
'*.h' -print | xargs etags
-a
280 find
$(SUBDIRS
) init
-name
'*.c' | xargs etags
-a
282 # Exuberant ctags works better with -I
284 CTAGSF
=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__initlocaldata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
285 ctags
$$CTAGSF `find include/asm-$(ARCH) -name '*.h'` && \
286 find
include -type d \
( -name
"asm-*" -o
-name config \
) -prune
-o
-name
'*.h' -print | xargs ctags
$$CTAGSF -a
&& \
287 find
$(SUBDIRS
) init
-name
'*.c' | xargs ctags
$$CTAGSF -a
290 ifdef CONFIG_MODVERSIONS
291 MODFLAGS
+= -DMODVERSIONS
-include $(HPATH
)/linux
/modversions.h
294 modules
: $(patsubst %, _mod_
%, $(SUBDIRS
))
300 $(patsubst %, _mod_
%, $(SUBDIRS
)) : include/linux
/version.h
include/config
/MARKER modules
/MARKER
301 $(MAKE
) -C
$(patsubst _mod_
%, %, $@
) CFLAGS
="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES
=1 modules
305 MODLIB
=$(INSTALL_MOD_PATH
)/lib
/modules
/$(KERNELRELEASE
); \
308 inst_mod
() { These
="`cat $$1`"; MODULES
="$$MODULES $$These"; \
309 mkdir
-p
$$MODLIB/$$2; cp
$$These $$MODLIB/$$2; \
310 echo Installing modules under
$$MODLIB/$$2; \
314 if
[ -f BLOCK_MODULES
]; then inst_mod BLOCK_MODULES block
; fi
; \
315 if
[ -f NET_MODULES
]; then inst_mod NET_MODULES net
; fi
; \
316 if
[ -f IPV4_MODULES
]; then inst_mod IPV4_MODULES ipv4
; fi
; \
317 if
[ -f IPV6_MODULES
]; then inst_mod IPV6_MODULES ipv6
; fi
; \
318 if
[ -f ATM_MODULES
]; then inst_mod ATM_MODULES atm
; fi
; \
319 if
[ -f IDE_MODULES
]; then inst_mod IDE_MODULES ide
; fi
; \
320 if
[ -f SCSI_MODULES
]; then inst_mod SCSI_MODULES scsi
; fi
; \
321 if
[ -f FS_MODULES
]; then inst_mod FS_MODULES fs
; fi
; \
322 if
[ -f NLS_MODULES
]; then inst_mod NLS_MODULES fs
; fi
; \
323 if
[ -f CDROM_MODULES
]; then inst_mod CDROM_MODULES cdrom
; fi
; \
324 if
[ -f HAM_MODULES
]; then inst_mod HAM_MODULES net
; fi
; \
325 if
[ -f SOUND_MODULES
]; then inst_mod SOUND_MODULES sound
; fi
; \
326 if
[ -f VIDEO_MODULES
]; then inst_mod VIDEO_MODULES video
; fi
; \
327 if
[ -f FC4_MODULES
]; then inst_mod FC4_MODULES fc4
; fi
; \
328 if
[ -f IRDA_MODULES
]; then inst_mod IRDA_MODULES net
; fi
; \
329 if
[ -f SK98LIN_MODULES
]; then inst_mod SK98LIN_MODULES net
; fi
; \
330 if
[ -f SKFP_MODULES
]; then inst_mod SKFP_MODULES net
; fi
; \
331 if
[ -f USB_MODULES
]; then inst_mod USB_MODULES usb
; fi
; \
332 if
[ -f USB_SERIAL_MODULES
]; then inst_mod USB_SERIAL_MODULES usb
; fi
; \
333 if
[ -f IEEE1394_MODULES
]; then inst_mod IEEE1394_MODULES ieee1394
; fi
; \
334 if
[ -f PCMCIA_MODULES
]; then inst_mod PCMCIA_MODULES pcmcia
; fi
; \
335 if
[ -f PCMCIA_NET_MODULES
]; then inst_mod PCMCIA_NET_MODULES pcmcia
; fi
; \
336 if
[ -f PCMCIA_CHAR_MODULES
]; then inst_mod PCMCIA_CHAR_MODULES pcmcia
; fi
; \
337 if
[ -f PCMCIA_SCSI_MODULES
]; then inst_mod PCMCIA_SCSI_MODULES pcmcia
; fi
; \
339 ls
-1 -U
*.o |
sort > $$MODLIB/.allmods
; \
340 if
[ -f
$$MODLIB/net
/3c59x.o
]; then \
341 mkdir
-p
$$MODLIB/pcmcia
; \
342 ln
-nfs ..
/net
/3c59x.o
$$MODLIB/pcmcia
/3c575_cb.o
; \
343 MODULES
="$$MODULES 3c575_cb.o"; fi
; \
344 echo
$$MODULES | tr
' ' '\n' |
sort | comm
-23 $$MODLIB/.allmods
- > $$MODLIB/.misc
; \
345 if
[ -s
$$MODLIB/.misc
]; then inst_mod
$$MODLIB/.misc misc
; fi
; \
346 rm -f
$$MODLIB/.misc
$$MODLIB/.allmods
; \
349 # modules disabled....
352 modules modules_install
: dummy
354 @echo
"The present kernel configuration has modules disabled."
355 @echo
"Type 'make config' and enable loadable module support."
356 @echo
"Then build a kernel with module support enabled."
362 rm -f kernel
/ksyms.lst
include/linux
/compile.h
363 find .
-name
'*.[oas]' -type f
-print | grep
-v lxdialog
/ | xargs
rm -f
364 rm -f core
`find . -type f -name 'core' -print`
365 rm -f core
`find . -type f -name '.*.flags' -print`
366 rm -f vmlinux System.map
368 rm -f drivers
/char
/consolemap_deftbl.c drivers
/video
/promcon_tbl.c
369 rm -f drivers
/char
/conmakehash
370 rm -f drivers
/pci
/devlist.h drivers
/pci
/classlist.h drivers
/pci
/gen-devlist
371 rm -f drivers
/sound
/bin2hex drivers
/sound
/hex2hex
372 rm -f drivers
/atm
/fore200e_mkfirm drivers
/atm
/{pca
,sba
}*{.bin
,.bin1
,.bin2
}
373 rm -f net
/khttpd
/make_times_h
374 rm -f net
/khttpd
/times.h
377 $(MAKE
) -C Documentation
/DocBook
clean
379 mrproper
: clean archmrproper
380 rm -f
include/linux
/autoconf.h
include/linux
/version.h
381 rm -f drivers
/net
/hamradio
/soundmodem
/sm_tbl_
{afsk1200
,afsk2666
,fsk9600
}.h
382 rm -f drivers
/net
/hamradio
/soundmodem
/sm_tbl_
{hapn4800
,psk4800
}.h
383 rm -f drivers
/net
/hamradio
/soundmodem
/sm_tbl_
{afsk2400_7
,afsk2400_8
}.h
384 rm -f drivers
/net
/hamradio
/soundmodem
/gentbl
385 rm -f drivers
/char
/hfmodem
/gentbl drivers
/char
/hfmodem
/tables.h
386 rm -f drivers
/sound
/*_boot.h drivers
/sound
/.
*.boot
387 rm -f drivers
/sound
/msndinit.c
388 rm -f drivers
/sound
/msndperm.c
389 rm -f drivers
/sound
/pndsperm.c
390 rm -f drivers
/sound
/pndspini.c
391 rm -f drivers
/atm
/fore200e_
*_fw.c drivers
/atm
/.fore200e_
*.fw
392 rm -f .version .config
* config.in config.old
393 rm -f scripts
/tkparse scripts
/kconfig.tk scripts
/kconfig.tmp
394 rm -f scripts
/lxdialog
/*.o scripts
/lxdialog
/lxdialog
395 rm -f .menuconfig.log
397 rm -rf
include/config
398 rm -f .depend
`find . -type f -name .depend -print`
399 rm -f core
`find . -type f -size 0 -print`
400 rm -f .hdepend scripts
/mkdep scripts
/split-include scripts
/docproc
401 rm -f
$(TOPDIR
)/include/linux
/modversions.h
402 rm -rf
$(TOPDIR
)/include/linux
/modules
403 $(MAKE
) -C Documentation
/DocBook mrproper
405 rm -f core
`find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
406 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
407 -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print` TAGS
tags
410 cd ..
&& tar cf
- linux
/ | gzip
-9 > backup.gz
414 chmod
755 $(TOPDIR
)/scripts
/docgen
415 chmod
755 $(TOPDIR
)/scripts
/gen-all-syms
416 chmod
755 $(TOPDIR
)/scripts
/kernel-doc
417 $(MAKE
) -C
$(TOPDIR
)/Documentation
/DocBook books
420 $(MAKE
) -C Documentation
/DocBook ps
423 $(MAKE
) -C Documentation
/DocBook pdf
426 find .
-type f
-print |
sort | xargs sum
> .SUMS
428 dep-files
: scripts
/mkdep archdep
include/linux
/version.h
429 scripts
/mkdep init
/*.c
> .depend
430 scripts
/mkdep
`find $(FINDHPATH) -name SCCS -prune -or -follow -name \*.h ! -name modversions.h -print` > .hdepend
431 $(MAKE
) $(patsubst %,_sfdep_
%,$(SUBDIRS
)) _FASTDEP_ALL_SUB_DIRS
="$(SUBDIRS)"
433 ifdef CONFIG_MODVERSIONS
434 MODVERFILE
:= $(TOPDIR
)/include/linux
/modversions.h
440 depend dep
: dep-files
$(MODVERFILE
)
442 # make checkconfig: Prune 'scripts' directory to avoid "false positives".
444 find
* -name
'*.[hcS]' -type f
-print | grep
-v scripts
/ |
sort | xargs
$(PERL
) -w scripts
/checkconfig.pl
447 find
* -name
[cC
]onfig.in
-print |
sort | xargs
$(PERL
) -w scripts
/checkhelp.pl
450 find
* -name
'*.[hcS]' -type f
-print |
sort | xargs
$(PERL
) -w scripts
/checkincludes.pl
455 @echo
"You have a bad or nonexistent" .
$(CONFIGURATION
) ": running 'make" $(CONFIGURATION
)"'"
457 $(MAKE
) $(CONFIGURATION
)
459 @echo
"Successful. Try re-making (ignore the error that follows)"
463 #dummy: ..$(CONFIGURATION)
475 # This generates dependencies for the .h files.
478 scripts
/mkdep
: scripts
/mkdep.c
479 $(HOSTCC
) $(HOSTCFLAGS
) -o scripts
/mkdep scripts
/mkdep.c
481 scripts
/split-include
: scripts
/split-include.c
482 $(HOSTCC
) $(HOSTCFLAGS
) -o scripts
/split-include scripts
/split-include.c