Import 2.1.116pre1
[davej-history.git] / Makefile
blob62981e9d300e6532bf35208c45f8cb7e9ef2c1f2
1 VERSION = 2
2 PATCHLEVEL = 1
3 SUBLEVEL = 116
5 ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
8 # For SMP kernels, set this. We don't want to have this in the config file
9 # because it makes re-config very ugly and too many fundamental files depend
10 # on "CONFIG_SMP"
12 # For UP operations COMMENT THIS OUT, simply setting SMP = 0 won't work
14 SMP = 1
16 .EXPORT_ALL_VARIABLES:
18 CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
19 else if [ -x /bin/bash ]; then echo /bin/bash; \
20 else echo sh; fi ; fi)
21 TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
23 HPATH = $(TOPDIR)/include
24 FINDHPATH = $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net
26 HOSTCC =gcc
27 HOSTCFLAGS =-Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
29 CROSS_COMPILE =
31 AS =$(CROSS_COMPILE)as
32 LD =$(CROSS_COMPILE)ld
33 CC =$(CROSS_COMPILE)gcc -D__KERNEL__ -I$(HPATH)
34 CPP =$(CC) -E
35 AR =$(CROSS_COMPILE)ar
36 NM =$(CROSS_COMPILE)nm
37 STRIP =$(CROSS_COMPILE)strip
38 MAKE =make
39 GENKSYMS=/sbin/genksyms
41 all: do-it-all
44 # Make "config" the default target if there is no configuration file or
45 # "depend" the target if there is no top-level dependency information.
47 ifeq (.config,$(wildcard .config))
48 include .config
49 ifeq (.depend,$(wildcard .depend))
50 include .depend
51 do-it-all: Version vmlinux
52 else
53 CONFIGURATION = depend
54 do-it-all: depend
55 endif
56 else
57 CONFIGURATION = config
58 do-it-all: config
59 endif
62 # ROOT_DEV specifies the default root-device when making the image.
63 # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
64 # the default of FLOPPY is used by 'build'.
67 ROOT_DEV = CURRENT
70 # INSTALL_PATH specifies where to place the updated kernel and system map
71 # images. Uncomment if you want to place them anywhere other than root.
73 #INSTALL_PATH=/boot
76 # If you want to preset the SVGA mode, uncomment the next line and
77 # set SVGA_MODE to whatever number you want.
78 # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
79 # The number is the same as you would ordinarily press at bootup.
82 SVGA_MODE= -DSVGA_MODE=NORMAL_VGA
85 # standard CFLAGS
88 CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
90 ifdef SMP
91 CFLAGS += -D__SMP__
92 AFLAGS += -D__SMP__
93 endif
96 # if you want the RAM disk device, define this to be the
97 # size in blocks.
100 #RAMDISK = -DRAMDISK=512
102 # Include the make variables (CC, etc...)
105 CORE_FILES =kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o
106 FILESYSTEMS =fs/filesystems.a
107 NETWORKS =net/network.a
108 DRIVERS =drivers/block/block.a \
109 drivers/char/char.a \
110 drivers/misc/misc.a
111 LIBS =$(TOPDIR)/lib/lib.a
112 SUBDIRS =kernel drivers mm fs net ipc lib
114 ifdef CONFIG_NUBUS
115 DRIVERS := $(DRIVERS) drivers/nubus/nubus.a
116 endif
118 ifeq ($(CONFIG_ISDN),y)
119 DRIVERS := $(DRIVERS) drivers/isdn/isdn.a
120 endif
122 DRIVERS := $(DRIVERS) drivers/net/net.a
124 ifeq ($(CONFIG_SCSI),y)
125 DRIVERS := $(DRIVERS) drivers/scsi/scsi.a
126 endif
128 ifneq ($(CONFIG_CD_NO_IDESCSI)$(CONFIG_BLK_DEV_IDECD)$(CONFIG_BLK_DEV_SR),)
129 DRIVERS := $(DRIVERS) drivers/cdrom/cdrom.a
130 endif
132 ifeq ($(CONFIG_SOUND),y)
133 DRIVERS := $(DRIVERS) drivers/sound/sound.a
134 endif
136 ifdef CONFIG_PCI
137 DRIVERS := $(DRIVERS) drivers/pci/pci.a
138 endif
140 ifdef CONFIG_DIO
141 DRIVERS := $(DRIVERS) drivers/dio/dio.a
142 endif
144 ifdef CONFIG_SBUS
145 DRIVERS := $(DRIVERS) drivers/sbus/sbus.a
146 endif
148 ifdef CONFIG_ZORRO
149 DRIVERS := $(DRIVERS) drivers/zorro/zorro.a
150 endif
152 ifdef CONFIG_PPC
153 DRIVERS := $(DRIVERS) drivers/macintosh/macintosh.a
154 endif
156 ifdef CONFIG_PNP
157 DRIVERS := $(DRIVERS) drivers/pnp/pnp.a
158 endif
160 ifdef CONFIG_VT
161 DRIVERS := $(DRIVERS) drivers/video/video.a
162 endif
164 ifeq ($(CONFIG_PARIDE),y)
165 DRIVERS := $(DRIVERS) drivers/block/paride/paride.a
166 endif
168 ifdef CONFIG_HAMRADIO
169 DRIVERS := $(DRIVERS) drivers/net/hamradio/hamradio.a
170 endif
172 include arch/$(ARCH)/Makefile
174 .S.s:
175 $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -E -o $*.s $<
176 .S.o:
177 $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c -o $*.o $<
179 Version: dummy
180 @rm -f include/linux/compile.h
182 boot: vmlinux
183 @$(MAKE) -C arch/$(ARCH)/boot
185 vmlinux: $(CONFIGURATION) init/main.o init/version.o linuxsubdirs
186 $(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o \
187 $(CORE_FILES) \
188 $(FILESYSTEMS) \
189 $(NETWORKS) \
190 $(DRIVERS) \
191 $(LIBS) \
192 -o vmlinux
193 $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
195 symlinks:
196 rm -f include/asm
197 ( cd include ; ln -sf asm-$(ARCH) asm)
198 @if [ ! -d modules ]; then \
199 mkdir modules; \
201 @if [ ! -d include/linux/modules ]; then \
202 mkdir include/linux/modules; \
205 oldconfig: symlinks scripts/split-include
206 $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
207 if [ -r include/linux/autoconf.h ]; then \
208 scripts/split-include include/linux/autoconf.h include/config; \
211 xconfig: symlinks scripts/split-include
212 $(MAKE) -C scripts kconfig.tk
213 wish -f scripts/kconfig.tk
214 if [ -r include/linux/autoconf.h ]; then \
215 scripts/split-include include/linux/autoconf.h include/config; \
218 menuconfig: include/linux/version.h symlinks scripts/split-include
219 $(MAKE) -C scripts/lxdialog all
220 $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
221 if [ -r include/linux/autoconf.h ]; then \
222 scripts/split-include include/linux/autoconf.h include/config; \
225 config: symlinks scripts/split-include
226 $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
227 if [ -r include/linux/autoconf.h ]; then \
228 scripts/split-include include/linux/autoconf.h include/config; \
231 linuxsubdirs: dummy
232 set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done
234 $(TOPDIR)/include/linux/version.h: include/linux/version.h
235 $(TOPDIR)/include/linux/compile.h: include/linux/compile.h
237 newversion:
238 @if [ ! -f .version ]; then \
239 echo 1 > .version; \
240 else \
241 expr 0`cat .version` + 1 > .version; \
244 include/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion
245 @echo -n \#define UTS_VERSION \"\#`cat .version` > .ver
246 @if [ -n "$(SMP)" ] ; then echo -n " SMP" >> .ver; fi
247 @if [ -f .name ]; then echo -n \-`cat .name` >> .ver; fi
248 @echo ' '`date`'"' >> .ver
249 @echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
250 @echo \#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
251 @echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> .ver
252 @if [ -x /bin/dnsdomainname ]; then \
253 echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\"; \
254 elif [ -x /bin/domainname ]; then \
255 echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\"; \
256 else \
257 echo \#define LINUX_COMPILE_DOMAIN ; \
258 fi >> .ver
259 @echo \#define LINUX_COMPILER \"`$(CC) -v 2>&1 | tail -1`\" >> .ver
260 @mv -f .ver $@
262 include/linux/version.h: ./Makefile
263 @echo \#define UTS_RELEASE \"$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)\" > .ver
264 @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
265 @echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
266 @mv -f .ver $@
268 init/version.o: init/version.c include/linux/compile.h
269 $(CC) $(CFLAGS) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c
271 init/main.o: init/main.c
272 $(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<
274 fs: dummy
275 $(MAKE) linuxsubdirs SUBDIRS=fs
277 lib: dummy
278 $(MAKE) linuxsubdirs SUBDIRS=lib
280 mm: dummy
281 $(MAKE) linuxsubdirs SUBDIRS=mm
283 ipc: dummy
284 $(MAKE) linuxsubdirs SUBDIRS=ipc
286 kernel: dummy
287 $(MAKE) linuxsubdirs SUBDIRS=kernel
289 drivers: dummy
290 $(MAKE) linuxsubdirs SUBDIRS=drivers
292 net: dummy
293 $(MAKE) linuxsubdirs SUBDIRS=net
295 MODFLAGS = -DMODULE
296 ifdef CONFIG_MODULES
297 ifdef CONFIG_MODVERSIONS
298 MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
299 endif
301 modules: include/linux/version.h
302 @set -e; \
303 for i in $(SUBDIRS); \
304 do $(MAKE) -C $$i CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules; \
305 done
307 modules_install:
308 @( \
309 MODLIB=/lib/modules/$(VERSION).$(PATCHLEVEL).$(SUBLEVEL); \
310 cd modules; \
311 MODULES=""; \
312 inst_mod() { These="`cat $$1`"; MODULES="$$MODULES $$These"; \
313 mkdir -p $$MODLIB/$$2; cp $$These $$MODLIB/$$2; \
314 echo Installing modules under $$MODLIB/$$2; \
315 }; \
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; \
330 ls *.o > .allmods; \
331 echo $$MODULES | tr ' ' '\n' | sort | comm -23 .allmods - > .misc; \
332 if [ -s .misc ]; then inst_mod .misc misc; fi; \
333 rm -f .misc .allmods; \
336 # modules disabled....
338 else
339 modules modules_install: dummy
340 @echo
341 @echo "The present kernel configuration has modules disabled."
342 @echo "Type 'make config' and enable loadable module support."
343 @echo "Then build a kernel with module support enabled."
344 @echo
345 @exit 1
346 endif
348 clean: archclean
349 rm -f kernel/ksyms.lst include/linux/compile.h
350 rm -f core `find . -name '*.[oas]' ! -regex '.*lxdialog/.*' -print`
351 rm -f core `find . -type f -name 'core' -print`
352 rm -f core `find . -name '.*.flags' -print`
353 rm -f vmlinux System.map
354 rm -f .tmp*
355 rm -f drivers/char/consolemap_deftbl.c drivers/video/promcon_tbl.c
356 rm -f drivers/char/conmakehash
357 rm -f drivers/sound/bin2hex drivers/sound/hex2hex
358 if [ -d modules ]; then \
359 rm -f core `find modules/ -type f -print`; \
361 rm -f submenu*
363 mrproper: clean archmrproper
364 rm -f include/linux/autoconf.h include/linux/version.h
365 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk1200,afsk2666,fsk9600}.h
366 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{hapn4800,psk4800}.h
367 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk2400_7,afsk2400_8}.h
368 rm -f drivers/net/hamradio/soundmodem/gentbl
369 rm -f drivers/char/hfmodem/gentbl drivers/char/hfmodem/tables.h
370 rm -f drivers/sound/*_boot.h drivers/sound/.*.boot
371 rm -f .version .config* config.in config.old
372 rm -f scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp
373 rm -f scripts/lxdialog/*.o scripts/lxdialog/lxdialog
374 rm -f .menuconfig.log
375 rm -f include/asm
376 rm -rf include/config
377 rm -f .depend `find . -name .depend -print`
378 rm -f core `find . -size 0 -print`
379 rm -f .hdepend scripts/mkdep scripts/split-include
380 rm -f $(TOPDIR)/include/linux/modversions.h
381 rm -rf $(TOPDIR)/include/linux/modules
382 rm -rf modules
384 distclean: mrproper
385 rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
386 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
387 -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print` TAGS
389 backup: mrproper
390 cd .. && tar cf - linux/ | gzip -9 > backup.gz
391 sync
393 sums:
394 find . -type f -print | sort | xargs sum > .SUMS
396 dep-files: scripts/mkdep archdep include/linux/version.h
397 scripts/mkdep init/*.c > .depend
398 scripts/mkdep `find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print` > .hdepend
399 set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i fastdep; done
401 MODVERFILE :=
403 ifdef CONFIG_MODVERSIONS
404 MODVERFILE := $(TOPDIR)/include/linux/modversions.h
405 endif
407 depend dep: dep-files $(MODVERFILE)
409 checkconfig:
410 perl -w scripts/checkconfig.pl `find * -name '*.[hcS]' -print | sort`
412 ifdef CONFIGURATION
413 ..$(CONFIGURATION):
414 @echo
415 @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
416 @echo
417 $(MAKE) $(CONFIGURATION)
418 @echo
419 @echo "Successful. Try re-making (ignore the error that follows)"
420 @echo
421 exit 1
423 #dummy: ..$(CONFIGURATION)
424 dummy:
426 else
428 dummy:
430 endif
432 include Rules.make
435 # This generates dependencies for the .h files.
438 scripts/mkdep: scripts/mkdep.c
439 $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
441 scripts/split-include: scripts/split-include.c
442 $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c