Import 2.3.51pre3
[davej-history.git] / Makefile
bloba37d67ff51f38d5cc25edad79982c32e8b98dc62
1 VERSION = 2
2 PATCHLEVEL = 3
3 SUBLEVEL = 51
4 EXTRAVERSION =
6 ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
8 .EXPORT_ALL_VARIABLES:
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
18 HOSTCC =gcc
19 HOSTCFLAGS =-Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
21 CROSS_COMPILE =
23 AS =$(CROSS_COMPILE)as
24 LD =$(CROSS_COMPILE)ld
25 CC =$(CROSS_COMPILE)gcc
26 CPP =$(CC) -E
27 AR =$(CROSS_COMPILE)ar
28 NM =$(CROSS_COMPILE)nm
29 STRIP =$(CROSS_COMPILE)strip
30 OBJCOPY =$(CROSS_COMPILE)objcopy
31 OBJDUMP =$(CROSS_COMPILE)objdump
32 MAKE =make
33 GENKSYMS=/sbin/genksyms
35 all: do-it-all
38 # Make "config" the default target if there is no configuration file or
39 # "depend" the target if there is no top-level dependency information.
41 ifeq (.config,$(wildcard .config))
42 include .config
43 ifeq (.depend,$(wildcard .depend))
44 include .depend
45 do-it-all: Version vmlinux
46 else
47 CONFIGURATION = depend
48 do-it-all: depend
49 endif
50 else
51 CONFIGURATION = config
52 do-it-all: config
53 endif
56 # ROOT_DEV specifies the default root-device when making the image.
57 # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
58 # the default of FLOPPY is used by 'build'.
61 ROOT_DEV = CURRENT
63 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
66 # INSTALL_PATH specifies where to place the updated kernel and system map
67 # images. Uncomment if you want to place them anywhere other than root.
69 #INSTALL_PATH=/boot
72 # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
73 # relocations required by build roots. This is not defined in the
74 # makefile but the arguement can be passed to make if needed.
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
87 # standard CFLAGS
90 CPPFLAGS := -D__KERNEL__ -I$(HPATH)
92 ifdef CONFIG_SMP
93 CPPFLAGS += -D__SMP__
94 endif
96 CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
97 AFLAGS := $(CPPFLAGS)
100 # if you want the RAM disk device, define this to be the
101 # size in blocks.
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 NETWORKS =net/network.a
111 DRIVERS =drivers/block/block.a \
112 drivers/char/char.o \
113 drivers/misc/misc.o \
114 drivers/net/net.o \
115 drivers/parport/parport.a
116 LIBS =$(TOPDIR)/lib/lib.a
117 SUBDIRS =kernel drivers mm fs net ipc lib
119 ifdef CONFIG_DRM
120 DRIVERS += drivers/char/drm/drm.o
121 endif
123 ifeq ($(CONFIG_AGP),y)
124 DRIVERS += drivers/char/agp/agp.o
125 endif
127 ifdef CONFIG_NUBUS
128 DRIVERS := $(DRIVERS) drivers/nubus/nubus.a
129 endif
131 ifeq ($(CONFIG_ISDN),y)
132 DRIVERS := $(DRIVERS) drivers/isdn/isdn.a
133 endif
135 ifdef CONFIG_NET_FC
136 DRIVERS := $(DRIVERS) drivers/net/fc/fc.a
137 endif
139 ifdef CONFIG_TR
140 DRIVERS := $(DRIVERS) drivers/net/tokenring/tr.a
141 endif
143 ifdef CONFIG_WAN
144 DRIVERS := $(DRIVERS) drivers/net/wan/wan.a
145 endif
147 ifeq ($(CONFIG_ARCNET),y)
148 DRIVERS := $(DRIVERS) drivers/net/arcnet/arcnet.a
149 endif
151 ifdef CONFIG_ATM
152 DRIVERS := $(DRIVERS) drivers/atm/atm.a
153 endif
155 ifeq ($(CONFIG_SCSI),y)
156 DRIVERS := $(DRIVERS) drivers/scsi/scsi.a
157 endif
159 ifeq ($(CONFIG_IEEE1394),y)
160 DRIVERS := $(DRIVERS) drivers/ieee1394/ieee1394.a
161 endif
163 ifneq ($(CONFIG_CD_NO_IDESCSI)$(CONFIG_BLK_DEV_IDECD)$(CONFIG_BLK_DEV_SR)$(CONFIG_PARIDE_PCD),)
164 DRIVERS := $(DRIVERS) drivers/cdrom/cdrom.a
165 endif
167 ifeq ($(CONFIG_SOUND),y)
168 DRIVERS := $(DRIVERS) drivers/sound/sounddrivers.o
169 endif
171 ifdef CONFIG_PCI
172 DRIVERS := $(DRIVERS) drivers/pci/pci.a
173 endif
175 ifeq ($(CONFIG_PCMCIA),y)
176 DRIVERS := $(DRIVERS) drivers/pcmcia/pcmcia.o
177 endif
179 ifeq ($(CONFIG_PCMCIA_NETCARD),y)
180 DRIVERS := $(DRIVERS) drivers/net/pcmcia/pcmcia_net.o
181 endif
183 ifeq ($(CONFIG_PCMCIA_CHRDEV),y)
184 DRIVERS := $(DRIVERS) drivers/char/pcmcia/pcmcia_char.o
185 endif
187 ifdef CONFIG_DIO
188 DRIVERS := $(DRIVERS) drivers/dio/dio.a
189 endif
191 ifdef CONFIG_SBUS
192 DRIVERS := $(DRIVERS) drivers/sbus/sbus.a
193 endif
195 ifdef CONFIG_ZORRO
196 DRIVERS := $(DRIVERS) drivers/zorro/zorro.a
197 endif
199 ifeq ($(CONFIG_FC4),y)
200 DRIVERS := $(DRIVERS) drivers/fc4/fc4.a
201 endif
203 ifdef CONFIG_PPC
204 DRIVERS := $(DRIVERS) drivers/macintosh/macintosh.a
205 endif
207 ifdef CONFIG_MAC
208 DRIVERS := $(DRIVERS) drivers/macintosh/macintosh.a
209 endif
211 ifeq ($(CONFIG_ISAPNP),y)
212 DRIVERS := $(DRIVERS) drivers/pnp/pnp.o
213 endif
215 ifdef CONFIG_SGI_IP22
216 DRIVERS := $(DRIVERS) drivers/sgi/sgi.a
217 endif
219 ifdef CONFIG_VT
220 DRIVERS := $(DRIVERS) drivers/video/video.o
221 endif
223 ifeq ($(CONFIG_PARIDE),y)
224 DRIVERS := $(DRIVERS) drivers/block/paride/paride.a
225 endif
227 ifdef CONFIG_HAMRADIO
228 DRIVERS := $(DRIVERS) drivers/net/hamradio/hamradio.o
229 endif
231 ifeq ($(CONFIG_TC),y)
232 DRIVERS := $(DRIVERS) drivers/tc/tc.a
233 endif
235 ifeq ($(CONFIG_USB),y)
236 DRIVERS := $(DRIVERS) drivers/usb/usbdrv.o
237 endif
239 ifeq ($(CONFIG_I2O),y)
240 DRIVERS := $(DRIVERS) drivers/i2o/i2o.a
241 endif
243 ifeq ($(CONFIG_IRDA),y)
244 DRIVERS := $(DRIVERS) drivers/net/irda/irda_drivers.a
245 endif
247 ifeq ($(CONFIG_I2C),y)
248 DRIVERS := $(DRIVERS) drivers/i2c/i2c.a
249 endif
251 ifeq ($(CONFIG_PHONE),y)
252 DRIVERS := $(DRIVERS) drivers/telephony/telephony.a
253 endif
255 include arch/$(ARCH)/Makefile
257 # use '-fno-strict-aliasing', but only if the compiler can take it
258 CFLAGS += $(shell if $(CC) -fno-strict-aliasing -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-fno-strict-aliasing"; fi)
260 .S.s:
261 $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -E -o $*.s $<
262 .S.o:
263 $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c -o $*.o $<
265 Version: dummy
266 @rm -f include/linux/compile.h
268 boot: vmlinux
269 @$(MAKE) -C arch/$(ARCH)/boot
271 vmlinux: $(CONFIGURATION) init/main.o init/version.o linuxsubdirs
272 $(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o \
273 --start-group \
274 $(CORE_FILES) \
275 $(DRIVERS) \
276 $(NETWORKS) \
277 $(LIBS) \
278 --end-group \
279 -o vmlinux
280 $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
282 symlinks:
283 rm -f include/asm
284 ( cd include ; ln -sf asm-$(ARCH) asm)
285 @if [ ! -d include/linux/modules ]; then \
286 mkdir include/linux/modules; \
289 oldconfig: symlinks
290 $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
292 xconfig: symlinks
293 $(MAKE) -C scripts kconfig.tk
294 wish -f scripts/kconfig.tk
296 menuconfig: include/linux/version.h symlinks
297 $(MAKE) -C scripts/lxdialog all
298 $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
300 config: symlinks
301 $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
303 include/config/MARKER: scripts/split-include include/linux/autoconf.h
304 scripts/split-include include/linux/autoconf.h include/config
305 @ touch include/config/MARKER
307 linuxsubdirs: $(patsubst %, _dir_%, $(SUBDIRS))
309 $(patsubst %, _dir_%, $(SUBDIRS)) : dummy include/config/MARKER
310 $(MAKE) -C $(patsubst _dir_%, %, $@)
312 $(TOPDIR)/include/linux/version.h: include/linux/version.h
313 $(TOPDIR)/include/linux/compile.h: include/linux/compile.h
315 newversion:
316 @if [ ! -f .version ]; then \
317 echo 1 > .version; \
318 else \
319 expr 0`cat .version` + 1 > .version; \
322 include/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion
323 @echo -n \#define UTS_VERSION \"\#`cat .version` > .ver
324 @if [ -n "$(CONFIG_SMP)" ] ; then echo -n " SMP" >> .ver; fi
325 @if [ -f .name ]; then echo -n \-`cat .name` >> .ver; fi
326 @echo ' '`date`'"' >> .ver
327 @echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
328 @echo \#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
329 @echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> .ver
330 @if [ -x /bin/dnsdomainname ]; then \
331 echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\"; \
332 elif [ -x /bin/domainname ]; then \
333 echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\"; \
334 else \
335 echo \#define LINUX_COMPILE_DOMAIN ; \
336 fi >> .ver
337 @echo \#define LINUX_COMPILER \"`$(CC) $(CFLAGS) -v 2>&1 | tail -1`\" >> .ver
338 @mv -f .ver $@
340 include/linux/version.h: ./Makefile
341 @echo \#define UTS_RELEASE \"$(KERNELRELEASE)\" > .ver
342 @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
343 @echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
344 @mv -f .ver $@
346 init/version.o: init/version.c include/linux/compile.h include/config/MARKER
347 $(CC) $(CFLAGS) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c
349 init/main.o: init/main.c include/config/MARKER
350 $(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<
352 fs lib mm ipc kernel drivers net: dummy
353 $(MAKE) $(subst $@, _dir_$@, $@)
355 TAGS: dummy
356 etags `find include/asm-$(ARCH) -name '*.h'`
357 find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print | xargs etags -a
358 find $(SUBDIRS) init -name '*.c' | xargs etags -a
360 # Exuberant ctags works better with -I
361 tags: dummy
362 CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__initlocaldata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
363 ctags $$CTAGSF `find include/asm-$(ARCH) -name '*.h'` && \
364 find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print | xargs ctags $$CTAGSF -a && \
365 find $(SUBDIRS) init -name '*.c' | xargs ctags $$CTAGSF -a
367 MODFLAGS += -DMODULE
368 ifdef CONFIG_MODULES
369 ifdef CONFIG_MODVERSIONS
370 MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
371 endif
373 modules: $(patsubst %, _mod_%, $(SUBDIRS))
375 modules/MARKER:
376 mkdir -p modules
377 touch modules/MARKER
379 $(patsubst %, _mod_%, $(SUBDIRS)) : include/linux/version.h include/config/MARKER modules/MARKER
380 $(MAKE) -C $(patsubst _mod_%, %, $@) CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules
382 modules_install:
383 @( \
384 MODLIB=$(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE); \
385 cd modules; \
386 MODULES=""; \
387 inst_mod() { These="`cat $$1`"; MODULES="$$MODULES $$These"; \
388 mkdir -p $$MODLIB/$$2; cp $$These $$MODLIB/$$2; \
389 echo Installing modules under $$MODLIB/$$2; \
390 }; \
391 mkdir -p $$MODLIB; \
393 if [ -f BLOCK_MODULES ]; then inst_mod BLOCK_MODULES block; fi; \
394 if [ -f NET_MODULES ]; then inst_mod NET_MODULES net; fi; \
395 if [ -f IPV4_MODULES ]; then inst_mod IPV4_MODULES ipv4; fi; \
396 if [ -f IPV6_MODULES ]; then inst_mod IPV6_MODULES ipv6; fi; \
397 if [ -f ATM_MODULES ]; then inst_mod ATM_MODULES atm; fi; \
398 if [ -f SCSI_MODULES ]; then inst_mod SCSI_MODULES scsi; fi; \
399 if [ -f FS_MODULES ]; then inst_mod FS_MODULES fs; fi; \
400 if [ -f NLS_MODULES ]; then inst_mod NLS_MODULES fs; fi; \
401 if [ -f CDROM_MODULES ]; then inst_mod CDROM_MODULES cdrom; fi; \
402 if [ -f HAM_MODULES ]; then inst_mod HAM_MODULES net; fi; \
403 if [ -f SOUND_MODULES ]; then inst_mod SOUND_MODULES sound; fi; \
404 if [ -f VIDEO_MODULES ]; then inst_mod VIDEO_MODULES video; fi; \
405 if [ -f FC4_MODULES ]; then inst_mod FC4_MODULES fc4; fi; \
406 if [ -f IRDA_MODULES ]; then inst_mod IRDA_MODULES net; fi; \
407 if [ -f SK98LIN_MODULES ]; then inst_mod SK98LIN_MODULES net; fi; \
408 if [ -f SKFP_MODULES ]; then inst_mod SKFP_MODULES net; fi; \
409 if [ -f USB_MODULES ]; then inst_mod USB_MODULES usb; fi; \
410 if [ -f IEEE1394_MODULES ]; then inst_mod IEEE1394_MODULES ieee1394; fi; \
411 if [ -f PCMCIA_MODULES ]; then inst_mod PCMCIA_MODULES pcmcia; fi; \
412 if [ -f PCMCIA_NET_MODULES ]; then inst_mod PCMCIA_NET_MODULES pcmcia; fi; \
413 if [ -f PCMCIA_CHAR_MODULES ]; then inst_mod PCMCIA_CHAR_MODULES pcmcia; fi; \
414 if [ -f PCMCIA_SCSI_MODULES ]; then inst_mod PCMCIA_SCSI_MODULES pcmcia; fi; \
416 ls -1 -U *.o | sort > $$MODLIB/.allmods; \
417 echo $$MODULES | tr ' ' '\n' | sort | comm -23 $$MODLIB/.allmods - > $$MODLIB/.misc; \
418 if [ -s $$MODLIB/.misc ]; then inst_mod $$MODLIB/.misc misc; fi; \
419 rm -f $$MODLIB/.misc $$MODLIB/.allmods; \
422 # modules disabled....
424 else
425 modules modules_install: dummy
426 @echo
427 @echo "The present kernel configuration has modules disabled."
428 @echo "Type 'make config' and enable loadable module support."
429 @echo "Then build a kernel with module support enabled."
430 @echo
431 @exit 1
432 endif
434 clean: archclean
435 rm -f kernel/ksyms.lst include/linux/compile.h
436 find . -name '*.[oas]' -type f -print | grep -v lxdialog/ | xargs rm -f
437 rm -f core `find . -type f -name 'core' -print`
438 rm -f core `find . -type f -name '.*.flags' -print`
439 rm -f vmlinux System.map
440 rm -f .tmp*
441 rm -f drivers/char/consolemap_deftbl.c drivers/video/promcon_tbl.c
442 rm -f drivers/char/conmakehash
443 rm -f drivers/pci/devlist.h drivers/pci/classlist.h drivers/pci/gen-devlist
444 rm -f drivers/sound/bin2hex drivers/sound/hex2hex
445 rm -f net/khttpd/make_times_h
446 rm -f net/khttpd/times.h
447 rm -f submenu*
448 rm -rf modules
450 mrproper: clean archmrproper
451 rm -f include/linux/autoconf.h include/linux/version.h
452 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk1200,afsk2666,fsk9600}.h
453 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{hapn4800,psk4800}.h
454 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk2400_7,afsk2400_8}.h
455 rm -f drivers/net/hamradio/soundmodem/gentbl
456 rm -f drivers/char/hfmodem/gentbl drivers/char/hfmodem/tables.h
457 rm -f drivers/sound/*_boot.h drivers/sound/.*.boot
458 rm -f drivers/sound/msndinit.c
459 rm -f drivers/sound/msndperm.c
460 rm -f drivers/sound/pndsperm.c
461 rm -f drivers/sound/pndspini.c
462 rm -f .version .config* config.in config.old
463 rm -f scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp
464 rm -f scripts/lxdialog/*.o scripts/lxdialog/lxdialog
465 rm -f .menuconfig.log
466 rm -f include/asm
467 rm -rf include/config
468 rm -f .depend `find . -type f -name .depend -print`
469 rm -f core `find . -type f -size 0 -print`
470 rm -f .hdepend scripts/mkdep scripts/split-include
471 rm -f $(TOPDIR)/include/linux/modversions.h
472 rm -rf $(TOPDIR)/include/linux/modules
474 distclean: mrproper
475 rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
476 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
477 -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print` TAGS tags
479 backup: mrproper
480 cd .. && tar cf - linux/ | gzip -9 > backup.gz
481 sync
483 sums:
484 find . -type f -print | sort | xargs sum > .SUMS
486 dep-files: scripts/mkdep archdep include/linux/version.h
487 scripts/mkdep init/*.c > .depend
488 scripts/mkdep `find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print` > .hdepend
489 $(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) _FASTDEP_ALL_SUB_DIRS="$(SUBDIRS)"
491 MODVERFILE :=
493 ifdef CONFIG_MODVERSIONS
494 MODVERFILE := $(TOPDIR)/include/linux/modversions.h
495 endif
497 depend dep: dep-files $(MODVERFILE)
499 # make checkconfig: Prune 'scripts' directory to avoid "false positives".
500 checkconfig:
501 find * -name '*.[hcS]' -type f -print | grep -v scripts/ | sort | xargs perl -w scripts/checkconfig.pl
503 checkhelp:
504 perl -w scripts/checkhelp.pl `find * -name [cC]onfig.in -print`
506 ifdef CONFIGURATION
507 ..$(CONFIGURATION):
508 @echo
509 @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
510 @echo
511 $(MAKE) $(CONFIGURATION)
512 @echo
513 @echo "Successful. Try re-making (ignore the error that follows)"
514 @echo
515 exit 1
517 #dummy: ..$(CONFIGURATION)
518 dummy:
520 else
522 dummy:
524 endif
526 include Rules.make
529 # This generates dependencies for the .h files.
532 scripts/mkdep: scripts/mkdep.c
533 $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
535 scripts/split-include: scripts/split-include.c
536 $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c