build a ecoff kernel for Magnums instead of an a.out image for milo
[linux-2.6/linux-mips.git] / Makefile
blob3cf1ac1ea608eb9e919895ddfde97a84e7593d96
1 VERSION = 2
2 PATCHLEVEL = 2
3 SUBLEVEL = 1
4 EXTRAVERSION =
6 ARCH = mips
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
17 HOSTCC = cc
18 HOSTCFLAGS = -O2
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 OBJCOPY =$(CROSS_COMPILE)objcopy
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 ifdef CONFIG_SMP
92 CFLAGS += -D__SMP__
93 AFLAGS += -D__SMP__
94 endif
97 # if you want the RAM disk device, define this to be the
98 # size in blocks.
101 #RAMDISK = -DRAMDISK=512
103 # Include the make variables (CC, etc...)
106 CORE_FILES =kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o
107 FILESYSTEMS =fs/filesystems.a
108 NETWORKS =net/network.a
109 DRIVERS =drivers/block/block.a \
110 drivers/char/char.a \
111 drivers/misc/misc.a
112 LIBS =$(TOPDIR)/lib/lib.a
113 SUBDIRS =kernel drivers mm fs net ipc lib
115 ifdef CONFIG_NUBUS
116 DRIVERS := $(DRIVERS) drivers/nubus/nubus.a
117 endif
119 ifeq ($(CONFIG_ISDN),y)
120 DRIVERS := $(DRIVERS) drivers/isdn/isdn.a
121 endif
123 DRIVERS := $(DRIVERS) drivers/net/net.a
125 ifeq ($(CONFIG_SCSI),y)
126 DRIVERS := $(DRIVERS) drivers/scsi/scsi.a
127 endif
129 ifneq ($(CONFIG_CD_NO_IDESCSI)$(CONFIG_BLK_DEV_IDECD)$(CONFIG_BLK_DEV_SR)$(CONFIG_PARIDE_PCD),)
130 DRIVERS := $(DRIVERS) drivers/cdrom/cdrom.a
131 endif
133 ifeq ($(CONFIG_SOUND),y)
134 DRIVERS := $(DRIVERS) drivers/sound/sound.a
135 endif
137 ifdef CONFIG_PCI
138 DRIVERS := $(DRIVERS) drivers/pci/pci.a
139 endif
141 ifdef CONFIG_DIO
142 DRIVERS := $(DRIVERS) drivers/dio/dio.a
143 endif
145 ifdef CONFIG_SBUS
146 DRIVERS := $(DRIVERS) drivers/sbus/sbus.a
147 endif
149 ifdef CONFIG_ZORRO
150 DRIVERS := $(DRIVERS) drivers/zorro/zorro.a
151 endif
153 ifeq ($(CONFIG_FC4),y)
154 DRIVERS := $(DRIVERS) drivers/fc4/fc4.a
155 endif
157 ifdef CONFIG_PPC
158 DRIVERS := $(DRIVERS) drivers/macintosh/macintosh.a
159 endif
161 ifdef CONFIG_PNP
162 DRIVERS := $(DRIVERS) drivers/pnp/pnp.a
163 endif
165 ifdef CONFIG_SGI
166 DRIVERS := $(DRIVERS) drivers/sgi/sgi.a
167 endif
169 ifdef CONFIG_VT
170 DRIVERS := $(DRIVERS) drivers/video/video.a
171 endif
173 ifeq ($(CONFIG_PARIDE),y)
174 DRIVERS := $(DRIVERS) drivers/block/paride/paride.a
175 endif
177 ifdef CONFIG_HAMRADIO
178 DRIVERS := $(DRIVERS) drivers/net/hamradio/hamradio.a
179 endif
181 ifeq ($(CONFIG_TC),y)
182 DRIVERS := $(DRIVERS) drivers/tc/tc.a
183 endif
185 ifeq ($(CONFIG_USB),y)
186 DRIVERS := $(DRIVERS) drivers/uusbd/usb.a
187 endif
189 ifeq ($(CONFIG_I2O),y)
190 DRIVERS := $(DRIVERS) drivers/i2o/i2o.a
191 endif
193 ifeq ($(CONFIG_IRDA),y)
194 DRIVERS := $(DRIVERS) drivers/net/irda/irda_drivers.a
195 endif
197 include arch/$(ARCH)/Makefile
199 .S.s:
200 $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -E -o $*.s $<
201 .S.o:
202 $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c -o $*.o $<
204 Version: dummy
205 @rm -f include/linux/compile.h
207 boot: vmlinux
208 @$(MAKE) -C arch/$(ARCH)/boot
210 vmlinux: $(CONFIGURATION) init/main.o init/version.o linuxsubdirs
211 $(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o \
212 --start-group \
213 $(CORE_FILES) \
214 $(FILESYSTEMS) \
215 $(NETWORKS) \
216 $(DRIVERS) \
217 $(LIBS) \
218 --end-group \
219 -o vmlinux
220 $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
222 symlinks:
223 rm -f include/asm
224 ( cd include ; ln -sf asm-$(ARCH) asm)
225 @if [ ! -d modules ]; then \
226 mkdir modules; \
228 @if [ ! -d include/linux/modules ]; then \
229 mkdir include/linux/modules; \
232 oldconfig: symlinks scripts/split-include
233 $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
234 if [ -r include/linux/autoconf.h ]; then \
235 scripts/split-include include/linux/autoconf.h include/config; \
238 xconfig: symlinks scripts/split-include
239 $(MAKE) -C scripts kconfig.tk
240 wish -f scripts/kconfig.tk
241 if [ -r include/linux/autoconf.h ]; then \
242 scripts/split-include include/linux/autoconf.h include/config; \
245 menuconfig: include/linux/version.h symlinks scripts/split-include
246 $(MAKE) -C scripts/lxdialog all
247 $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
248 if [ -r include/linux/autoconf.h ]; then \
249 scripts/split-include include/linux/autoconf.h include/config; \
252 config: symlinks scripts/split-include
253 $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
254 if [ -r include/linux/autoconf.h ]; then \
255 scripts/split-include include/linux/autoconf.h include/config; \
258 linuxsubdirs: $(patsubst %, _dir_%, $(SUBDIRS))
260 $(patsubst %, _dir_%, $(SUBDIRS)) : dummy
261 $(MAKE) -C $(patsubst _dir_%, %, $@)
263 $(TOPDIR)/include/linux/version.h: include/linux/version.h
264 $(TOPDIR)/include/linux/compile.h: include/linux/compile.h
266 newversion:
267 @if [ ! -f .version ]; then \
268 echo 1 > .version; \
269 else \
270 expr 0`cat .version` + 1 > .version; \
273 include/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion
274 @echo -n \#define UTS_VERSION \"\#`cat .version` > .ver
275 @if [ -n "$(CONFIG_SMP)" ] ; then echo -n " SMP" >> .ver; fi
276 @if [ -f .name ]; then echo -n \-`cat .name` >> .ver; fi
277 @echo ' '`date`'"' >> .ver
278 @echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
279 @echo \#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
280 @echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> .ver
281 @if [ -x /bin/dnsdomainname ]; then \
282 echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\"; \
283 elif [ -x /bin/domainname ]; then \
284 echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\"; \
285 else \
286 echo \#define LINUX_COMPILE_DOMAIN ; \
287 fi >> .ver
288 @echo \#define LINUX_COMPILER \"`$(CC) $(CFLAGS) -v 2>&1 | tail -1`\" >> .ver
289 @mv -f .ver $@
291 include/linux/version.h: ./Makefile
292 @echo \#define UTS_RELEASE \"$(KERNELRELEASE)\" > .ver
293 @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
294 @echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
295 @mv -f .ver $@
297 init/version.o: init/version.c include/linux/compile.h
298 $(CC) $(CFLAGS) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c
300 init/main.o: init/main.c
301 $(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<
303 fs lib mm ipc kernel drivers net: dummy
304 $(MAKE) $(subst $@, _dir_$@, $@)
306 MODFLAGS += -DMODULE
307 ifdef CONFIG_MODULES
308 ifdef CONFIG_MODVERSIONS
309 MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
310 endif
312 modules: $(patsubst %, _mod_%, $(SUBDIRS))
314 $(patsubst %, _mod_%, $(SUBDIRS)) : include/linux/version.h
315 $(MAKE) -C $(patsubst _mod_%, %, $@) CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules
317 modules_install:
318 @( \
319 MODLIB=$(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE); \
320 cd modules; \
321 MODULES=""; \
322 inst_mod() { These="`cat $$1`"; MODULES="$$MODULES $$These"; \
323 mkdir -p $$MODLIB/$$2; cp $$These $$MODLIB/$$2; \
324 echo Installing modules under $$MODLIB/$$2; \
325 }; \
326 mkdir -p $$MODLIB; \
328 if [ -f BLOCK_MODULES ]; then inst_mod BLOCK_MODULES block; fi; \
329 if [ -f NET_MODULES ]; then inst_mod NET_MODULES net; fi; \
330 if [ -f IPV4_MODULES ]; then inst_mod IPV4_MODULES ipv4; fi; \
331 if [ -f IPV6_MODULES ]; then inst_mod IPV6_MODULES ipv6; fi; \
332 if [ -f SCSI_MODULES ]; then inst_mod SCSI_MODULES scsi; fi; \
333 if [ -f FS_MODULES ]; then inst_mod FS_MODULES fs; fi; \
334 if [ -f NLS_MODULES ]; then inst_mod NLS_MODULES fs; fi; \
335 if [ -f CDROM_MODULES ]; then inst_mod CDROM_MODULES cdrom; fi; \
336 if [ -f HAM_MODULES ]; then inst_mod HAM_MODULES net; fi; \
337 if [ -f SOUND_MODULES ]; then inst_mod SOUND_MODULES sound; fi; \
338 if [ -f VIDEO_MODULES ]; then inst_mod VIDEO_MODULES video; fi; \
339 if [ -f FC4_MODULES ]; then inst_mod FC4_MODULES fc4; fi; \
340 if [ -f IRDA_MODULES ]; then inst_mod IRDA_MODULES net; fi; \
342 ls *.o > $$MODLIB/.allmods; \
343 echo $$MODULES | tr ' ' '\n' | sort | comm -23 $$MODLIB/.allmods - > $$MODLIB/.misc; \
344 if [ -s $$MODLIB/.misc ]; then inst_mod $$MODLIB/.misc misc; fi; \
345 rm -f $$MODLIB/.misc $$MODLIB/.allmods; \
348 # modules disabled....
350 else
351 modules modules_install: dummy
352 @echo
353 @echo "The present kernel configuration has modules disabled."
354 @echo "Type 'make config' and enable loadable module support."
355 @echo "Then build a kernel with module support enabled."
356 @echo
357 @exit 1
358 endif
360 clean: archclean
361 rm -f kernel/ksyms.lst include/linux/compile.h
362 rm -f core `find . -name '*.[oas]' ! -regex '.*lxdialog/.*' -print`
363 rm -f core `find . -type f -name 'core' -print`
364 rm -f core `find . -name '.*.flags' -print`
365 rm -f vmlinux System.map
366 rm -f .tmp*
367 rm -f drivers/char/consolemap_deftbl.c drivers/video/promcon_tbl.c
368 rm -f drivers/char/conmakehash
369 rm -f drivers/sound/bin2hex drivers/sound/hex2hex
370 if [ -d modules ]; then \
371 rm -f core `find modules/ -type f -print`; \
373 rm -f submenu*
375 mrproper: clean archmrproper
376 rm -f include/linux/autoconf.h include/linux/version.h
377 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk1200,afsk2666,fsk9600}.h
378 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{hapn4800,psk4800}.h
379 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk2400_7,afsk2400_8}.h
380 rm -f drivers/net/hamradio/soundmodem/gentbl
381 rm -f drivers/char/hfmodem/gentbl drivers/char/hfmodem/tables.h
382 rm -f drivers/sound/*_boot.h drivers/sound/.*.boot
383 rm -f .version .config* config.in config.old
384 rm -f scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp
385 rm -f scripts/lxdialog/*.o scripts/lxdialog/lxdialog
386 rm -f .menuconfig.log
387 rm -f include/asm
388 rm -rf include/config
389 rm -f .depend `find . -name .depend -print`
390 rm -f core `find . -size 0 -print`
391 rm -f .hdepend scripts/mkdep scripts/split-include
392 rm -f $(TOPDIR)/include/linux/modversions.h
393 rm -rf $(TOPDIR)/include/linux/modules
394 rm -rf modules
396 distclean: mrproper
397 find . -type f \( -name core -o -name '*.orig' -o -name '*.rej' \
398 -o -name '*~' -o -name '*.bak' -o -name '#*#' \
399 -o -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' \
400 -o -size 0 -o -name TAGS \) -print | env -i xargs rm -f
402 backup: mrproper
403 cd .. && tar cf - linux/ | gzip -9 > backup.gz
404 sync
406 sums:
407 find . -type f -print | sort | env -i xargs sum > .SUMS
409 dep-files: scripts/mkdep archdep include/linux/version.h
410 scripts/mkdep init/*.c > .depend
411 find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print | env -i PATH="$(PATH)" HPATH="$(HPATH)" xargs scripts/mkdep > .hdepend
412 # set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i fastdep; done
413 # let this be made through the fastdep rule in Rules.make
414 $(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) _FASTDEP_ALL_SUB_DIRS="$(SUBDIRS)"
416 MODVERFILE :=
418 ifdef CONFIG_MODVERSIONS
419 MODVERFILE := $(TOPDIR)/include/linux/modversions.h
420 endif
422 depend dep: dep-files $(MODVERFILE)
424 # make checkconfig: Prune 'scripts' directory to avoid "false positives".
425 checkconfig:
426 perl -w scripts/checkconfig.pl `find * -path 'scripts' -prune -o -name '*.[hcS]' -print | sort`
428 checkhelp:
429 perl -w scripts/checkhelp.pl `find * -name [cC]onfig.in -print`
431 ifdef CONFIGURATION
432 ..$(CONFIGURATION):
433 @echo
434 @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
435 @echo
436 $(MAKE) $(CONFIGURATION)
437 @echo
438 @echo "Successful. Try re-making (ignore the error that follows)"
439 @echo
440 exit 1
442 #dummy: ..$(CONFIGURATION)
443 dummy:
445 else
447 dummy:
449 endif
451 include Rules.make
454 # This generates dependencies for the .h files.
457 scripts/mkdep: scripts/mkdep.c
458 $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
460 scripts/split-include: scripts/split-include.c
461 $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c