Import 2.1.133pre5
[davej-history.git] / Makefile
blobb244ba9e0ea7eb8d4af0055e4fe1bc08375242d3
1 VERSION = 2
2 PATCHLEVEL = 1
3 SUBLEVEL = 133
5 ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
7 .EXPORT_ALL_VARIABLES:
9 CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
10 else if [ -x /bin/bash ]; then echo /bin/bash; \
11 else echo sh; fi ; fi)
12 TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
14 HPATH = $(TOPDIR)/include
15 FINDHPATH = $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net
17 HOSTCC =gcc
18 HOSTCFLAGS =-Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
20 CROSS_COMPILE =
22 AS =$(CROSS_COMPILE)as
23 LD =$(CROSS_COMPILE)ld
24 CC =$(CROSS_COMPILE)gcc -D__KERNEL__ -I$(HPATH)
25 CPP =$(CC) -E
26 AR =$(CROSS_COMPILE)ar
27 NM =$(CROSS_COMPILE)nm
28 STRIP =$(CROSS_COMPILE)strip
29 OBJDUMP =$(CROSS_COMPILE)objdump
30 MAKE =make
31 GENKSYMS=/sbin/genksyms
33 all: do-it-all
36 # Make "config" the default target if there is no configuration file or
37 # "depend" the target if there is no top-level dependency information.
39 ifeq (.config,$(wildcard .config))
40 include .config
41 ifeq (.depend,$(wildcard .depend))
42 include .depend
43 do-it-all: Version vmlinux
44 else
45 CONFIGURATION = depend
46 do-it-all: depend
47 endif
48 else
49 CONFIGURATION = config
50 do-it-all: config
51 endif
54 # ROOT_DEV specifies the default root-device when making the image.
55 # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
56 # the default of FLOPPY is used by 'build'.
59 ROOT_DEV = CURRENT
62 # INSTALL_PATH specifies where to place the updated kernel and system map
63 # images. Uncomment if you want to place them anywhere other than root.
65 #INSTALL_PATH=/boot
68 # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
69 # relocations required by build roots. This is not defined in the
70 # makefile but the arguement can be passed to make if needed.
74 # If you want to preset the SVGA mode, uncomment the next line and
75 # set SVGA_MODE to whatever number you want.
76 # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
77 # The number is the same as you would ordinarily press at bootup.
80 SVGA_MODE= -DSVGA_MODE=NORMAL_VGA
83 # standard CFLAGS
86 CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
88 ifdef CONFIG_SMP
89 CFLAGS += -D__SMP__
90 AFLAGS += -D__SMP__
91 endif
94 # if you want the RAM disk device, define this to be the
95 # size in blocks.
98 #RAMDISK = -DRAMDISK=512
100 # Include the make variables (CC, etc...)
103 CORE_FILES =kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o
104 FILESYSTEMS =fs/filesystems.a
105 NETWORKS =net/network.a
106 DRIVERS =drivers/block/block.a \
107 drivers/char/char.a \
108 drivers/misc/misc.a
109 LIBS =$(TOPDIR)/lib/lib.a
110 SUBDIRS =kernel drivers mm fs net ipc lib
112 ifdef CONFIG_NUBUS
113 DRIVERS := $(DRIVERS) drivers/nubus/nubus.a
114 endif
116 ifeq ($(CONFIG_ISDN),y)
117 DRIVERS := $(DRIVERS) drivers/isdn/isdn.a
118 endif
120 DRIVERS := $(DRIVERS) drivers/net/net.a
122 ifeq ($(CONFIG_SCSI),y)
123 DRIVERS := $(DRIVERS) drivers/scsi/scsi.a
124 endif
126 ifneq ($(CONFIG_CD_NO_IDESCSI)$(CONFIG_BLK_DEV_IDECD)$(CONFIG_BLK_DEV_SR)$(CONFIG_PARIDE_PCD),)
127 DRIVERS := $(DRIVERS) drivers/cdrom/cdrom.a
128 endif
130 ifeq ($(CONFIG_SOUND),y)
131 DRIVERS := $(DRIVERS) drivers/sound/sound.a
132 endif
134 ifdef CONFIG_PCI
135 DRIVERS := $(DRIVERS) drivers/pci/pci.a
136 endif
138 ifdef CONFIG_DIO
139 DRIVERS := $(DRIVERS) drivers/dio/dio.a
140 endif
142 ifdef CONFIG_SBUS
143 DRIVERS := $(DRIVERS) drivers/sbus/sbus.a
144 endif
146 ifdef CONFIG_ZORRO
147 DRIVERS := $(DRIVERS) drivers/zorro/zorro.a
148 endif
150 ifeq ($(CONFIG_FC4),y)
151 DRIVERS := $(DRIVERS) drivers/fc4/fc4.a
152 endif
154 ifdef CONFIG_PPC
155 DRIVERS := $(DRIVERS) drivers/macintosh/macintosh.a
156 endif
158 ifdef CONFIG_PNP
159 DRIVERS := $(DRIVERS) drivers/pnp/pnp.a
160 endif
162 ifdef CONFIG_VT
163 DRIVERS := $(DRIVERS) drivers/video/video.a
164 endif
166 ifeq ($(CONFIG_PARIDE),y)
167 DRIVERS := $(DRIVERS) drivers/block/paride/paride.a
168 endif
170 ifdef CONFIG_HAMRADIO
171 DRIVERS := $(DRIVERS) drivers/net/hamradio/hamradio.a
172 endif
174 ifeq ($(CONFIG_USB),y)
175 DRIVERS := $(DRIVERS) drivers/uusbd/usb.a
176 endif
178 ifeq ($(CONFIG_I2O),y)
179 DRIVERS := $(DRIVERS) drivers/i2o/i2o.a
180 endif
182 ifeq ($(CONFIG_IRDA),y)
183 DRIVERS := $(DRIVERS) drivers/net/irda/irda_drivers.a
184 endif
186 include arch/$(ARCH)/Makefile
188 .S.s:
189 $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -E -o $*.s $<
190 .S.o:
191 $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c -o $*.o $<
193 Version: dummy
194 @rm -f include/linux/compile.h
196 boot: vmlinux
197 @$(MAKE) -C arch/$(ARCH)/boot
199 vmlinux: $(CONFIGURATION) init/main.o init/version.o linuxsubdirs
200 $(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o \
201 --start-group \
202 $(CORE_FILES) \
203 $(FILESYSTEMS) \
204 $(NETWORKS) \
205 $(DRIVERS) \
206 $(LIBS) \
207 --end-group \
208 -o vmlinux
209 $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
211 symlinks:
212 rm -f include/asm
213 ( cd include ; ln -sf asm-$(ARCH) asm)
214 @if [ ! -d modules ]; then \
215 mkdir modules; \
217 @if [ ! -d include/linux/modules ]; then \
218 mkdir include/linux/modules; \
221 oldconfig: symlinks scripts/split-include
222 $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
223 if [ -r include/linux/autoconf.h ]; then \
224 scripts/split-include include/linux/autoconf.h include/config; \
227 xconfig: symlinks scripts/split-include
228 $(MAKE) -C scripts kconfig.tk
229 wish -f scripts/kconfig.tk
230 if [ -r include/linux/autoconf.h ]; then \
231 scripts/split-include include/linux/autoconf.h include/config; \
234 menuconfig: include/linux/version.h symlinks scripts/split-include
235 $(MAKE) -C scripts/lxdialog all
236 $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
237 if [ -r include/linux/autoconf.h ]; then \
238 scripts/split-include include/linux/autoconf.h include/config; \
241 config: symlinks scripts/split-include
242 $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
243 if [ -r include/linux/autoconf.h ]; then \
244 scripts/split-include include/linux/autoconf.h include/config; \
247 linuxsubdirs: $(patsubst %, _dir_%, $(SUBDIRS))
249 $(patsubst %, _dir_%, $(SUBDIRS)) : dummy
250 $(MAKE) -C $(patsubst _dir_%, %, $@)
252 $(TOPDIR)/include/linux/version.h: include/linux/version.h
253 $(TOPDIR)/include/linux/compile.h: include/linux/compile.h
255 newversion:
256 @if [ ! -f .version ]; then \
257 echo 1 > .version; \
258 else \
259 expr 0`cat .version` + 1 > .version; \
262 include/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion
263 @echo -n \#define UTS_VERSION \"\#`cat .version` > .ver
264 @if [ -n "$(CONFIG_SMP)" ] ; then echo -n " SMP" >> .ver; fi
265 @if [ -f .name ]; then echo -n \-`cat .name` >> .ver; fi
266 @echo ' '`date`'"' >> .ver
267 @echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
268 @echo \#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
269 @echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> .ver
270 @if [ -x /bin/dnsdomainname ]; then \
271 echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\"; \
272 elif [ -x /bin/domainname ]; then \
273 echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\"; \
274 else \
275 echo \#define LINUX_COMPILE_DOMAIN ; \
276 fi >> .ver
277 @echo \#define LINUX_COMPILER \"`$(CC) -v 2>&1 | tail -1`\" >> .ver
278 @mv -f .ver $@
280 include/linux/version.h: ./Makefile
281 @echo \#define UTS_RELEASE \"$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)\" > .ver
282 @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
283 @echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
284 @mv -f .ver $@
286 init/version.o: init/version.c include/linux/compile.h
287 $(CC) $(CFLAGS) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c
289 init/main.o: init/main.c
290 $(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<
292 fs lib mm ipc kernel drivers net: dummy
293 $(MAKE) $(subst $@, _dir_$@, $@)
295 MODFLAGS = -DMODULE
296 ifdef CONFIG_MODULES
297 ifdef CONFIG_MODVERSIONS
298 MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
299 endif
301 modules: $(patsubst %, _mod_%, $(SUBDIRS))
303 $(patsubst %, _mod_%, $(SUBDIRS)) : include/linux/version.h
304 $(MAKE) -C $(patsubst _mod_%, %, $@) CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules
306 modules_install:
307 @( \
308 MODLIB=$(INSTALL_MOD_PATH)/lib/modules/$(VERSION).$(PATCHLEVEL).$(SUBLEVEL); \
309 cd modules; \
310 MODULES=""; \
311 inst_mod() { These="`cat $$1`"; MODULES="$$MODULES $$These"; \
312 mkdir -p $$MODLIB/$$2; cp $$These $$MODLIB/$$2; \
313 echo Installing modules under $$MODLIB/$$2; \
314 }; \
315 mkdir -p $$MODLIB; \
317 if [ -f BLOCK_MODULES ]; then inst_mod BLOCK_MODULES block; fi; \
318 if [ -f NET_MODULES ]; then inst_mod NET_MODULES net; fi; \
319 if [ -f IPV4_MODULES ]; then inst_mod IPV4_MODULES ipv4; fi; \
320 if [ -f IPV6_MODULES ]; then inst_mod IPV6_MODULES ipv6; fi; \
321 if [ -f SCSI_MODULES ]; then inst_mod SCSI_MODULES scsi; fi; \
322 if [ -f FS_MODULES ]; then inst_mod FS_MODULES fs; fi; \
323 if [ -f NLS_MODULES ]; then inst_mod NLS_MODULES fs; fi; \
324 if [ -f CDROM_MODULES ]; then inst_mod CDROM_MODULES cdrom; fi; \
325 if [ -f HAM_MODULES ]; then inst_mod HAM_MODULES net; fi; \
326 if [ -f SOUND_MODULES ]; then inst_mod SOUND_MODULES sound; fi; \
327 if [ -f VIDEO_MODULES ]; then inst_mod VIDEO_MODULES video; fi; \
328 if [ -f FC4_MODULES ]; then inst_mod FC4_MODULES fc4; fi; \
329 if [ -f IRDA_MODULES ]; then inst_mod IRDA_MODULES net; fi; \
331 ls *.o > $$MODLIB/.allmods; \
332 echo $$MODULES | tr ' ' '\n' | sort | comm -23 $$MODLIB/.allmods - > $$MODLIB/.misc; \
333 if [ -s $$MODLIB/.misc ]; then inst_mod $$MODLIB/.misc misc; fi; \
334 rm -f $$MODLIB/.misc $$MODLIB/.allmods; \
337 # modules disabled....
339 else
340 modules modules_install: dummy
341 @echo
342 @echo "The present kernel configuration has modules disabled."
343 @echo "Type 'make config' and enable loadable module support."
344 @echo "Then build a kernel with module support enabled."
345 @echo
346 @exit 1
347 endif
349 clean: archclean
350 rm -f kernel/ksyms.lst include/linux/compile.h
351 rm -f core `find . -name '*.[oas]' ! -regex '.*lxdialog/.*' -print`
352 rm -f core `find . -type f -name 'core' -print`
353 rm -f core `find . -name '.*.flags' -print`
354 rm -f vmlinux System.map
355 rm -f .tmp*
356 rm -f drivers/char/consolemap_deftbl.c drivers/video/promcon_tbl.c
357 rm -f drivers/char/conmakehash
358 rm -f drivers/sound/bin2hex drivers/sound/hex2hex
359 if [ -d modules ]; then \
360 rm -f core `find modules/ -type f -print`; \
362 rm -f submenu*
364 mrproper: clean archmrproper
365 rm -f include/linux/autoconf.h include/linux/version.h
366 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk1200,afsk2666,fsk9600}.h
367 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{hapn4800,psk4800}.h
368 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk2400_7,afsk2400_8}.h
369 rm -f drivers/net/hamradio/soundmodem/gentbl
370 rm -f drivers/char/hfmodem/gentbl drivers/char/hfmodem/tables.h
371 rm -f drivers/sound/*_boot.h drivers/sound/.*.boot
372 rm -f .version .config* config.in config.old
373 rm -f scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp
374 rm -f scripts/lxdialog/*.o scripts/lxdialog/lxdialog
375 rm -f .menuconfig.log
376 rm -f include/asm
377 rm -rf include/config
378 rm -f .depend `find . -name .depend -print`
379 rm -f core `find . -size 0 -print`
380 rm -f .hdepend scripts/mkdep scripts/split-include
381 rm -f $(TOPDIR)/include/linux/modversions.h
382 rm -rf $(TOPDIR)/include/linux/modules
383 rm -rf modules
385 distclean: mrproper
386 rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
387 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
388 -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print` TAGS
390 backup: mrproper
391 cd .. && tar cf - linux/ | gzip -9 > backup.gz
392 sync
394 sums:
395 find . -type f -print | sort | xargs sum > .SUMS
397 dep-files: scripts/mkdep archdep include/linux/version.h
398 scripts/mkdep init/*.c > .depend
399 scripts/mkdep `find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print` > .hdepend
400 # set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i fastdep ;done
401 # let this be made through the fastdep rule in Rules.make
402 $(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) _FASTDEP_ALL_SUB_DIRS="$(SUBDIRS)"
404 MODVERFILE :=
406 ifdef CONFIG_MODVERSIONS
407 MODVERFILE := $(TOPDIR)/include/linux/modversions.h
408 endif
410 depend dep: dep-files $(MODVERFILE)
412 checkconfig:
413 perl -w scripts/checkconfig.pl `find * -name '*.[hcS]' -print | sort`
415 checkhelp:
416 perl -w scripts/checkhelp.pl `find * -name [cC]onfig.in -print`
418 ifdef CONFIGURATION
419 ..$(CONFIGURATION):
420 @echo
421 @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
422 @echo
423 $(MAKE) $(CONFIGURATION)
424 @echo
425 @echo "Successful. Try re-making (ignore the error that follows)"
426 @echo
427 exit 1
429 #dummy: ..$(CONFIGURATION)
430 dummy:
432 else
434 dummy:
436 endif
438 include Rules.make
441 # This generates dependencies for the .h files.
444 scripts/mkdep: scripts/mkdep.c
445 $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
447 scripts/split-include: scripts/split-include.c
448 $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c