Import 2.1.81
[davej-history.git] / Makefile
blobcbd64778738ce9674507d69daeae49904940868c
1 VERSION = 2
2 PATCHLEVEL = 1
3 SUBLEVEL = 81
5 ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/)
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 # NOTE! SMP is experimental. See the file Documentation/SMP.txt
14 SMP = 1
16 # SMP profiling options
17 # SMP_PROF = 1
19 .EXPORT_ALL_VARIABLES:
21 CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
22 else if [ -x /bin/bash ]; then echo /bin/bash; \
23 else echo sh; fi ; fi)
24 TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
26 HPATH = $(TOPDIR)/include
27 FINDHPATH = $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net
29 HOSTCC =gcc
30 HOSTCFLAGS =-O2 -fomit-frame-pointer
32 CROSS_COMPILE =
34 AS =$(CROSS_COMPILE)as
35 LD =$(CROSS_COMPILE)ld
36 CC =$(CROSS_COMPILE)gcc -D__KERNEL__ -I$(HPATH)
37 CPP =$(CC) -E
38 AR =$(CROSS_COMPILE)ar
39 NM =$(CROSS_COMPILE)nm
40 STRIP =$(CROSS_COMPILE)strip
41 MAKE =make
42 GENKSYMS=/sbin/genksyms
44 all: do-it-all
47 # Make "config" the default target if there is no configuration file or
48 # "depend" the target if there is no top-level dependency information.
50 ifeq (.config,$(wildcard .config))
51 include .config
52 ifeq (.depend,$(wildcard .depend))
53 include .depend
54 do-it-all: Version vmlinux
55 else
56 CONFIGURATION = depend
57 do-it-all: depend
58 endif
59 else
60 CONFIGURATION = config
61 do-it-all: config
62 endif
65 # ROOT_DEV specifies the default root-device when making the image.
66 # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
67 # the default of FLOPPY is used by 'build'.
70 ROOT_DEV = CURRENT
73 # INSTALL_PATH specifies where to place the updated kernel and system map
74 # images. Uncomment if you want to place them anywhere other than root.
76 #INSTALL_PATH=/boot
79 # If you want to preset the SVGA mode, uncomment the next line and
80 # set SVGA_MODE to whatever number you want.
81 # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
82 # The number is the same as you would ordinarily press at bootup.
85 SVGA_MODE= -DSVGA_MODE=NORMAL_VGA
88 # standard CFLAGS
91 CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
93 ifdef CONFIG_CPP
94 CFLAGS := $(CFLAGS) -x c++
95 endif
97 ifdef SMP
98 CFLAGS += -D__SMP__
99 AFLAGS += -D__SMP__
101 ifdef SMP_PROF
102 CFLAGS += -D__SMP_PROF__
103 AFLAGS += -D__SMP_PROF__
104 endif
105 endif
108 # if you want the ram-disk device, define this to be the
109 # size in blocks.
112 #RAMDISK = -DRAMDISK=512
114 # Include the make variables (CC, etc...)
117 CORE_FILES =kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o
118 FILESYSTEMS =fs/filesystems.a
119 NETWORKS =net/network.a
120 DRIVERS =drivers/block/block.a \
121 drivers/char/char.a \
122 drivers/misc/misc.a
123 LIBS =$(TOPDIR)/lib/lib.a
124 SUBDIRS =kernel drivers mm fs net ipc lib
126 ifeq ($(CONFIG_ISDN),y)
127 DRIVERS := $(DRIVERS) drivers/isdn/isdn.a
128 endif
130 DRIVERS := $(DRIVERS) drivers/net/net.a
132 ifeq ($(CONFIG_SCSI),y)
133 DRIVERS := $(DRIVERS) drivers/scsi/scsi.a
134 endif
136 ifneq ($(CONFIG_CD_NO_IDESCSI)$(CONFIG_BLK_DEV_IDECD)$(CONFIG_BLK_DEV_SR),)
137 DRIVERS := $(DRIVERS) drivers/cdrom/cdrom.a
138 endif
140 ifeq ($(CONFIG_SOUND),y)
141 DRIVERS := $(DRIVERS) drivers/sound/sound.a
142 endif
144 ifdef CONFIG_PCI
145 DRIVERS := $(DRIVERS) drivers/pci/pci.a
146 endif
148 ifdef CONFIG_SBUS
149 DRIVERS := $(DRIVERS) drivers/sbus/sbus.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 ifeq ($(CONFIG_PARIDE),y)
161 DRIVERS := $(DRIVERS) drivers/block/paride/paride.a
162 endif
164 ifdef CONFIG_HAMRADIO
165 DRIVERS := $(DRIVERS) drivers/net/hamradio/hamradio.a
166 endif
168 include arch/$(ARCH)/Makefile
170 ifdef SMP
172 .S.s:
173 $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -E -o $*.s $<
174 .S.o:
175 $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c -o $*.o $<
177 else
179 .S.s:
180 $(CC) -D__ASSEMBLY__ -traditional -E -o $*.s $<
181 .S.o:
182 $(CC) -D__ASSEMBLY__ -traditional -c -o $*.o $<
184 endif
186 Version: dummy
187 @rm -f include/linux/compile.h
189 boot: vmlinux
190 @$(MAKE) -C arch/$(ARCH)/boot
192 vmlinux: $(CONFIGURATION) init/main.o init/version.o linuxsubdirs
193 $(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o \
194 $(CORE_FILES) \
195 $(FILESYSTEMS) \
196 $(NETWORKS) \
197 $(DRIVERS) \
198 $(LIBS) \
199 -o vmlinux
200 $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
202 symlinks:
203 rm -f include/asm
204 ( cd include ; ln -sf asm-$(ARCH) asm)
205 @if [ ! -d modules ]; then \
206 mkdir modules; \
208 @if [ ! -d include/linux/modules ]; then \
209 mkdir include/linux/modules; \
212 oldconfig: symlinks scripts/split-include
213 $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
214 scripts/split-include include/linux/autoconf.h include/config
216 xconfig: symlinks scripts/split-include
217 $(MAKE) -C scripts kconfig.tk
218 wish -f scripts/kconfig.tk
219 scripts/split-include include/linux/autoconf.h include/config
221 menuconfig: include/linux/version.h symlinks scripts/split-include
222 $(MAKE) -C scripts/lxdialog all
223 $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
224 scripts/split-include include/linux/autoconf.h include/config
226 config: symlinks scripts/split-include
227 $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
228 scripts/split-include include/linux/autoconf.h include/config
230 linuxsubdirs: dummy
231 set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done
233 $(TOPDIR)/include/linux/version.h: include/linux/version.h
234 $(TOPDIR)/include/linux/compile.h: include/linux/compile.h
236 newversion:
237 @if [ ! -f .version ]; then \
238 echo 1 > .version; \
239 else \
240 expr 0`cat .version` + 1 > .version; \
243 include/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion
244 @if [ -f .name ]; then \
245 echo \#define UTS_VERSION \"\#`cat .version`-`cat .name` `date`\"; \
246 else \
247 echo \#define UTS_VERSION \"\#`cat .version` `date`\"; \
248 fi >> .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 @mv -f .ver $@
267 init/version.o: init/version.c include/linux/compile.h
268 $(CC) $(CFLAGS) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c
270 init/main.o: init/main.c
271 $(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<
273 fs: dummy
274 $(MAKE) linuxsubdirs SUBDIRS=fs
276 lib: dummy
277 $(MAKE) linuxsubdirs SUBDIRS=lib
279 mm: dummy
280 $(MAKE) linuxsubdirs SUBDIRS=mm
282 ipc: dummy
283 $(MAKE) linuxsubdirs SUBDIRS=ipc
285 kernel: dummy
286 $(MAKE) linuxsubdirs SUBDIRS=kernel
288 drivers: dummy
289 $(MAKE) linuxsubdirs SUBDIRS=drivers
291 net: dummy
292 $(MAKE) linuxsubdirs SUBDIRS=net
294 MODFLAGS = -DMODULE
295 ifdef CONFIG_MODULES
296 ifdef CONFIG_MODVERSIONS
297 MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
298 endif
300 modules: include/linux/version.h
301 @set -e; \
302 for i in $(SUBDIRS); \
303 do $(MAKE) -C $$i CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules; \
304 done
306 modules_install:
307 @( \
308 MODLIB=/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 -p $$These $$MODLIB/$$2; \
313 echo Installing modules under $$MODLIB/$$2; \
314 }; \
316 if [ -f BLOCK_MODULES ]; then inst_mod BLOCK_MODULES block; fi; \
317 if [ -f NET_MODULES ]; then inst_mod NET_MODULES net; fi; \
318 if [ -f IPV4_MODULES ]; then inst_mod IPV4_MODULES ipv4; fi; \
319 if [ -f IPV6_MODULES ]; then inst_mod IPV6_MODULES ipv6; fi; \
320 if [ -f SCSI_MODULES ]; then inst_mod SCSI_MODULES scsi; fi; \
321 if [ -f FS_MODULES ]; then inst_mod FS_MODULES fs; fi; \
322 if [ -f NLS_MODULES ]; then inst_mod NLS_MODULES fs; fi; \
323 if [ -f CDROM_MODULES ]; then inst_mod CDROM_MODULES cdrom; fi; \
324 if [ -f HAM_MODULES ]; then inst_mod HAM_MODULES net; fi; \
326 ls *.o > .allmods; \
327 echo $$MODULES | tr ' ' '\n' | sort | comm -23 .allmods - > .misc; \
328 if [ -s .misc ]; then inst_mod .misc misc; fi; \
329 rm -f .misc .allmods; \
332 # modules disabled....
334 else
335 modules modules_install: dummy
336 @echo
337 @echo "The present kernel configuration has modules disabled."
338 @echo "Type 'make config' and enable loadable module support."
339 @echo "Then build a kernel with module support enabled."
340 @echo
341 @exit 1
342 endif
344 clean: archclean
345 rm -f kernel/ksyms.lst include/linux/compile.h
346 rm -f core `find . -name '*.[oas]' ! -regex '.*lxdialog/.*' -print`
347 rm -f core `find . -type f -name 'core' -print`
348 rm -f core `find . -name '.*.flags' -print`
349 rm -f vmlinux System.map
350 rm -f .tmp*
351 rm -f drivers/char/consolemap_deftbl.c drivers/char/conmakehash
352 rm -f drivers/sound/bin2hex drivers/sound/hex2hex
353 if [ -d modules ]; then \
354 rm -f core `find modules/ -type f -print`; \
356 rm -f submenu*
358 mrproper: clean
359 rm -f include/linux/autoconf.h include/linux/version.h
360 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk1200,afsk2666,fsk9600}.h
361 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{hapn4800,psk4800}.h
362 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk2400_7,afsk2400_8}.h
363 rm -f drivers/net/hamradio/soundmodem/gentbl
364 rm -f drivers/char/hfmodem/gentbl drivers/char/hfmodem/tables.h
365 rm -f drivers/sound/*_boot.h drivers/sound/.*.boot
366 rm -f .version .config* config.in config.old
367 rm -f scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp
368 rm -f scripts/lxdialog/*.o scripts/lxdialog/lxdialog
369 rm -f .menuconfig.log
370 rm -f include/asm
371 rm -rf include/config
372 rm -f .depend `find . -name .depend -print`
373 rm -f core `find . -size 0 -print`
374 rm -f .hdepend scripts/mkdep scripts/split-include
375 rm -f $(TOPDIR)/include/linux/modversions.h
376 rm -rf $(TOPDIR)/include/linux/modules
377 rm -rf modules
379 distclean: mrproper
380 rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
381 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
382 -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print` TAGS
384 backup: mrproper
385 cd .. && tar cf - linux/ | gzip -9 > backup.gz
386 sync
388 sums:
389 find . -type f -print | sort | xargs sum > .SUMS
391 dep-files: scripts/mkdep archdep include/linux/version.h
392 scripts/mkdep init/*.c > .depend
393 scripts/mkdep `find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print` > .hdepend
394 set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i fastdep; done
396 MODVERFILE :=
398 ifdef CONFIG_MODVERSIONS
399 MODVERFILE := $(TOPDIR)/include/linux/modversions.h
400 endif
402 depend dep: dep-files $(MODVERFILE)
404 checkconfig:
405 perl -w scripts/checkconfig.pl `find $(FINDHPATH) $(SUBDIRS) -name '*.[hcS]' -print | sort`
407 ifdef CONFIGURATION
408 ..$(CONFIGURATION):
409 @echo
410 @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
411 @echo
412 $(MAKE) $(CONFIGURATION)
413 @echo
414 @echo "Successful. Try re-making (ignore the error that follows)"
415 @echo
416 exit 1
418 #dummy: ..$(CONFIGURATION)
419 dummy:
421 else
423 dummy:
425 endif
427 include Rules.make
430 # This generates dependencies for the .h files.
433 scripts/mkdep: scripts/mkdep.c
434 $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
436 scripts/split-include: scripts/split-include.c
437 $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c