8 # For SMP kernels, set this. We don't want to have this in the config file
9 # because it makes re-config very ugly and too many fundamental files depend
12 # NOTE! SMP is experimental. See the file Documentation/SMP.txt
16 # SMP profiling options
19 .EXPORT_ALL_VARIABLES
:
21 CONFIG_SHELL
:= $(shell if
[ -x
"$$BASH" ]; then echo
$$BASH; \
22 else if
[ -x
/bin
/bash
]; then echo
/bin
/bash
; \
23 else echo sh
; fi
; fi
)
24 TOPDIR
:= $(shell if
[ "$$PWD" != "" ]; then echo
$$PWD; else pwd
; fi
)
26 HPATH
= $(TOPDIR
)/include
28 HOSTCC
=gcc
-I
$(HPATH
)
33 AS
=$(CROSS_COMPILE
)as
34 LD
=$(CROSS_COMPILE
)ld
35 CC
=$(CROSS_COMPILE
)gcc
-D__KERNEL__
-I
$(HPATH
)
37 AR
=$(CROSS_COMPILE
)ar
38 NM
=$(CROSS_COMPILE
)nm
39 STRIP
=$(CROSS_COMPILE
)strip
46 # Make "config" the default target if there is no configuration file or
47 # "depend" the target if there is no top-level dependency information.
49 ifeq (.config
,$(wildcard .config
))
51 ifeq (.depend
,$(wildcard .depend
))
53 do-it-all
: Version vmlinux
55 CONFIGURATION
= depend
59 CONFIGURATION
= config
64 # ROOT_DEV specifies the default root-device when making the image.
65 # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
66 # the default of FLOPPY is used by 'build'.
72 # INSTALL_PATH specifies where to place the updated kernel and system map
73 # images. Uncomment if you want to place them anywhere other than root.
78 # If you want to preset the SVGA mode, uncomment the next line and
79 # set SVGA_MODE to whatever number you want.
80 # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
81 # The number is the same as you would ordinarily press at bootup.
84 SVGA_MODE
= -DSVGA_MODE
=NORMAL_VGA
90 CFLAGS
= -Wall
-Wstrict-prototypes
-O2
-fomit-frame-pointer
-fno-strength-reduce
93 CFLAGS
:= $(CFLAGS
) -x c
++
101 CFLAGS
+= -D__SMP_PROF__
102 AFLAGS
+= -D__SMP_PROF__
107 # if you want the ram-disk device, define this to be the
111 #RAMDISK = -DRAMDISK=512
113 # Include the make variables (CC, etc...)
116 ARCHIVES
=kernel
/kernel.o mm
/mm.o fs
/fs.o ipc
/ipc.o net
/network.a
117 FILESYSTEMS
=fs
/filesystems.a
118 DRIVERS
=drivers
/block
/block.a \
120 LIBS
=$(TOPDIR
)/lib
/lib.a
121 SUBDIRS
=kernel drivers mm fs net ipc lib
123 ifeq ($(CONFIG_ISDN
),y
)
124 DRIVERS
:= $(DRIVERS
) drivers
/isdn
/isdn.a
127 DRIVERS
:= $(DRIVERS
) drivers
/net
/net.a
129 ifdef CONFIG_CD_NO_IDESCSI
130 DRIVERS
:= $(DRIVERS
) drivers
/cdrom
/cdrom.a
133 ifeq ($(CONFIG_SCSI
),y
)
134 DRIVERS
:= $(DRIVERS
) drivers
/scsi
/scsi.a
137 ifeq ($(CONFIG_SOUND
),y
)
138 DRIVERS
:= $(DRIVERS
) drivers
/sound
/sound.a
142 DRIVERS
:= $(DRIVERS
) drivers
/pci
/pci.a
146 DRIVERS
:= $(DRIVERS
) drivers
/sbus
/sbus.a
149 include arch
/$(ARCH
)/Makefile
154 $(CC
) -D__ASSEMBLY__
$(AFLAGS
) -traditional
-E
-o
$*.s
$<
156 $(CC
) -D__ASSEMBLY__
$(AFLAGS
) -traditional
-c
-o
$*.o
$<
161 $(CC
) -D__ASSEMBLY__
-traditional
-E
-o
$*.s
$<
163 $(CC
) -D__ASSEMBLY__
-traditional
-c
-o
$*.o
$<
168 @
rm -f
include/linux
/compile.h
171 @
$(MAKE
) -C arch
/$(ARCH
)/boot
173 vmlinux
: $(CONFIGURATION
) init
/main.o init
/version.o linuxsubdirs
174 $(LD
) $(LINKFLAGS
) $(HEAD
) init
/main.o init
/version.o \
179 $(NM
) vmlinux | grep
-v
'\(compiled\)\|\(\.o$$\)\|\( a \)' |
sort > System.map
183 ( cd
include ; ln
-sf asm-
$(ARCH
) asm
)
186 $(CONFIG_SHELL
) scripts
/Configure
-d arch
/$(ARCH
)/config.in
189 $(MAKE
) -C scripts kconfig.tk
190 wish
-f scripts
/kconfig.tk
192 menuconfig
: include/linux
/version.h symlinks
193 $(MAKE
) -C scripts
/lxdialog
all
194 $(CONFIG_SHELL
) scripts
/Menuconfig arch
/$(ARCH
)/config.in
197 $(CONFIG_SHELL
) scripts
/Configure arch
/$(ARCH
)/config.in
200 set
-e
; for i in
$(SUBDIRS
); do
$(MAKE
) -C
$$i; done
202 $(TOPDIR
)/include/linux
/version.h
: include/linux
/version.h
203 $(TOPDIR
)/include/linux
/compile.h
: include/linux
/compile.h
206 @if
[ ! -f .version
]; then \
209 expr
0`cat .version` + 1 > .version
; \
212 include/linux
/compile.h
: $(CONFIGURATION
) include/linux
/version.h newversion
213 @if
[ -f .name
]; then \
214 echo \
#define UTS_VERSION \"\#`cat .version`-`cat .name` `date`\"; \
216 echo \
#define UTS_VERSION \"\#`cat .version` `date`\"; \
218 @echo \
#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
219 @echo \
#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
220 @echo \
#define LINUX_COMPILE_HOST \"`hostname`\" >> .ver
221 @if
[ -x
/bin
/dnsdomainname
]; then \
222 echo \
#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\"; \
223 elif
[ -x
/bin
/domainname
]; then \
224 echo \
#define LINUX_COMPILE_DOMAIN \"`domainname`\"; \
226 echo \
#define LINUX_COMPILE_DOMAIN ; \
228 @echo \
#define LINUX_COMPILER \"`$(CC) -v 2>&1 | tail -1`\" >> .ver
231 include/linux
/version.h
: .
/Makefile
232 @echo \
#define UTS_RELEASE \"$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)\" > .ver
233 @echo \
#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
236 init
/version.o
: init
/version.c
include/linux
/compile.h
237 $(CC
) $(CFLAGS
) -DUTS_MACHINE
='"$(ARCH)"' -c
-o init
/version.o init
/version.c
239 init
/main.o
: init
/main.c
240 $(CC
) $(CFLAGS
) $(PROFILING
) -c
-o
$*.o
$<
243 $(MAKE
) linuxsubdirs SUBDIRS
=fs
246 $(MAKE
) linuxsubdirs SUBDIRS
=lib
249 $(MAKE
) linuxsubdirs SUBDIRS
=mm
252 $(MAKE
) linuxsubdirs SUBDIRS
=ipc
255 $(MAKE
) linuxsubdirs SUBDIRS
=kernel
258 $(MAKE
) linuxsubdirs SUBDIRS
=drivers
261 $(MAKE
) linuxsubdirs SUBDIRS
=net
265 ifdef CONFIG_MODVERSIONS
266 MODFLAGS
+= -DMODVERSIONS
-include $(HPATH
)/linux
/modversions.h
269 modules
: include/linux
/version.h
271 for i in
$(SUBDIRS
); \
272 do
$(MAKE
) -C
$$i CFLAGS
="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES
=1 modules
; \
277 MODLIB
=/lib
/modules
/$(VERSION
).
$(PATCHLEVEL
).
$(SUBLEVEL
); \
280 inst_mod
() { These
="`cat $$1`"; MODULES
="$$MODULES $$These"; \
281 mkdir
-p
$$MODLIB/$$2; cp
-p
$$These $$MODLIB/$$2; \
282 echo Installing modules under
$$MODLIB/$$2; \
285 if
[ -f BLOCK_MODULES
]; then inst_mod BLOCK_MODULES block
; fi
; \
286 if
[ -f NET_MODULES
]; then inst_mod NET_MODULES net
; fi
; \
287 if
[ -f IPV4_MODULES
]; then inst_mod IPV4_MODULES ipv4
; fi
; \
288 if
[ -f SCSI_MODULES
]; then inst_mod SCSI_MODULES scsi
; fi
; \
289 if
[ -f FS_MODULES
]; then inst_mod FS_MODULES fs
; fi
; \
290 if
[ -f CDROM_MODULES
]; then inst_mod CDROM_MODULES cdrom
; fi
; \
293 echo
$$MODULES | tr
' ' '\n' |
sort | comm
-23 .allmods
- > .misc
; \
294 if
[ -s .misc
]; then inst_mod .misc misc
; fi
; \
295 rm -f .misc .allmods
; \
298 # modules disabled....
301 modules modules_install
: dummy
303 @echo
"The present kernel configuration has modules disabled."
304 @echo
"Type 'make config' and enable loadable module support."
305 @echo
"Then build a kernel with module support enabled."
311 rm -f kernel
/ksyms.lst
include/linux
/compile.h
312 rm -f core
`find . -name '*.[oas]' ! -regex '.*lxdialog/.*' -print`
313 rm -f core
`find . -type f -name 'core' -print`
314 rm -f vmlinux System.map
315 rm -f .tmp
* drivers
/sound
/configure
320 rm -f
include/linux
/autoconf.h
include/linux
/version.h
321 rm -f drivers
/sound
/local.h drivers
/sound
/.defines
322 rm -f drivers
/scsi
/aic7xxx_asm drivers
/scsi
/aic7xxx_seq.h
323 rm -f drivers
/char
/uni_hash.tbl drivers
/char
/conmakehash
324 rm -f .version .config
* config.in config.old
325 rm -f scripts
/tkparse scripts
/kconfig.tk scripts
/kconfig.tmp
326 rm -f scripts
/lxdialog
/*.o scripts
/lxdialog
/lxdialog
327 rm -f .menuconfig .menuconfig.log
329 rm -f .depend
`find . -name .depend -print`
331 rm -f
$(TOPDIR
)/include/linux
/modversions.h
332 rm -f
$(TOPDIR
)/include/linux
/modules
/*
336 rm -f core
`find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
337 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
338 -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print` TAGS
341 cd ..
&& tar cf
- linux
/ | gzip
-9 > backup.gz
345 find .
-type f
-print |
sort | xargs sum
> .SUMS
347 dep-files
: archdep .hdepend
include/linux
/version.h
348 $(AWK
) -f scripts
/depend.awk init
/*.c
> .tmpdepend
349 set
-e
; for i in
$(SUBDIRS
); do
$(MAKE
) -C
$$i fastdep
; done
350 mv .tmpdepend .depend
354 ifdef CONFIG_MODVERSIONS
355 MODVERFILE
:= $(TOPDIR
)/include/linux
/modversions.h
358 depend dep
: dep-files
$(MODVERFILE
)
363 @echo
"You have a bad or nonexistent" .
$(CONFIGURATION
) ": running 'make" $(CONFIGURATION
)"'"
365 $(MAKE
) $(CONFIGURATION
)
367 @echo
"Successful. Try re-making (ignore the error that follows)"
371 #dummy: ..$(CONFIGURATION)
383 # This generates dependencies for the .h files.
388 $(AWK
) -f scripts
/depend.awk
`find $(HPATH) -name \*.h ! -name modversions.h -print` > .
$@