- pre4:
[davej-history.git] / Makefile
blobb9427e0e73f5c2930ab977bbdc649ca51130293c
1 VERSION = 2
2 PATCHLEVEL = 4
3 SUBLEVEL = 0
4 EXTRAVERSION = -test8
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 MAKEFILES = $(TOPDIR)/.config
37 GENKSYMS = /sbin/genksyms
38 DEPMOD = /sbin/depmod
39 MODFLAGS = -DMODULE
40 CFLAGS_KERNEL =
41 PERL = perl
43 export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
44 CONFIG_SHELL TOPDIR HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
45 CPP AR NM STRIP OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS MODFLAGS PERL
47 all: do-it-all
50 # Make "config" the default target if there is no configuration file or
51 # "depend" the target if there is no top-level dependency information.
54 ifeq (.config,$(wildcard .config))
55 include .config
56 ifeq (.depend,$(wildcard .depend))
57 include .depend
58 do-it-all: Version vmlinux
59 else
60 CONFIGURATION = depend
61 do-it-all: depend
62 endif
63 else
64 CONFIGURATION = config
65 do-it-all: config
66 endif
69 # INSTALL_PATH specifies where to place the updated kernel and system map
70 # images. Uncomment if you want to place them anywhere other than root.
73 #export INSTALL_PATH=/boot
76 # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
77 # relocations required by build roots. This is not defined in the
78 # makefile but the arguement can be passed to make if needed.
81 MODLIB := $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
82 export MODLIB
85 # standard CFLAGS
88 CPPFLAGS := -D__KERNEL__ -I$(HPATH)
90 CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
91 AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS)
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
114 # size in blocks.
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.o
122 DRIVERS =drivers/block/block.o \
123 drivers/char/char.o \
124 drivers/misc/misc.o \
125 drivers/net/net.o \
126 drivers/media/media.o \
127 drivers/parport/parport.a
128 LIBS =$(TOPDIR)/lib/lib.a
129 SUBDIRS =kernel drivers mm fs net ipc lib
131 DRIVERS-n :=
132 DRIVERS-y :=
133 DRIVERS-m :=
134 DRIVERS- :=
136 DRIVERS-$(CONFIG_AGP) += drivers/char/agp/agp.o
137 DRIVERS-$(CONFIG_DRM) += drivers/char/drm/drm.o
138 DRIVERS-$(CONFIG_NUBUS) += drivers/nubus/nubus.a
139 DRIVERS-$(CONFIG_ISDN) += drivers/isdn/isdn.a
140 DRIVERS-$(CONFIG_NET_FC) += drivers/net/fc/fc.o
141 DRIVERS-$(CONFIG_APPLETALK) += drivers/net/appletalk/appletalk.a
142 DRIVERS-$(CONFIG_TR) += drivers/net/tokenring/tr.a
143 DRIVERS-$(CONFIG_WAN) += drivers/net/wan/wan.o
144 DRIVERS-$(CONFIG_ARCNET) += drivers/net/arcnet/arcnet.a
145 DRIVERS-$(CONFIG_ATM) += drivers/atm/atm.o
146 DRIVERS-$(CONFIG_IDE) += drivers/ide/idedriver.o
147 DRIVERS-$(CONFIG_SCSI) += drivers/scsi/scsidrv.o
148 DRIVERS-$(CONFIG_IEEE1394) += drivers/ieee1394/ieee1394.a
150 ifneq ($(CONFIG_CD_NO_IDESCSI)$(CONFIG_BLK_DEV_IDECD)$(CONFIG_BLK_DEV_SR)$(CONFIG_PARIDE_PCD),)
151 DRIVERS-y += drivers/cdrom/cdrom.a
152 endif
154 DRIVERS-$(CONFIG_SOUND) += drivers/sound/sounddrivers.o
155 DRIVERS-$(CONFIG_PCI) += drivers/pci/pci.a
156 DRIVERS-$(CONFIG_MTD) += drivers/mtd/mtdlink.o
157 DRIVERS-$(CONFIG_PCMCIA) += drivers/pcmcia/pcmcia.o
158 DRIVERS-$(CONFIG_PCMCIA_NETCARD) += drivers/net/pcmcia/pcmcia_net.o
159 DRIVERS-$(CONFIG_PCMCIA_CHRDEV) += drivers/char/pcmcia/pcmcia_char.o
160 DRIVERS-$(CONFIG_DIO) += drivers/dio/dio.a
161 DRIVERS-$(CONFIG_SBUS) += drivers/sbus/sbus.a
162 DRIVERS-$(CONFIG_ZORRO) += drivers/zorro/zorro.a
163 DRIVERS-$(CONFIG_FC4) += drivers/fc4/fc4.a
164 DRIVERS-$(CONFIG_PPC) += drivers/macintosh/macintosh.o
165 DRIVERS-$(CONFIG_MAC) += drivers/macintosh/macintosh.o
166 DRIVERS-$(CONFIG_ISAPNP) += drivers/pnp/pnp.o
167 DRIVERS-$(CONFIG_SGI_IP22) += drivers/sgi/sgi.a
168 DRIVERS-$(CONFIG_VT) += drivers/video/video.o
169 DRIVERS-$(CONFIG_PARIDE) += drivers/block/paride/paride.a
170 DRIVERS-$(CONFIG_HAMRADIO) += drivers/net/hamradio/hamradio.o
171 DRIVERS-$(CONFIG_TC) += drivers/tc/tc.a
172 DRIVERS-$(CONFIG_USB) += drivers/usb/usbdrv.o
173 DRIVERS-$(CONFIG_INPUT) += drivers/input/inputdrv.o
174 DRIVERS-$(CONFIG_I2O) += drivers/i2o/i2o.o
175 DRIVERS-$(CONFIG_IRDA) += drivers/net/irda/irda.o
176 DRIVERS-$(CONFIG_I2C) += drivers/i2c/i2c.o
177 DRIVERS-$(CONFIG_PHONE) += drivers/telephony/telephony.a
178 DRIVERS-$(CONFIG_ACPI_INTERPRETER) += drivers/acpi/acpi.o
180 DRIVERS += $(DRIVERS-y)
182 include arch/$(ARCH)/Makefile
184 # use '-fno-strict-aliasing', but only if the compiler can take it
185 CFLAGS += $(shell if $(CC) -fno-strict-aliasing -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-fno-strict-aliasing"; fi)
187 export CPPFLAGS CFLAGS AFLAGS
189 export NETWORKS DRIVERS LIBS HEAD LDFLAGS LINKFLAGS MAKEBOOT ASFLAGS
191 .S.s:
192 $(CPP) $(AFLAGS) -traditional -o $*.s $<
193 .S.o:
194 $(CC) $(AFLAGS) -traditional -c -o $*.o $<
196 Version: dummy
197 @rm -f include/linux/compile.h
199 boot: vmlinux
200 @$(MAKE) CFLAGS="$(CFLAGS) $(CFLAGS_KERNEL)" -C arch/$(ARCH)/boot
202 vmlinux: $(CONFIGURATION) init/main.o init/version.o linuxsubdirs
203 $(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o \
204 --start-group \
205 $(CORE_FILES) \
206 $(DRIVERS) \
207 $(NETWORKS) \
208 $(LIBS) \
209 --end-group \
210 -o vmlinux
211 $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
213 symlinks:
214 rm -f include/asm
215 ( cd include ; ln -sf asm-$(ARCH) asm)
216 @if [ ! -d include/linux/modules ]; then \
217 mkdir include/linux/modules; \
220 oldconfig: symlinks
221 $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
223 xconfig: symlinks
224 $(MAKE) -C scripts kconfig.tk
225 wish -f scripts/kconfig.tk
227 menuconfig: include/linux/version.h symlinks
228 $(MAKE) -C scripts/lxdialog all
229 $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
231 config: symlinks
232 $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
234 include/config/MARKER: scripts/split-include include/linux/autoconf.h
235 scripts/split-include include/linux/autoconf.h include/config
236 @ touch include/config/MARKER
238 linuxsubdirs: $(patsubst %, _dir_%, $(SUBDIRS))
240 $(patsubst %, _dir_%, $(SUBDIRS)) : dummy include/linux/version.h include/config/MARKER
241 $(MAKE) CFLAGS="$(CFLAGS) $(CFLAGS_KERNEL)" -C $(patsubst _dir_%, %, $@)
243 $(TOPDIR)/include/linux/version.h: include/linux/version.h
244 $(TOPDIR)/include/linux/compile.h: include/linux/compile.h
246 newversion:
247 @if [ ! -f .version ]; then \
248 echo 1 > .version; \
249 else \
250 expr 0`cat .version` + 1 > .version; \
253 include/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion
254 @echo -n \#define UTS_VERSION \"\#`cat .version` > .ver
255 @if [ -n "$(CONFIG_SMP)" ] ; then echo -n " SMP" >> .ver; fi
256 @if [ -f .name ]; then echo -n \-`cat .name` >> .ver; fi
257 @echo ' '`date`'"' >> .ver
258 @echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
259 @echo \#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
260 @echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> .ver
261 @if [ -x /bin/dnsdomainname ]; then \
262 echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\"; \
263 elif [ -x /bin/domainname ]; then \
264 echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\"; \
265 else \
266 echo \#define LINUX_COMPILE_DOMAIN ; \
267 fi >> .ver
268 @echo \#define LINUX_COMPILER \"`$(CC) $(CFLAGS) -v 2>&1 | tail -1`\" >> .ver
269 @mv -f .ver $@
271 include/linux/version.h: ./Makefile
272 @echo \#define UTS_RELEASE \"$(KERNELRELEASE)\" > .ver
273 @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
274 @echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
275 @mv -f .ver $@
277 init/version.o: init/version.c include/linux/compile.h include/config/MARKER
278 $(CC) $(CFLAGS) $(CFLAGS_KERNEL) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c
280 init/main.o: init/main.c include/config/MARKER
281 $(CC) $(CFLAGS) $(CFLAGS_KERNEL) $(PROFILING) -c -o $*.o $<
283 fs lib mm ipc kernel drivers net: dummy
284 $(MAKE) CFLAGS="$(CFLAGS) $(CFLAGS_KERNEL)" $(subst $@, _dir_$@, $@)
286 TAGS: dummy
287 etags `find include/asm-$(ARCH) -name '*.h'`
288 find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print | xargs etags -a
289 find $(SUBDIRS) init -name '*.c' | xargs etags -a
291 # Exuberant ctags works better with -I
292 tags: dummy
293 CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__initlocaldata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
294 ctags $$CTAGSF `find include/asm-$(ARCH) -name '*.h'` && \
295 find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print | xargs ctags $$CTAGSF -a && \
296 find $(SUBDIRS) init -name '*.c' | xargs ctags $$CTAGSF -a
298 ifdef CONFIG_MODULES
299 ifdef CONFIG_MODVERSIONS
300 MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
301 endif
303 .PHONY: modules
304 modules: $(patsubst %, _mod_%, $(SUBDIRS))
306 .PHONY: $(patsubst %, _mod_%, $(SUBDIRS))
307 $(patsubst %, _mod_%, $(SUBDIRS)) : include/linux/version.h include/config/MARKER
308 $(MAKE) -C $(patsubst _mod_%, %, $@) CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules
310 .PHONY: modules_install
311 modules_install: _modinst_ $(patsubst %, _modinst_%, $(SUBDIRS)) _modinst_post
313 .PHONY: _modinst_
314 _modinst_:
315 @rm -rf $(MODLIB)/kernel
316 @rm -f $(MODLIB)/build
317 @mkdir -p $(MODLIB)/kernel
318 @ln -s $(TOPDIR) $(MODLIB)/build
320 # If System.map exists, run depmod. This deliberately does not have a
321 # dependency on System.map since that would run the dependency tree on
322 # vmlinux. This depmod is only for convenience to give the initial
323 # boot a modules.dep even before / is mounted read-write. However the
324 # boot script depmod is the master version.
325 ifeq "$(strip $(INSTALL_MOD_PATH))" ""
326 depmod_opts :=
327 else
328 depmod_opts := -b $(INSTALL_MOD_PATH) -r
329 endif
330 .PHONY: _modinst_post
331 _modinst_post: _modinst_post_pcmcia
332 if [ -r System.map ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi
334 # Backwards compatibilty symlinks for people still using old versions
335 # of pcmcia-cs with hard coded pathnames on insmod. Remove
336 # _modinst_post_pcmcia for kernel 2.4.1.
337 .PHONY: _modinst_post_pcmcia
338 _modinst_post_pcmcia:
339 cd $(MODLIB); \
340 mkdir -p pcmcia; \
341 find kernel -path '*/pcmcia/*' -name '*.o' | xargs -i -r ln -sf ../{} pcmcia
343 .PHONY: $(patsubst %, _modinst_%, $(SUBDIRS))
344 $(patsubst %, _modinst_%, $(SUBDIRS)) :
345 $(MAKE) -C $(patsubst _modinst_%, %, $@) modules_install
347 # modules disabled....
349 else
350 modules modules_install: dummy
351 @echo
352 @echo "The present kernel configuration has modules disabled."
353 @echo "Type 'make config' and enable loadable module support."
354 @echo "Then build a kernel with module support enabled."
355 @echo
356 @exit 1
357 endif
359 clean: archclean
360 rm -f kernel/ksyms.lst include/linux/compile.h
361 find . -name '*.[oas]' -type f -print | grep -v lxdialog/ | xargs rm -f
362 rm -f core `find . -type f -name 'core' -print`
363 rm -f core `find . -type f -name '.*.flags' -print`
364 rm -f vmlinux System.map
365 rm -f .tmp*
366 rm -f drivers/char/consolemap_deftbl.c drivers/video/promcon_tbl.c
367 rm -f drivers/char/conmakehash
368 rm -f drivers/pci/devlist.h drivers/pci/classlist.h drivers/pci/gen-devlist
369 rm -f drivers/sound/bin2hex drivers/sound/hex2hex
370 rm -f drivers/atm/fore200e_mkfirm drivers/atm/{pca,sba}*{.bin,.bin1,.bin2}
371 rm -f net/khttpd/make_times_h
372 rm -f net/khttpd/times.h
373 rm -f submenu*
374 rm -rf modules
375 $(MAKE) -C Documentation/DocBook clean
377 mrproper: clean archmrproper
378 rm -f include/linux/autoconf.h include/linux/version.h
379 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk1200,afsk2666,fsk9600}.h
380 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{hapn4800,psk4800}.h
381 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk2400_7,afsk2400_8}.h
382 rm -f drivers/net/hamradio/soundmodem/gentbl
383 rm -f drivers/char/hfmodem/gentbl drivers/char/hfmodem/tables.h
384 rm -f drivers/sound/*_boot.h drivers/sound/.*.boot
385 rm -f drivers/sound/msndinit.c
386 rm -f drivers/sound/msndperm.c
387 rm -f drivers/sound/pndsperm.c
388 rm -f drivers/sound/pndspini.c
389 rm -f drivers/atm/fore200e_*_fw.c drivers/atm/.fore200e_*.fw
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) -C Documentation/DocBook mrproper
402 distclean: mrproper
403 rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
404 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
405 -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print` TAGS tags
407 backup: mrproper
408 cd .. && tar cf - linux/ | gzip -9 > backup.gz
409 sync
411 sgmldocs:
412 chmod 755 $(TOPDIR)/scripts/docgen
413 chmod 755 $(TOPDIR)/scripts/gen-all-syms
414 chmod 755 $(TOPDIR)/scripts/kernel-doc
415 $(MAKE) -C $(TOPDIR)/Documentation/DocBook books
417 psdocs: sgmldocs
418 $(MAKE) -C Documentation/DocBook ps
420 pdfdocs: sgmldocs
421 $(MAKE) -C Documentation/DocBook pdf
423 htmldocs: sgmldocs
424 $(MAKE) -C Documentation/DocBook html
426 sums:
427 find . -type f -print | sort | xargs sum > .SUMS
429 dep-files: scripts/mkdep archdep include/linux/version.h
430 scripts/mkdep init/*.c > .depend
431 scripts/mkdep `find $(FINDHPATH) -name SCCS -prune -o -follow -name \*.h ! -name modversions.h -print` > .hdepend
432 $(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) _FASTDEP_ALL_SUB_DIRS="$(SUBDIRS)"
433 ifdef CONFIG_MODVERSIONS
434 $(MAKE) update-modverfile
435 endif
437 ifdef CONFIG_MODVERSIONS
438 MODVERFILE := $(TOPDIR)/include/linux/modversions.h
439 else
440 MODVERFILE :=
441 endif
442 export MODVERFILE
444 depend dep: dep-files
446 # make checkconfig: Prune 'scripts' directory to avoid "false positives".
447 checkconfig:
448 find * -name '*.[hcS]' -type f -print | grep -v scripts/ | sort | xargs $(PERL) -w scripts/checkconfig.pl
450 checkhelp:
451 find * -name [cC]onfig.in -print | sort | xargs $(PERL) -w scripts/checkhelp.pl
453 checkincludes:
454 find * -name '*.[hcS]' -type f -print | sort | xargs $(PERL) -w scripts/checkincludes.pl
456 ifdef CONFIGURATION
457 ..$(CONFIGURATION):
458 @echo
459 @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
460 @echo
461 $(MAKE) $(CONFIGURATION)
462 @echo
463 @echo "Successful. Try re-making (ignore the error that follows)"
464 @echo
465 exit 1
467 #dummy: ..$(CONFIGURATION)
468 dummy:
470 else
472 dummy:
474 endif
476 include Rules.make
479 # This generates dependencies for the .h files.
482 scripts/mkdep: scripts/mkdep.c
483 $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
485 scripts/split-include: scripts/split-include.c
486 $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c