Import 2.0.16
[davej-history.git] / Makefile
blob179a9821ffebe0f2b16432c898a1fe192c15eebe
1 VERSION = 2
2 PATCHLEVEL = 0
3 SUBLEVEL = 16
5 ARCH = i386
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
28 HOSTCC =gcc -I$(HPATH)
29 HOSTCFLAGS =
31 CROSS_COMPILE =
33 AS =$(CROSS_COMPILE)as
34 LD =$(CROSS_COMPILE)ld
35 CC =$(CROSS_COMPILE)gcc -D__KERNEL__ -I$(HPATH)
36 CPP =$(CC) -E
37 AR =$(CROSS_COMPILE)ar
38 NM =$(CROSS_COMPILE)nm
39 STRIP =$(CROSS_COMPILE)strip
40 MAKE =make
41 AWK =gawk
43 all: do-it-all
46 # Make "config" the default target if there is no configuration file or
47 # "depend" the target if there is no top-level dependency information.
49 ifeq (.config,$(wildcard .config))
50 include .config
51 ifeq (.depend,$(wildcard .depend))
52 include .depend
53 do-it-all: Version vmlinux
54 else
55 CONFIGURATION = depend
56 do-it-all: depend
57 endif
58 else
59 CONFIGURATION = config
60 do-it-all: config
61 endif
64 # ROOT_DEV specifies the default root-device when making the image.
65 # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
66 # the default of FLOPPY is used by 'build'.
69 ROOT_DEV = CURRENT
72 # INSTALL_PATH specifies where to place the updated kernel and system map
73 # images. Uncomment if you want to place them anywhere other than root.
75 #INSTALL_PATH=/boot
78 # If you want to preset the SVGA mode, uncomment the next line and
79 # set SVGA_MODE to whatever number you want.
80 # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
81 # The number is the same as you would ordinarily press at bootup.
84 SVGA_MODE= -DSVGA_MODE=NORMAL_VGA
87 # standard CFLAGS
90 CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strength-reduce
92 ifdef CONFIG_CPP
93 CFLAGS := $(CFLAGS) -x c++
94 endif
96 ifdef SMP
97 CFLAGS += -D__SMP__
98 AFLAGS += -D__SMP__
100 ifdef SMP_PROF
101 CFLAGS += -D__SMP_PROF__
102 AFLAGS += -D__SMP_PROF__
103 endif
104 endif
107 # if you want the ram-disk device, define this to be the
108 # size in blocks.
111 #RAMDISK = -DRAMDISK=512
113 # Include the make variables (CC, etc...)
116 ARCHIVES =kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o net/network.a
117 FILESYSTEMS =fs/filesystems.a
118 DRIVERS =drivers/block/block.a \
119 drivers/char/char.a
120 LIBS =$(TOPDIR)/lib/lib.a
121 SUBDIRS =kernel drivers mm fs net ipc lib
123 ifeq ($(CONFIG_ISDN),y)
124 DRIVERS := $(DRIVERS) drivers/isdn/isdn.a
125 endif
127 DRIVERS := $(DRIVERS) drivers/net/net.a
129 ifdef CONFIG_CD_NO_IDESCSI
130 DRIVERS := $(DRIVERS) drivers/cdrom/cdrom.a
131 endif
133 ifeq ($(CONFIG_SCSI),y)
134 DRIVERS := $(DRIVERS) drivers/scsi/scsi.a
135 endif
137 ifeq ($(CONFIG_SOUND),y)
138 DRIVERS := $(DRIVERS) drivers/sound/sound.a
139 endif
141 ifdef CONFIG_PCI
142 DRIVERS := $(DRIVERS) drivers/pci/pci.a
143 endif
145 ifdef CONFIG_SBUS
146 DRIVERS := $(DRIVERS) drivers/sbus/sbus.a
147 endif
149 include arch/$(ARCH)/Makefile
151 ifdef SMP
153 .S.s:
154 $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -E -o $*.s $<
155 .S.o:
156 $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c -o $*.o $<
158 else
160 .S.s:
161 $(CC) -D__ASSEMBLY__ -traditional -E -o $*.s $<
162 .S.o:
163 $(CC) -D__ASSEMBLY__ -traditional -c -o $*.o $<
165 endif
167 Version: dummy
168 @rm -f include/linux/compile.h
170 boot: vmlinux
171 @$(MAKE) -C arch/$(ARCH)/boot
173 vmlinux: $(CONFIGURATION) init/main.o init/version.o linuxsubdirs
174 $(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o \
175 $(ARCHIVES) \
176 $(FILESYSTEMS) \
177 $(DRIVERS) \
178 $(LIBS) -o vmlinux
179 $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | sort > System.map
181 symlinks:
182 rm -f include/asm
183 ( cd include ; ln -sf asm-$(ARCH) asm)
185 oldconfig: symlinks
186 $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
188 xconfig: symlinks
189 $(MAKE) -C scripts kconfig.tk
190 wish -f scripts/kconfig.tk
192 menuconfig: include/linux/version.h symlinks
193 $(MAKE) -C scripts/lxdialog all
194 $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
196 config: symlinks
197 $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
199 linuxsubdirs: dummy
200 set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done
202 $(TOPDIR)/include/linux/version.h: include/linux/version.h
203 $(TOPDIR)/include/linux/compile.h: include/linux/compile.h
205 newversion:
206 @if [ ! -f .version ]; then \
207 echo 1 > .version; \
208 else \
209 expr 0`cat .version` + 1 > .version; \
212 include/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion
213 @if [ -f .name ]; then \
214 echo \#define UTS_VERSION \"\#`cat .version`-`cat .name` `date`\"; \
215 else \
216 echo \#define UTS_VERSION \"\#`cat .version` `date`\"; \
217 fi >> .ver
218 @echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
219 @echo \#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
220 @echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> .ver
221 @if [ -x /bin/dnsdomainname ]; then \
222 echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\"; \
223 elif [ -x /bin/domainname ]; then \
224 echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\"; \
225 else \
226 echo \#define LINUX_COMPILE_DOMAIN ; \
227 fi >> .ver
228 @echo \#define LINUX_COMPILER \"`$(CC) -v 2>&1 | tail -1`\" >> .ver
229 @mv -f .ver $@
231 include/linux/version.h: ./Makefile
232 @echo \#define UTS_RELEASE \"$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)\" > .ver
233 @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
234 @mv -f .ver $@
236 init/version.o: init/version.c include/linux/compile.h
237 $(CC) $(CFLAGS) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c
239 init/main.o: init/main.c
240 $(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<
242 fs: dummy
243 $(MAKE) linuxsubdirs SUBDIRS=fs
245 lib: dummy
246 $(MAKE) linuxsubdirs SUBDIRS=lib
248 mm: dummy
249 $(MAKE) linuxsubdirs SUBDIRS=mm
251 ipc: dummy
252 $(MAKE) linuxsubdirs SUBDIRS=ipc
254 kernel: dummy
255 $(MAKE) linuxsubdirs SUBDIRS=kernel
257 drivers: dummy
258 $(MAKE) linuxsubdirs SUBDIRS=drivers
260 net: dummy
261 $(MAKE) linuxsubdirs SUBDIRS=net
263 MODFLAGS = -DMODULE
264 ifdef CONFIG_MODULES
265 ifdef CONFIG_MODVERSIONS
266 MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
267 endif
269 modules: include/linux/version.h
270 @set -e; \
271 for i in $(SUBDIRS); \
272 do $(MAKE) -C $$i CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules; \
273 done
275 modules_install:
276 @( \
277 MODLIB=/lib/modules/$(VERSION).$(PATCHLEVEL).$(SUBLEVEL); \
278 cd modules; \
279 MODULES=""; \
280 inst_mod() { These="`cat $$1`"; MODULES="$$MODULES $$These"; \
281 mkdir -p $$MODLIB/$$2; cp -p $$These $$MODLIB/$$2; \
282 echo Installing modules under $$MODLIB/$$2; \
283 }; \
285 if [ -f BLOCK_MODULES ]; then inst_mod BLOCK_MODULES block; fi; \
286 if [ -f NET_MODULES ]; then inst_mod NET_MODULES net; fi; \
287 if [ -f IPV4_MODULES ]; then inst_mod IPV4_MODULES ipv4; fi; \
288 if [ -f SCSI_MODULES ]; then inst_mod SCSI_MODULES scsi; fi; \
289 if [ -f FS_MODULES ]; then inst_mod FS_MODULES fs; fi; \
290 if [ -f CDROM_MODULES ]; then inst_mod CDROM_MODULES cdrom; fi; \
292 ls *.o > .allmods; \
293 echo $$MODULES | tr ' ' '\n' | sort | comm -23 .allmods - > .misc; \
294 if [ -s .misc ]; then inst_mod .misc misc; fi; \
295 rm -f .misc .allmods; \
298 # modules disabled....
300 else
301 modules modules_install: dummy
302 @echo
303 @echo "The present kernel configuration has modules disabled."
304 @echo "Type 'make config' and enable loadable module support."
305 @echo "Then build a kernel with module support enabled."
306 @echo
307 @exit 1
308 endif
310 clean: archclean
311 rm -f kernel/ksyms.lst include/linux/compile.h
312 rm -f core `find . -name '*.[oas]' ! -regex '.*lxdialog/.*' -print`
313 rm -f core `find . -type f -name 'core' -print`
314 rm -f vmlinux System.map
315 rm -f .tmp* drivers/sound/configure
316 rm -fr modules/*
317 rm -f submenu*
319 mrproper: clean
320 rm -f include/linux/autoconf.h include/linux/version.h
321 rm -f drivers/sound/local.h drivers/sound/.defines
322 rm -f drivers/scsi/aic7xxx_asm drivers/scsi/aic7xxx_seq.h
323 rm -f drivers/char/uni_hash.tbl drivers/char/conmakehash
324 rm -f .version .config* config.in config.old
325 rm -f scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp
326 rm -f scripts/lxdialog/*.o scripts/lxdialog/lxdialog
327 rm -f .menuconfig .menuconfig.log
328 rm -f include/asm
329 rm -f .depend `find . -name .depend -print`
330 rm -f .hdepend
331 rm -f $(TOPDIR)/include/linux/modversions.h
332 rm -f $(TOPDIR)/include/linux/modules/*
335 distclean: mrproper
336 rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
337 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
338 -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print` TAGS
340 backup: mrproper
341 cd .. && tar cf - linux/ | gzip -9 > backup.gz
342 sync
344 sums:
345 find . -type f -print | sort | xargs sum > .SUMS
347 dep-files: archdep .hdepend include/linux/version.h
348 $(AWK) -f scripts/depend.awk init/*.c > .tmpdepend
349 set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i fastdep; done
350 mv .tmpdepend .depend
352 MODVERFILE :=
354 ifdef CONFIG_MODVERSIONS
355 MODVERFILE := $(TOPDIR)/include/linux/modversions.h
356 endif
358 depend dep: dep-files $(MODVERFILE)
360 ifdef CONFIGURATION
361 ..$(CONFIGURATION):
362 @echo
363 @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
364 @echo
365 $(MAKE) $(CONFIGURATION)
366 @echo
367 @echo "Successful. Try re-making (ignore the error that follows)"
368 @echo
369 exit 1
371 #dummy: ..$(CONFIGURATION)
372 dummy:
374 else
376 dummy:
378 endif
380 include Rules.make
383 # This generates dependencies for the .h files.
386 .hdepend: dummy
387 rm -f $@
388 $(AWK) -f scripts/depend.awk `find $(HPATH) -name \*.h ! -name modversions.h -print` > .$@
389 mv .$@ $@