6 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
23 AS
=$(CROSS_COMPILE
)as
24 LD
=$(CROSS_COMPILE
)ld
25 CC
=$(CROSS_COMPILE
)gcc
-D__KERNEL__
-I
$(HPATH
)
27 AR
=$(CROSS_COMPILE
)ar
28 NM
=$(CROSS_COMPILE
)nm
29 STRIP
=$(CROSS_COMPILE
)strip
30 OBJDUMP
=$(CROSS_COMPILE
)objdump
32 GENKSYMS
=/sbin
/genksyms
37 # Make "config" the default target if there is no configuration file or
38 # "depend" the target if there is no top-level dependency information.
40 ifeq (.config
,$(wildcard .config
))
42 ifeq (.depend
,$(wildcard .depend
))
44 do-it-all
: Version vmlinux
46 CONFIGURATION
= depend
50 CONFIGURATION
= config
55 # ROOT_DEV specifies the default root-device when making the image.
56 # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
57 # the default of FLOPPY is used by 'build'.
62 KERNELRELEASE
=$(VERSION
).
$(PATCHLEVEL
).
$(SUBLEVEL
)$(EXTRAVERSION
)
65 # INSTALL_PATH specifies where to place the updated kernel and system map
66 # images. Uncomment if you want to place them anywhere other than root.
71 # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
72 # relocations required by build roots. This is not defined in the
73 # makefile but the arguement can be passed to make if needed.
77 # If you want to preset the SVGA mode, uncomment the next line and
78 # set SVGA_MODE to whatever number you want.
79 # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
80 # The number is the same as you would ordinarily press at bootup.
83 SVGA_MODE
= -DSVGA_MODE
=NORMAL_VGA
89 CFLAGS
= -Wall
-Wstrict-prototypes
-O2
-fomit-frame-pointer
91 # use '-fno-strict-aliasing', but only if the compiler can take it
92 CFLAGS
+= $(shell if
$(CC
) -fno-strict-aliasing
-S
-o
/dev
/null
-xc
/dev
/null
>/dev
/null
2>&1; then echo
"-fno-strict-aliasing"; fi
)
100 # if you want the RAM disk device, define this to be the
104 #RAMDISK = -DRAMDISK=512
106 # Include the make variables (CC, etc...)
109 CORE_FILES
=kernel
/kernel.o mm
/mm.o fs
/fs.o ipc
/ipc.o
110 FILESYSTEMS
=fs
/filesystems.a
111 NETWORKS
=net
/network.a
112 DRIVERS
=drivers
/block
/block.a \
113 drivers
/char
/char.a \
114 drivers
/parport
/parport.a
115 LIBS
=$(TOPDIR
)/lib
/lib.a
116 SUBDIRS
=kernel drivers mm fs net ipc lib
119 DRIVERS
:= $(DRIVERS
) drivers
/nubus
/nubus.a
122 ifeq ($(CONFIG_ISDN
),y
)
123 DRIVERS
:= $(DRIVERS
) drivers
/isdn
/isdn.a
126 DRIVERS
:= $(DRIVERS
) drivers
/net
/net.a
128 ifeq ($(CONFIG_SCSI
),y
)
129 DRIVERS
:= $(DRIVERS
) drivers
/scsi
/scsi.a
132 ifneq ($(CONFIG_CD_NO_IDESCSI
)$(CONFIG_BLK_DEV_IDECD
)$(CONFIG_BLK_DEV_SR
)$(CONFIG_PARIDE_PCD
),)
133 DRIVERS
:= $(DRIVERS
) drivers
/cdrom
/cdrom.a
136 ifeq ($(CONFIG_SOUND
),y
)
137 DRIVERS
:= $(DRIVERS
) drivers
/sound
/sound.a
141 DRIVERS
:= $(DRIVERS
) drivers
/pci
/pci.a
145 DRIVERS
:= $(DRIVERS
) drivers
/dio
/dio.a
149 DRIVERS
:= $(DRIVERS
) drivers
/sbus
/sbus.a
153 DRIVERS
:= $(DRIVERS
) drivers
/zorro
/zorro.a
156 ifeq ($(CONFIG_FC4
),y
)
157 DRIVERS
:= $(DRIVERS
) drivers
/fc4
/fc4.a
161 DRIVERS
:= $(DRIVERS
) drivers
/macintosh
/macintosh.a
165 DRIVERS
:= $(DRIVERS
) drivers
/pnp
/pnp.a
169 DRIVERS
:= $(DRIVERS
) drivers
/sgi
/sgi.a
173 DRIVERS
:= $(DRIVERS
) drivers
/video
/video.a
176 ifeq ($(CONFIG_PARIDE
),y
)
177 DRIVERS
:= $(DRIVERS
) drivers
/block
/paride
/paride.a
180 ifdef CONFIG_HAMRADIO
181 DRIVERS
:= $(DRIVERS
) drivers
/net
/hamradio
/hamradio.a
184 ifeq ($(CONFIG_TC
),y
)
185 DRIVERS
:= $(DRIVERS
) drivers
/tc
/tc.a
188 ifeq ($(CONFIG_USB
),y
)
189 DRIVERS
:= $(DRIVERS
) drivers
/usb
/usb.a
192 ifeq ($(CONFIG_I2O
),y
)
193 DRIVERS
:= $(DRIVERS
) drivers
/i2o
/i2o.a
196 ifeq ($(CONFIG_IRDA
),y
)
197 DRIVERS
:= $(DRIVERS
) drivers
/net
/irda
/irda_drivers.a
200 include arch
/$(ARCH
)/Makefile
203 $(CC
) -D__ASSEMBLY__
$(AFLAGS
) -traditional
-E
-o
$*.s
$<
205 $(CC
) -D__ASSEMBLY__
$(AFLAGS
) -traditional
-c
-o
$*.o
$<
208 @
rm -f
include/linux
/compile.h
211 @
$(MAKE
) -C arch
/$(ARCH
)/boot
213 vmlinux
: $(CONFIGURATION
) init
/main.o init
/version.o linuxsubdirs
214 $(LD
) $(LINKFLAGS
) $(HEAD
) init
/main.o init
/version.o \
223 $(NM
) vmlinux | grep
-v
'\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' |
sort > System.map
227 ( cd
include ; ln
-sf asm-
$(ARCH
) asm
)
228 @if
[ ! -d modules
]; then \
231 @if
[ ! -d
include/linux
/modules
]; then \
232 mkdir
include/linux
/modules
; \
236 $(CONFIG_SHELL
) scripts
/Configure
-d arch
/$(ARCH
)/config.in
239 $(MAKE
) -C scripts kconfig.tk
240 wish
-f scripts
/kconfig.tk
242 menuconfig
: include/linux
/version.h symlinks
243 $(MAKE
) -C scripts
/lxdialog
all
244 $(CONFIG_SHELL
) scripts
/Menuconfig arch
/$(ARCH
)/config.in
247 $(CONFIG_SHELL
) scripts
/Configure arch
/$(ARCH
)/config.in
249 include/config
/MARKER
: scripts
/split-include
include/linux
/autoconf.h
250 scripts
/split-include
include/linux
/autoconf.h
include/config
251 @ touch
include/config
/MARKER
253 linuxsubdirs
: $(patsubst %, _dir_
%, $(SUBDIRS
))
255 $(patsubst %, _dir_
%, $(SUBDIRS
)) : dummy
include/config
/MARKER
256 $(MAKE
) -C
$(patsubst _dir_
%, %, $@
)
258 $(TOPDIR
)/include/linux
/version.h
: include/linux
/version.h
259 $(TOPDIR
)/include/linux
/compile.h
: include/linux
/compile.h
262 @if
[ ! -f .version
]; then \
265 expr
0`cat .version` + 1 > .version
; \
268 include/linux
/compile.h
: $(CONFIGURATION
) include/linux
/version.h newversion
269 @echo
-n \
#define UTS_VERSION \"\#`cat .version` > .ver
270 @if
[ -n
"$(CONFIG_SMP)" ] ; then echo
-n
" SMP" >> .ver
; fi
271 @if
[ -f .name
]; then echo
-n \
-`cat .name` >> .ver
; fi
272 @echo
' '`date`'"' >> .ver
273 @echo \
#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
274 @echo \
#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
275 @echo \
#define LINUX_COMPILE_HOST \"`hostname`\" >> .ver
276 @if
[ -x
/bin
/dnsdomainname
]; then \
277 echo \
#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\"; \
278 elif
[ -x
/bin
/domainname
]; then \
279 echo \
#define LINUX_COMPILE_DOMAIN \"`domainname`\"; \
281 echo \
#define LINUX_COMPILE_DOMAIN ; \
283 @echo \
#define LINUX_COMPILER \"`$(CC) $(CFLAGS) -v 2>&1 | tail -1`\" >> .ver
286 include/linux
/version.h
: .
/Makefile
287 @echo \
#define UTS_RELEASE \"$(KERNELRELEASE)\" > .ver
288 @echo \
#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
289 @echo
'#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
292 init
/version.o
: init
/version.c
include/linux
/compile.h
include/config
/MARKER
293 $(CC
) $(CFLAGS
) -DUTS_MACHINE
='"$(ARCH)"' -c
-o init
/version.o init
/version.c
295 init
/main.o
: init
/main.c
include/config
/MARKER
296 $(CC
) $(CFLAGS
) $(PROFILING
) -c
-o
$*.o
$<
298 fs lib mm ipc kernel drivers net
: dummy
299 $(MAKE
) $(subst $@
, _dir_
$@
, $@
)
303 ifdef CONFIG_MODVERSIONS
304 MODFLAGS
+= -DMODVERSIONS
-include $(HPATH
)/linux
/modversions.h
307 modules
: $(patsubst %, _mod_
%, $(SUBDIRS
))
309 $(patsubst %, _mod_
%, $(SUBDIRS
)) : include/linux
/version.h
310 $(MAKE
) -C
$(patsubst _mod_
%, %, $@
) CFLAGS
="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES
=1 modules
314 MODLIB
=$(INSTALL_MOD_PATH
)/lib
/modules
/$(KERNELRELEASE
); \
317 inst_mod
() { These
="`cat $$1`"; MODULES
="$$MODULES $$These"; \
318 mkdir
-p
$$MODLIB/$$2; cp
$$These $$MODLIB/$$2; \
319 echo Installing modules under
$$MODLIB/$$2; \
323 if
[ -f BLOCK_MODULES
]; then inst_mod BLOCK_MODULES block
; fi
; \
324 if
[ -f NET_MODULES
]; then inst_mod NET_MODULES net
; fi
; \
325 if
[ -f IPV4_MODULES
]; then inst_mod IPV4_MODULES ipv4
; fi
; \
326 if
[ -f IPV6_MODULES
]; then inst_mod IPV6_MODULES ipv6
; fi
; \
327 if
[ -f SCSI_MODULES
]; then inst_mod SCSI_MODULES scsi
; fi
; \
328 if
[ -f FS_MODULES
]; then inst_mod FS_MODULES fs
; fi
; \
329 if
[ -f NLS_MODULES
]; then inst_mod NLS_MODULES fs
; fi
; \
330 if
[ -f CDROM_MODULES
]; then inst_mod CDROM_MODULES cdrom
; fi
; \
331 if
[ -f HAM_MODULES
]; then inst_mod HAM_MODULES net
; fi
; \
332 if
[ -f SOUND_MODULES
]; then inst_mod SOUND_MODULES sound
; fi
; \
333 if
[ -f VIDEO_MODULES
]; then inst_mod VIDEO_MODULES video
; fi
; \
334 if
[ -f FC4_MODULES
]; then inst_mod FC4_MODULES fc4
; fi
; \
335 if
[ -f IRDA_MODULES
]; then inst_mod IRDA_MODULES net
; fi
; \
337 ls
*.o
> $$MODLIB/.allmods
; \
338 echo
$$MODULES | tr
' ' '\n' |
sort | comm
-23 $$MODLIB/.allmods
- > $$MODLIB/.misc
; \
339 if
[ -s
$$MODLIB/.misc
]; then inst_mod
$$MODLIB/.misc misc
; fi
; \
340 rm -f
$$MODLIB/.misc
$$MODLIB/.allmods
; \
343 # modules disabled....
346 modules modules_install
: dummy
348 @echo
"The present kernel configuration has modules disabled."
349 @echo
"Type 'make config' and enable loadable module support."
350 @echo
"Then build a kernel with module support enabled."
356 rm -f kernel
/ksyms.lst
include/linux
/compile.h
357 rm -f core
`find . -name '*.[oas]' ! -regex '.*lxdialog/.*' -print`
358 rm -f core
`find . -type f -name 'core' -print`
359 rm -f core
`find . -name '.*.flags' -print`
360 rm -f vmlinux System.map
362 rm -f drivers
/char
/consolemap_deftbl.c drivers
/video
/promcon_tbl.c
363 rm -f drivers
/char
/conmakehash
364 rm -f drivers
/sound
/bin2hex drivers
/sound
/hex2hex
365 if
[ -d modules
]; then \
366 rm -f core
`find modules/ -type f -print`; \
370 mrproper
: clean archmrproper
371 rm -f
include/linux
/autoconf.h
include/linux
/version.h
372 rm -f drivers
/net
/hamradio
/soundmodem
/sm_tbl_
{afsk1200
,afsk2666
,fsk9600
}.h
373 rm -f drivers
/net
/hamradio
/soundmodem
/sm_tbl_
{hapn4800
,psk4800
}.h
374 rm -f drivers
/net
/hamradio
/soundmodem
/sm_tbl_
{afsk2400_7
,afsk2400_8
}.h
375 rm -f drivers
/net
/hamradio
/soundmodem
/gentbl
376 rm -f drivers
/char
/hfmodem
/gentbl drivers
/char
/hfmodem
/tables.h
377 rm -f drivers
/sound
/*_boot.h drivers
/sound
/.
*.boot
378 rm -f .version .config
* config.in config.old
379 rm -f scripts
/tkparse scripts
/kconfig.tk scripts
/kconfig.tmp
380 rm -f scripts
/lxdialog
/*.o scripts
/lxdialog
/lxdialog
381 rm -f .menuconfig.log
383 rm -rf
include/config
384 rm -f .depend
`find . -name .depend -print`
385 rm -f core
`find . -size 0 -print`
386 rm -f .hdepend scripts
/mkdep scripts
/split-include
387 rm -f
$(TOPDIR
)/include/linux
/modversions.h
388 rm -rf
$(TOPDIR
)/include/linux
/modules
392 rm -f core
`find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
393 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
394 -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print` TAGS
397 cd ..
&& tar cf
- linux
/ | gzip
-9 > backup.gz
401 find .
-type f
-print |
sort | xargs sum
> .SUMS
403 dep-files
: scripts
/mkdep archdep
include/linux
/version.h
404 scripts
/mkdep init
/*.c
> .depend
405 scripts
/mkdep
`find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print` > .hdepend
406 $(MAKE
) $(patsubst %,_sfdep_
%,$(SUBDIRS
)) _FASTDEP_ALL_SUB_DIRS
="$(SUBDIRS)"
410 ifdef CONFIG_MODVERSIONS
411 MODVERFILE
:= $(TOPDIR
)/include/linux
/modversions.h
414 depend dep
: dep-files
$(MODVERFILE
)
416 # make checkconfig: Prune 'scripts' directory to avoid "false positives".
418 perl
-w scripts
/checkconfig.pl
`find * -path 'scripts' -prune -o -name '*.[hcS]' -print | sort`
421 perl
-w scripts
/checkhelp.pl
`find * -name [cC]onfig.in -print`
426 @echo
"You have a bad or nonexistent" .
$(CONFIGURATION
) ": running 'make" $(CONFIGURATION
)"'"
428 $(MAKE
) $(CONFIGURATION
)
430 @echo
"Successful. Try re-making (ignore the error that follows)"
434 #dummy: ..$(CONFIGURATION)
446 # This generates dependencies for the .h files.
449 scripts
/mkdep
: scripts
/mkdep.c
450 $(HOSTCC
) $(HOSTCFLAGS
) -o scripts
/mkdep scripts
/mkdep.c
452 scripts
/split-include
: scripts
/split-include.c
453 $(HOSTCC
) $(HOSTCFLAGS
) -o scripts
/split-include scripts
/split-include.c