Import 2.3.99pre3-8
[davej-history.git] / Makefile
blob184c30b82c2cbf2bdf4b3795b51340cc6b7ccb2f
1 VERSION = 2
2 PATCHLEVEL = 3
3 SUBLEVEL = 99
4 EXTRAVERSION = -pre3
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
18 HOSTCC = gcc
19 HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
21 CROSS_COMPILE =
24 # Include the make variables (CC, etc...)
27 AS = $(CROSS_COMPILE)as
28 LD = $(CROSS_COMPILE)ld
29 CC = $(CROSS_COMPILE)gcc
30 CPP = $(CC) -E
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 MAKE = make
37 MAKEFILES = $(TOPDIR)/.config
38 GENKSYMS = /sbin/genksyms
39 MODFLAGS = -DMODULE
40 PERL = perl
42 export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
43 CONFIG_SHELL TOPDIR HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
44 CPP AR NM STRIP OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS MODFLAGS PERL
46 all: do-it-all
49 # Make "config" the default target if there is no configuration file or
50 # "depend" the target if there is no top-level dependency information.
53 ifeq (.config,$(wildcard .config))
54 include .config
55 ifeq (.depend,$(wildcard .depend))
56 include .depend
57 do-it-all: Version vmlinux
58 else
59 CONFIGURATION = depend
60 do-it-all: depend
61 endif
62 else
63 CONFIGURATION = config
64 do-it-all: config
65 endif
68 # INSTALL_PATH specifies where to place the updated kernel and system map
69 # images. Uncomment if you want to place them anywhere other than root.
72 #export INSTALL_PATH=/boot
75 # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
76 # relocations required by build roots. This is not defined in the
77 # makefile but the arguement can be passed to make if needed.
81 # standard CFLAGS
84 CPPFLAGS := -D__KERNEL__ -I$(HPATH)
86 ifdef CONFIG_SMP
87 CPPFLAGS += -D__SMP__
88 endif
90 CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
91 AFLAGS := $(CPPFLAGS)
93 # use '-fno-strict-aliasing', but only if the compiler can take it
94 CFLAGS += $(shell if $(CC) -fno-strict-aliasing -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-fno-strict-aliasing"; fi)
96 export CPPFLAGS CFLAGS AFLAGS
99 # ROOT_DEV specifies the default root-device when making the image.
100 # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
101 # the default of FLOPPY is used by 'build'.
102 # This is i386 specific.
105 export ROOT_DEV = CURRENT
108 # If you want to preset the SVGA mode, uncomment the next line and
109 # set SVGA_MODE to whatever number you want.
110 # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
111 # The number is the same as you would ordinarily press at bootup.
112 # This is i386 specific.
115 export SVGA_MODE = -DSVGA_MODE=NORMAL_VGA
118 # if you want the RAM disk device, define this to be the
119 # size in blocks.
120 # This is i386 specific.
123 #export RAMDISK = -DRAMDISK=512
125 CORE_FILES =kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o
126 NETWORKS =net/network.a
127 DRIVERS =drivers/block/block.a \
128 drivers/char/char.o \
129 drivers/misc/misc.o \
130 drivers/net/net.o \
131 drivers/parport/parport.a
132 LIBS =$(TOPDIR)/lib/lib.a
133 SUBDIRS =kernel drivers mm fs net ipc lib
135 DRIVERS-n :=
136 DRIVERS-y :=
137 DRIVERS-m :=
138 DRIVERS- :=
140 DRIVERS-$(CONFIG_DRM) += drivers/char/drm/drm.o
141 DRIVERS-$(CONFIG_AGP) += drivers/char/agp/agp.o
142 DRIVERS-$(CONFIG_NUBUS) += drivers/nubus/nubus.a
143 DRIVERS-$(CONFIG_ISDN) += drivers/isdn/isdn.a
144 DRIVERS-$(CONFIG_NET_FC) += drivers/net/fc/fc.a
145 DRIVERS-$(CONFIG_APPLETALK) += drivers/net/appletalk/appletalk.a
146 DRIVERS-$(CONFIG_TR) += drivers/net/tokenring/tr.a
147 DRIVERS-$(CONFIG_WAN) += drivers/net/wan/wan.a
148 DRIVERS-$(CONFIG_ARCNET) += drivers/net/arcnet/arcnet.a
149 DRIVERS-$(CONFIG_ATM) += drivers/atm/atm.o
150 DRIVERS-$(CONFIG_IDE) += drivers/ide/ide.a
151 DRIVERS-$(CONFIG_SCSI) += drivers/scsi/scsi.a
152 DRIVERS-$(CONFIG_IEEE1394) += drivers/ieee1394/ieee1394.a
154 ifneq ($(CONFIG_CD_NO_IDESCSI)$(CONFIG_BLK_DEV_IDECD)$(CONFIG_BLK_DEV_SR)$(CONFIG_PARIDE_PCD),)
155 DRIVERS-y += drivers/cdrom/cdrom.a
156 endif
158 DRIVERS-$(CONFIG_SOUND) += drivers/sound/sounddrivers.o
159 DRIVERS-$(CONFIG_PCI) += drivers/pci/pci.a
160 DRIVERS-$(CONFIG_PCMCIA) += drivers/pcmcia/pcmcia.o
161 DRIVERS-$(CONFIG_PCMCIA_NETCARD) += drivers/net/pcmcia/pcmcia_net.o
162 DRIVERS-$(CONFIG_PCMCIA_CHRDEV) += drivers/char/pcmcia/pcmcia_char.o
163 DRIVERS-$(CONFIG_DIO) += drivers/dio/dio.a
164 DRIVERS-$(CONFIG_SBUS) += drivers/sbus/sbus.a
165 DRIVERS-$(CONFIG_ZORRO) += drivers/zorro/zorro.a
166 DRIVERS-$(CONFIG_FC4) += drivers/fc4/fc4.a
167 DRIVERS-$(CONFIG_PPC) += drivers/macintosh/macintosh.a
168 DRIVERS-$(CONFIG_MAC) += drivers/macintosh/macintosh.a
169 DRIVERS-$(CONFIG_ISAPNP) += drivers/pnp/pnp.o
170 DRIVERS-$(CONFIG_SGI_IP22) += drivers/sgi/sgi.a
171 DRIVERS-$(CONFIG_VT) += drivers/video/video.o
172 DRIVERS-$(CONFIG_PARIDE) += drivers/block/paride/paride.a
173 DRIVERS-$(CONFIG_HAMRADIO) += drivers/net/hamradio/hamradio.o
174 DRIVERS-$(CONFIG_TC) += drivers/tc/tc.a
175 DRIVERS-$(CONFIG_USB) += drivers/usb/usbdrv.o
176 DRIVERS-$(CONFIG_I2O) += drivers/i2o/i2o.a
177 DRIVERS-$(CONFIG_IRDA) += drivers/net/irda/irda_drivers.a
178 DRIVERS-$(CONFIG_I2C) += drivers/i2c/i2c.a
179 DRIVERS-$(CONFIG_PHONE) += drivers/telephony/telephony.a
181 DRIVERS += $(DRIVERS-y)
183 include arch/$(ARCH)/Makefile
185 export NETWORKS DRIVERS LIBS HEAD LDFLAGS LINKFLAGS MAKEBOOT ASFLAGS
187 .S.s:
188 $(CPP) -D__ASSEMBLY__ $(AFLAGS) -traditional -o $*.s $<
189 .S.o:
190 $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c -o $*.o $<
192 Version: dummy
193 @rm -f include/linux/compile.h
195 boot: vmlinux
196 @$(MAKE) -C arch/$(ARCH)/boot
198 vmlinux: $(CONFIGURATION) init/main.o init/version.o linuxsubdirs
199 $(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o \
200 --start-group \
201 $(CORE_FILES) \
202 $(DRIVERS) \
203 $(NETWORKS) \
204 $(LIBS) \
205 --end-group \
206 -o vmlinux
207 $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
209 symlinks:
210 rm -f include/asm
211 ( cd include ; ln -sf asm-$(ARCH) asm)
212 @if [ ! -d include/linux/modules ]; then \
213 mkdir include/linux/modules; \
216 oldconfig: symlinks
217 $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
219 xconfig: symlinks
220 $(MAKE) -C scripts kconfig.tk
221 wish -f scripts/kconfig.tk
223 menuconfig: include/linux/version.h symlinks
224 $(MAKE) -C scripts/lxdialog all
225 $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
227 config: symlinks
228 $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
230 include/config/MARKER: scripts/split-include include/linux/autoconf.h
231 scripts/split-include include/linux/autoconf.h include/config
232 @ touch include/config/MARKER
234 linuxsubdirs: $(patsubst %, _dir_%, $(SUBDIRS))
236 $(patsubst %, _dir_%, $(SUBDIRS)) : dummy include/config/MARKER
237 $(MAKE) -C $(patsubst _dir_%, %, $@)
239 $(TOPDIR)/include/linux/version.h: include/linux/version.h
240 $(TOPDIR)/include/linux/compile.h: include/linux/compile.h
242 newversion:
243 @if [ ! -f .version ]; then \
244 echo 1 > .version; \
245 else \
246 expr 0`cat .version` + 1 > .version; \
249 include/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion
250 @echo -n \#define UTS_VERSION \"\#`cat .version` > .ver
251 @if [ -n "$(CONFIG_SMP)" ] ; then echo -n " SMP" >> .ver; fi
252 @if [ -f .name ]; then echo -n \-`cat .name` >> .ver; fi
253 @echo ' '`date`'"' >> .ver
254 @echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
255 @echo \#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
256 @echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> .ver
257 @if [ -x /bin/dnsdomainname ]; then \
258 echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\"; \
259 elif [ -x /bin/domainname ]; then \
260 echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\"; \
261 else \
262 echo \#define LINUX_COMPILE_DOMAIN ; \
263 fi >> .ver
264 @echo \#define LINUX_COMPILER \"`$(CC) $(CFLAGS) -v 2>&1 | tail -1`\" >> .ver
265 @mv -f .ver $@
267 include/linux/version.h: ./Makefile
268 @echo \#define UTS_RELEASE \"$(KERNELRELEASE)\" > .ver
269 @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
270 @echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
271 @mv -f .ver $@
273 init/version.o: init/version.c include/linux/compile.h include/config/MARKER
274 $(CC) $(CFLAGS) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c
276 init/main.o: init/main.c include/config/MARKER
277 $(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<
279 fs lib mm ipc kernel drivers net: dummy
280 $(MAKE) $(subst $@, _dir_$@, $@)
282 TAGS: dummy
283 etags `find include/asm-$(ARCH) -name '*.h'`
284 find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print | xargs etags -a
285 find $(SUBDIRS) init -name '*.c' | xargs etags -a
287 # Exuberant ctags works better with -I
288 tags: dummy
289 CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__initlocaldata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
290 ctags $$CTAGSF `find include/asm-$(ARCH) -name '*.h'` && \
291 find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print | xargs ctags $$CTAGSF -a && \
292 find $(SUBDIRS) init -name '*.c' | xargs ctags $$CTAGSF -a
294 ifdef CONFIG_MODULES
295 ifdef CONFIG_MODVERSIONS
296 MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
297 endif
299 modules: $(patsubst %, _mod_%, $(SUBDIRS))
301 modules/MARKER:
302 mkdir -p modules
303 touch modules/MARKER
305 $(patsubst %, _mod_%, $(SUBDIRS)) : include/linux/version.h include/config/MARKER modules/MARKER
306 $(MAKE) -C $(patsubst _mod_%, %, $@) CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules
308 modules_install:
309 @( \
310 MODLIB=$(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE); \
311 cd modules; \
312 MODULES=""; \
313 inst_mod() { These="`cat $$1`"; MODULES="$$MODULES $$These"; \
314 mkdir -p $$MODLIB/$$2; cp $$These $$MODLIB/$$2; \
315 echo Installing modules under $$MODLIB/$$2; \
316 }; \
317 mkdir -p $$MODLIB; \
319 if [ -f BLOCK_MODULES ]; then inst_mod BLOCK_MODULES block; fi; \
320 if [ -f NET_MODULES ]; then inst_mod NET_MODULES net; fi; \
321 if [ -f IPV4_MODULES ]; then inst_mod IPV4_MODULES ipv4; fi; \
322 if [ -f IPV6_MODULES ]; then inst_mod IPV6_MODULES ipv6; fi; \
323 if [ -f ATM_MODULES ]; then inst_mod ATM_MODULES atm; fi; \
324 if [ -f IDE_MODULES ]; then inst_mod IDE_MODULES ide; fi; \
325 if [ -f SCSI_MODULES ]; then inst_mod SCSI_MODULES scsi; fi; \
326 if [ -f FS_MODULES ]; then inst_mod FS_MODULES fs; fi; \
327 if [ -f NLS_MODULES ]; then inst_mod NLS_MODULES fs; fi; \
328 if [ -f CDROM_MODULES ]; then inst_mod CDROM_MODULES cdrom; fi; \
329 if [ -f HAM_MODULES ]; then inst_mod HAM_MODULES net; fi; \
330 if [ -f SOUND_MODULES ]; then inst_mod SOUND_MODULES sound; fi; \
331 if [ -f VIDEO_MODULES ]; then inst_mod VIDEO_MODULES video; fi; \
332 if [ -f FC4_MODULES ]; then inst_mod FC4_MODULES fc4; fi; \
333 if [ -f IRDA_MODULES ]; then inst_mod IRDA_MODULES net; fi; \
334 if [ -f SK98LIN_MODULES ]; then inst_mod SK98LIN_MODULES net; fi; \
335 if [ -f SKFP_MODULES ]; then inst_mod SKFP_MODULES net; fi; \
336 if [ -f USB_MODULES ]; then inst_mod USB_MODULES usb; fi; \
337 if [ -f USB_SERIAL_MODULES ]; then inst_mod USB_SERIAL_MODULES usb; fi; \
338 if [ -f IEEE1394_MODULES ]; then inst_mod IEEE1394_MODULES ieee1394; fi; \
339 if [ -f PCMCIA_MODULES ]; then inst_mod PCMCIA_MODULES pcmcia; fi; \
340 if [ -f PCMCIA_NET_MODULES ]; then inst_mod PCMCIA_NET_MODULES pcmcia; fi; \
341 if [ -f PCMCIA_CHAR_MODULES ]; then inst_mod PCMCIA_CHAR_MODULES pcmcia; fi; \
342 if [ -f PCMCIA_SCSI_MODULES ]; then inst_mod PCMCIA_SCSI_MODULES pcmcia; fi; \
344 ls -1 -U *.o | sort > $$MODLIB/.allmods; \
345 echo $$MODULES | tr ' ' '\n' | sort | comm -23 $$MODLIB/.allmods - > $$MODLIB/.misc; \
346 if [ -s $$MODLIB/.misc ]; then inst_mod $$MODLIB/.misc misc; fi; \
347 rm -f $$MODLIB/.misc $$MODLIB/.allmods; \
350 # modules disabled....
352 else
353 modules modules_install: dummy
354 @echo
355 @echo "The present kernel configuration has modules disabled."
356 @echo "Type 'make config' and enable loadable module support."
357 @echo "Then build a kernel with module support enabled."
358 @echo
359 @exit 1
360 endif
362 clean: archclean
363 rm -f kernel/ksyms.lst include/linux/compile.h
364 find . -name '*.[oas]' -type f -print | grep -v lxdialog/ | xargs rm -f
365 rm -f core `find . -type f -name 'core' -print`
366 rm -f core `find . -type f -name '.*.flags' -print`
367 rm -f vmlinux System.map
368 rm -f .tmp*
369 rm -f drivers/char/consolemap_deftbl.c drivers/video/promcon_tbl.c
370 rm -f drivers/char/conmakehash
371 rm -f drivers/pci/devlist.h drivers/pci/classlist.h drivers/pci/gen-devlist
372 rm -f drivers/sound/bin2hex drivers/sound/hex2hex
373 rm -f net/khttpd/make_times_h
374 rm -f net/khttpd/times.h
375 rm -f submenu*
376 rm -rf modules
378 mrproper: clean archmrproper
379 rm -f include/linux/autoconf.h include/linux/version.h
380 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk1200,afsk2666,fsk9600}.h
381 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{hapn4800,psk4800}.h
382 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk2400_7,afsk2400_8}.h
383 rm -f drivers/net/hamradio/soundmodem/gentbl
384 rm -f drivers/char/hfmodem/gentbl drivers/char/hfmodem/tables.h
385 rm -f drivers/sound/*_boot.h drivers/sound/.*.boot
386 rm -f drivers/sound/msndinit.c
387 rm -f drivers/sound/msndperm.c
388 rm -f drivers/sound/pndsperm.c
389 rm -f drivers/sound/pndspini.c
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
394 rm -f include/asm
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 clean TOPDIR=$(TOPDIR) -C Documentation/DocBook
403 distclean: mrproper
404 rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
405 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
406 -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print` TAGS tags
408 backup: mrproper
409 cd .. && tar cf - linux/ | gzip -9 > backup.gz
410 sync
412 sgmldocs:
413 $(MAKE) -C $(TOPDIR)/Documentation/DocBook books
415 sums:
416 find . -type f -print | sort | xargs sum > .SUMS
418 dep-files: scripts/mkdep archdep include/linux/version.h
419 scripts/mkdep init/*.c > .depend
420 scripts/mkdep `find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print` > .hdepend
421 $(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) _FASTDEP_ALL_SUB_DIRS="$(SUBDIRS)"
423 ifdef CONFIG_MODVERSIONS
424 MODVERFILE := $(TOPDIR)/include/linux/modversions.h
425 else
426 MODVERFILE :=
427 endif
428 export MODVERFILE
430 depend dep: dep-files $(MODVERFILE)
432 # make checkconfig: Prune 'scripts' directory to avoid "false positives".
433 checkconfig:
434 find * -name '*.[hcS]' -type f -print | grep -v scripts/ | sort | xargs $(PERL) -w scripts/checkconfig.pl
436 checkhelp:
437 $(PERL) -w scripts/checkhelp.pl `find * -name [cC]onfig.in -print`
439 ifdef CONFIGURATION
440 ..$(CONFIGURATION):
441 @echo
442 @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
443 @echo
444 $(MAKE) $(CONFIGURATION)
445 @echo
446 @echo "Successful. Try re-making (ignore the error that follows)"
447 @echo
448 exit 1
450 #dummy: ..$(CONFIGURATION)
451 dummy:
453 else
455 dummy:
457 endif
459 include Rules.make
462 # This generates dependencies for the .h files.
465 scripts/mkdep: scripts/mkdep.c
466 $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
468 scripts/split-include: scripts/split-include.c
469 $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c