Import 2.3.24pre3
[davej-history.git] / Makefile
blob21b5bde8018a8e4533c70851a988928d41e2bae0
1 VERSION = 2
2 PATCHLEVEL = 3
3 SUBLEVEL = 24
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 -D__KERNEL__ -I$(HPATH)
26 CPP =$(CC) -E
27 AR =$(CROSS_COMPILE)ar
28 NM =$(CROSS_COMPILE)nm
29 STRIP =$(CROSS_COMPILE)strip
30 OBJDUMP =$(CROSS_COMPILE)objdump
31 MAKE =make
32 GENKSYMS=/sbin/genksyms
34 all: do-it-all
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))
41 include .config
42 ifeq (.depend,$(wildcard .depend))
43 include .depend
44 do-it-all: Version vmlinux
45 else
46 CONFIGURATION = depend
47 do-it-all: depend
48 endif
49 else
50 CONFIGURATION = config
51 do-it-all: config
52 endif
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'.
60 ROOT_DEV = CURRENT
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.
68 #INSTALL_PATH=/boot
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
86 # standard CFLAGS
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)
94 ifdef CONFIG_SMP
95 CFLAGS += -D__SMP__
96 AFLAGS += -D__SMP__
97 endif
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 FILESYSTEMS =fs/filesystems.a
111 NETWORKS =net/network.a
112 DRIVERS =drivers/block/block.a \
113 drivers/char/char.o \
114 drivers/misc/misc.o \
115 drivers/parport/parport.a
116 LIBS =$(TOPDIR)/lib/lib.a
117 SUBDIRS =kernel drivers mm fs net ipc lib
119 ifdef CONFIG_NUBUS
120 DRIVERS := $(DRIVERS) drivers/nubus/nubus.a
121 endif
123 ifeq ($(CONFIG_ISDN),y)
124 DRIVERS := $(DRIVERS) drivers/isdn/isdn.a
125 endif
127 DRIVERS := $(DRIVERS) drivers/net/net.a
129 ifdef CONFIG_NET_FC
130 DRIVERS := $(DRIVERS) drivers/net/fc/fc.a
131 endif
133 ifdef CONFIG_TR
134 DRIVERS := $(DRIVERS) drivers/net/tokenring/tr.a
135 endif
137 ifdef CONFIG_WAN
138 DRIVERS := $(DRIVERS) drivers/net/wan/wan.a
139 endif
141 ifdef CONFIG_ATM
142 DRIVERS := $(DRIVERS) drivers/atm/atm.a
143 endif
145 ifeq ($(CONFIG_SCSI),y)
146 DRIVERS := $(DRIVERS) drivers/scsi/scsi.a
147 endif
149 ifneq ($(CONFIG_CD_NO_IDESCSI)$(CONFIG_BLK_DEV_IDECD)$(CONFIG_BLK_DEV_SR)$(CONFIG_PARIDE_PCD),)
150 DRIVERS := $(DRIVERS) drivers/cdrom/cdrom.a
151 endif
153 ifeq ($(CONFIG_SOUND),y)
154 DRIVERS := $(DRIVERS) drivers/sound/sounddrivers.o
155 endif
157 ifdef CONFIG_PCI
158 DRIVERS := $(DRIVERS) drivers/pci/pci.a
159 endif
161 ifeq ($(CONFIG_PCMCIA),y)
162 DRIVERS := $(DRIVERS) drivers/pcmcia/pcmcia.o
163 endif
165 ifeq ($(CONFIG_PCMCIA_NETCARD),y)
166 DRIVERS := $(DRIVERS) drivers/net/pcmcia/pcmcia_net.o
167 endif
169 ifdef CONFIG_DIO
170 DRIVERS := $(DRIVERS) drivers/dio/dio.a
171 endif
173 ifdef CONFIG_SBUS
174 DRIVERS := $(DRIVERS) drivers/sbus/sbus.a
175 endif
177 ifdef CONFIG_ZORRO
178 DRIVERS := $(DRIVERS) drivers/zorro/zorro.a
179 endif
181 ifeq ($(CONFIG_FC4),y)
182 DRIVERS := $(DRIVERS) drivers/fc4/fc4.a
183 endif
185 ifdef CONFIG_PPC
186 DRIVERS := $(DRIVERS) drivers/macintosh/macintosh.a
187 endif
189 ifeq ($(CONFIG_PNP),y)
190 DRIVERS := $(DRIVERS) drivers/pnp/pnp.a
191 endif
193 ifdef CONFIG_SGI
194 DRIVERS := $(DRIVERS) drivers/sgi/sgi.a
195 endif
197 ifdef CONFIG_VT
198 DRIVERS := $(DRIVERS) drivers/video/video.a
199 endif
201 ifeq ($(CONFIG_PARIDE),y)
202 DRIVERS := $(DRIVERS) drivers/block/paride/paride.a
203 endif
205 ifdef CONFIG_HAMRADIO
206 DRIVERS := $(DRIVERS) drivers/net/hamradio/hamradio.o
207 endif
209 ifeq ($(CONFIG_TC),y)
210 DRIVERS := $(DRIVERS) drivers/tc/tc.a
211 endif
213 ifeq ($(CONFIG_USB),y)
214 DRIVERS := $(DRIVERS) drivers/usb/usb.a
215 endif
217 ifeq ($(CONFIG_I2O),y)
218 DRIVERS := $(DRIVERS) drivers/i2o/i2o.a
219 endif
221 ifeq ($(CONFIG_IRDA),y)
222 DRIVERS := $(DRIVERS) drivers/net/irda/irda_drivers.a
223 endif
225 include arch/$(ARCH)/Makefile
227 .S.s:
228 $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -E -o $*.s $<
229 .S.o:
230 $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c -o $*.o $<
232 Version: dummy
233 @rm -f include/linux/compile.h
235 boot: vmlinux
236 @$(MAKE) -C arch/$(ARCH)/boot
238 vmlinux: $(CONFIGURATION) init/main.o init/version.o linuxsubdirs
239 $(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o \
240 --start-group \
241 $(CORE_FILES) \
242 $(FILESYSTEMS) \
243 $(NETWORKS) \
244 $(DRIVERS) \
245 $(LIBS) \
246 --end-group \
247 -o vmlinux
248 $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
250 symlinks:
251 rm -f include/asm
252 ( cd include ; ln -sf asm-$(ARCH) asm)
253 @if [ ! -d modules ]; then \
254 mkdir modules; \
256 @if [ ! -d include/linux/modules ]; then \
257 mkdir include/linux/modules; \
260 oldconfig: symlinks
261 $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
263 xconfig: symlinks
264 $(MAKE) -C scripts kconfig.tk
265 wish -f scripts/kconfig.tk
267 menuconfig: include/linux/version.h symlinks
268 $(MAKE) -C scripts/lxdialog all
269 $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
271 config: symlinks
272 $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
274 include/config/MARKER: scripts/split-include include/linux/autoconf.h
275 scripts/split-include include/linux/autoconf.h include/config
276 @ touch include/config/MARKER
278 linuxsubdirs: $(patsubst %, _dir_%, $(SUBDIRS))
280 $(patsubst %, _dir_%, $(SUBDIRS)) : dummy include/config/MARKER
281 $(MAKE) -C $(patsubst _dir_%, %, $@)
283 $(TOPDIR)/include/linux/version.h: include/linux/version.h
284 $(TOPDIR)/include/linux/compile.h: include/linux/compile.h
286 newversion:
287 @if [ ! -f .version ]; then \
288 echo 1 > .version; \
289 else \
290 expr 0`cat .version` + 1 > .version; \
293 include/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion
294 @echo -n \#define UTS_VERSION \"\#`cat .version` > .ver
295 @if [ -n "$(CONFIG_SMP)" ] ; then echo -n " SMP" >> .ver; fi
296 @if [ -f .name ]; then echo -n \-`cat .name` >> .ver; fi
297 @echo ' '`date`'"' >> .ver
298 @echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
299 @echo \#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
300 @echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> .ver
301 @if [ -x /bin/dnsdomainname ]; then \
302 echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\"; \
303 elif [ -x /bin/domainname ]; then \
304 echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\"; \
305 else \
306 echo \#define LINUX_COMPILE_DOMAIN ; \
307 fi >> .ver
308 @echo \#define LINUX_COMPILER \"`$(CC) $(CFLAGS) -v 2>&1 | tail -1`\" >> .ver
309 @mv -f .ver $@
311 include/linux/version.h: ./Makefile
312 @echo \#define UTS_RELEASE \"$(KERNELRELEASE)\" > .ver
313 @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
314 @echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
315 @mv -f .ver $@
317 init/version.o: init/version.c include/linux/compile.h include/config/MARKER
318 $(CC) $(CFLAGS) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c
320 init/main.o: init/main.c include/config/MARKER
321 $(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<
323 fs lib mm ipc kernel drivers net: dummy
324 $(MAKE) $(subst $@, _dir_$@, $@)
326 MODFLAGS = -DMODULE
327 ifdef CONFIG_MODULES
328 ifdef CONFIG_MODVERSIONS
329 MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
330 endif
332 modules: $(patsubst %, _mod_%, $(SUBDIRS))
334 $(patsubst %, _mod_%, $(SUBDIRS)) : include/linux/version.h
335 $(MAKE) -C $(patsubst _mod_%, %, $@) CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules
337 modules_install:
338 @( \
339 MODLIB=$(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE); \
340 cd modules; \
341 MODULES=""; \
342 inst_mod() { These="`cat $$1`"; MODULES="$$MODULES $$These"; \
343 mkdir -p $$MODLIB/$$2; cp $$These $$MODLIB/$$2; \
344 echo Installing modules under $$MODLIB/$$2; \
345 }; \
346 mkdir -p $$MODLIB; \
348 if [ -f BLOCK_MODULES ]; then inst_mod BLOCK_MODULES block; fi; \
349 if [ -f NET_MODULES ]; then inst_mod NET_MODULES net; fi; \
350 if [ -f IPV4_MODULES ]; then inst_mod IPV4_MODULES ipv4; fi; \
351 if [ -f IPV6_MODULES ]; then inst_mod IPV6_MODULES ipv6; fi; \
352 if [ -f ATM_MODULES ]; then inst_mod ATM_MODULES atm; fi; \
353 if [ -f SCSI_MODULES ]; then inst_mod SCSI_MODULES scsi; fi; \
354 if [ -f FS_MODULES ]; then inst_mod FS_MODULES fs; fi; \
355 if [ -f NLS_MODULES ]; then inst_mod NLS_MODULES fs; fi; \
356 if [ -f CDROM_MODULES ]; then inst_mod CDROM_MODULES cdrom; fi; \
357 if [ -f HAM_MODULES ]; then inst_mod HAM_MODULES net; fi; \
358 if [ -f SOUND_MODULES ]; then inst_mod SOUND_MODULES sound; fi; \
359 if [ -f VIDEO_MODULES ]; then inst_mod VIDEO_MODULES video; fi; \
360 if [ -f FC4_MODULES ]; then inst_mod FC4_MODULES fc4; fi; \
361 if [ -f IRDA_MODULES ]; then inst_mod IRDA_MODULES net; fi; \
362 if [ -f USB_MODULES ]; then inst_mod USB_MODULES usb; fi; \
363 if [ -f PCMCIA_MODULES ]; then inst_mod PCMCIA_MODULES pcmcia; fi; \
365 ls *.o > $$MODLIB/.allmods; \
366 echo $$MODULES | tr ' ' '\n' | sort | comm -23 $$MODLIB/.allmods - > $$MODLIB/.misc; \
367 if [ -s $$MODLIB/.misc ]; then inst_mod $$MODLIB/.misc misc; fi; \
368 rm -f $$MODLIB/.misc $$MODLIB/.allmods; \
371 # modules disabled....
373 else
374 modules modules_install: dummy
375 @echo
376 @echo "The present kernel configuration has modules disabled."
377 @echo "Type 'make config' and enable loadable module support."
378 @echo "Then build a kernel with module support enabled."
379 @echo
380 @exit 1
381 endif
383 clean: archclean
384 rm -f kernel/ksyms.lst include/linux/compile.h
385 find . -name '*.[oas]' -type f -print | grep -v lxdialog/ | xargs rm -f
386 rm -f core `find . -type f -name 'core' -print`
387 rm -f core `find . -type f -name '.*.flags' -print`
388 rm -f vmlinux System.map
389 rm -f .tmp*
390 rm -f drivers/char/consolemap_deftbl.c drivers/video/promcon_tbl.c
391 rm -f drivers/char/conmakehash
392 rm -f drivers/sound/bin2hex drivers/sound/hex2hex
393 rm -f net/khttpd/make_times_h
394 rm -f net/khttpd/times.h
395 if [ -d modules ]; then \
396 rm -f core `find modules/ -type f -print`; \
398 rm -f submenu*
400 mrproper: clean archmrproper
401 rm -f include/linux/autoconf.h include/linux/version.h
402 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk1200,afsk2666,fsk9600}.h
403 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{hapn4800,psk4800}.h
404 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk2400_7,afsk2400_8}.h
405 rm -f drivers/net/hamradio/soundmodem/gentbl
406 rm -f drivers/char/hfmodem/gentbl drivers/char/hfmodem/tables.h
407 rm -f drivers/sound/*_boot.h drivers/sound/.*.boot
408 rm -f .version .config* config.in config.old
409 rm -f scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp
410 rm -f scripts/lxdialog/*.o scripts/lxdialog/lxdialog
411 rm -f .menuconfig.log
412 rm -f include/asm
413 rm -rf include/config
414 rm -f .depend `find . -type f -name .depend -print`
415 rm -f core `find . -type f -size 0 -print`
416 rm -f .hdepend scripts/mkdep scripts/split-include
417 rm -f $(TOPDIR)/include/linux/modversions.h
418 rm -rf $(TOPDIR)/include/linux/modules
419 rm -rf modules
421 distclean: mrproper
422 rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
423 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
424 -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print` TAGS
426 backup: mrproper
427 cd .. && tar cf - linux/ | gzip -9 > backup.gz
428 sync
430 sums:
431 find . -type f -print | sort | xargs sum > .SUMS
433 dep-files: scripts/mkdep archdep include/linux/version.h
434 scripts/mkdep init/*.c > .depend
435 scripts/mkdep `find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print` > .hdepend
436 $(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) _FASTDEP_ALL_SUB_DIRS="$(SUBDIRS)"
438 MODVERFILE :=
440 ifdef CONFIG_MODVERSIONS
441 MODVERFILE := $(TOPDIR)/include/linux/modversions.h
442 endif
444 depend dep: dep-files $(MODVERFILE)
446 # make checkconfig: Prune 'scripts' directory to avoid "false positives".
447 checkconfig:
448 perl -w scripts/checkconfig.pl `find * -path 'scripts' -prune -o -name '*.[hcS]' -print | sort`
450 checkhelp:
451 perl -w scripts/checkhelp.pl `find * -name [cC]onfig.in -print`
453 ifdef CONFIGURATION
454 ..$(CONFIGURATION):
455 @echo
456 @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
457 @echo
458 $(MAKE) $(CONFIGURATION)
459 @echo
460 @echo "Successful. Try re-making (ignore the error that follows)"
461 @echo
462 exit 1
464 #dummy: ..$(CONFIGURATION)
465 dummy:
467 else
469 dummy:
471 endif
473 include Rules.make
476 # This generates dependencies for the .h files.
479 scripts/mkdep: scripts/mkdep.c
480 $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
482 scripts/split-include: scripts/split-include.c
483 $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c