Import 2.1.28pre1
[davej-history.git] / Makefile
blob9587853df8d86097bc5ee8523b4bc31c92bbf6bf
1 VERSION = 2
2 PATCHLEVEL = 1
3 SUBLEVEL = 28
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
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 ARCHIVES =kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o net/network.a
118 FILESYSTEMS =fs/filesystems.a
119 DRIVERS =drivers/block/block.a \
120 drivers/char/char.a
121 LIBS =$(TOPDIR)/lib/lib.a
122 SUBDIRS =kernel drivers mm fs net ipc lib
124 ifeq ($(CONFIG_ISDN),y)
125 DRIVERS := $(DRIVERS) drivers/isdn/isdn.a
126 endif
128 DRIVERS := $(DRIVERS) drivers/net/net.a
130 ifeq ($(CONFIG_SCSI),y)
131 DRIVERS := $(DRIVERS) drivers/scsi/scsi.a
132 endif
134 ifneq ($(CONFIG_CD_NO_IDESCSI)$(CONFIG_BLK_DEV_IDECD)$(CONFIG_BLK_DEV_SR),)
135 DRIVERS := $(DRIVERS) drivers/cdrom/cdrom.a
136 endif
138 ifeq ($(CONFIG_SOUND),y)
139 DRIVERS := $(DRIVERS) drivers/sound/sound.a
140 endif
142 ifdef CONFIG_PCI
143 DRIVERS := $(DRIVERS) drivers/pci/pci.a
144 endif
146 ifdef CONFIG_SBUS
147 DRIVERS := $(DRIVERS) drivers/sbus/sbus.a
148 endif
150 include arch/$(ARCH)/Makefile
152 ifdef SMP
154 .S.s:
155 $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -E -o $*.s $<
156 .S.o:
157 $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c -o $*.o $<
159 else
161 .S.s:
162 $(CC) -D__ASSEMBLY__ -traditional -E -o $*.s $<
163 .S.o:
164 $(CC) -D__ASSEMBLY__ -traditional -c -o $*.o $<
166 endif
168 Version: dummy
169 @rm -f include/linux/compile.h
171 boot: vmlinux
172 @$(MAKE) -C arch/$(ARCH)/boot
174 vmlinux: $(CONFIGURATION) init/main.o init/version.o linuxsubdirs
175 $(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o \
176 $(ARCHIVES) \
177 $(FILESYSTEMS) \
178 $(DRIVERS) \
179 $(LIBS) \
180 -o vmlinux
181 $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)\|\(\.\.ng$$\)' | sort > System.map
183 symlinks:
184 rm -f include/asm
185 ( cd include ; ln -sf asm-$(ARCH) asm)
186 @if [ ! -d modules ]; then \
187 mkdir modules; \
189 @if [ ! -d include/linux/modules ]; then \
190 mkdir include/linux/modules; \
193 oldconfig: symlinks
194 $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
196 xconfig: symlinks
197 $(MAKE) -C scripts kconfig.tk
198 wish -f scripts/kconfig.tk
200 menuconfig: include/linux/version.h symlinks
201 $(MAKE) -C scripts/lxdialog all
202 $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
204 config: symlinks
205 $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
207 linuxsubdirs: dummy
208 set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done
210 $(TOPDIR)/include/linux/version.h: include/linux/version.h
211 $(TOPDIR)/include/linux/compile.h: include/linux/compile.h
213 newversion:
214 @if [ ! -f .version ]; then \
215 echo 1 > .version; \
216 else \
217 expr 0`cat .version` + 1 > .version; \
220 include/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion
221 @if [ -f .name ]; then \
222 echo \#define UTS_VERSION \"\#`cat .version`-`cat .name` `date`\"; \
223 else \
224 echo \#define UTS_VERSION \"\#`cat .version` `date`\"; \
225 fi >> .ver
226 @echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
227 @echo \#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
228 @echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> .ver
229 @if [ -x /bin/dnsdomainname ]; then \
230 echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\"; \
231 elif [ -x /bin/domainname ]; then \
232 echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\"; \
233 else \
234 echo \#define LINUX_COMPILE_DOMAIN ; \
235 fi >> .ver
236 @echo \#define LINUX_COMPILER \"`$(CC) -v 2>&1 | tail -1`\" >> .ver
237 @mv -f .ver $@
239 include/linux/version.h: ./Makefile
240 @echo \#define UTS_RELEASE \"$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)\" > .ver
241 @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
242 @mv -f .ver $@
244 init/version.o: init/version.c include/linux/compile.h
245 $(CC) $(CFLAGS) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c
247 init/main.o: init/main.c
248 $(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<
250 fs: dummy
251 $(MAKE) linuxsubdirs SUBDIRS=fs
253 lib: dummy
254 $(MAKE) linuxsubdirs SUBDIRS=lib
256 mm: dummy
257 $(MAKE) linuxsubdirs SUBDIRS=mm
259 ipc: dummy
260 $(MAKE) linuxsubdirs SUBDIRS=ipc
262 kernel: dummy
263 $(MAKE) linuxsubdirs SUBDIRS=kernel
265 drivers: dummy
266 $(MAKE) linuxsubdirs SUBDIRS=drivers
268 net: dummy
269 $(MAKE) linuxsubdirs SUBDIRS=net
271 MODFLAGS = -DMODULE
272 ifdef CONFIG_MODULES
273 ifdef CONFIG_MODVERSIONS
274 MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
275 endif
277 modules: include/linux/version.h
278 @set -e; \
279 for i in $(SUBDIRS); \
280 do $(MAKE) -C $$i CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules; \
281 done
283 modules_install:
284 @( \
285 MODLIB=/lib/modules/$(VERSION).$(PATCHLEVEL).$(SUBLEVEL); \
286 cd modules; \
287 MODULES=""; \
288 inst_mod() { These="`cat $$1`"; MODULES="$$MODULES $$These"; \
289 mkdir -p $$MODLIB/$$2; cp -p $$These $$MODLIB/$$2; \
290 echo Installing modules under $$MODLIB/$$2; \
291 }; \
293 if [ -f BLOCK_MODULES ]; then inst_mod BLOCK_MODULES block; fi; \
294 if [ -f NET_MODULES ]; then inst_mod NET_MODULES net; fi; \
295 if [ -f IPV4_MODULES ]; then inst_mod IPV4_MODULES ipv4; fi; \
296 if [ -f IPV6_MODULES ]; then inst_mod IPV6_MODULES ipv6; fi; \
297 if [ -f SCSI_MODULES ]; then inst_mod SCSI_MODULES scsi; fi; \
298 if [ -f FS_MODULES ]; then inst_mod FS_MODULES fs; fi; \
299 if [ -f CDROM_MODULES ]; then inst_mod CDROM_MODULES cdrom; fi; \
301 ls *.o > .allmods; \
302 echo $$MODULES | tr ' ' '\n' | sort | comm -23 .allmods - > .misc; \
303 if [ -s .misc ]; then inst_mod .misc misc; fi; \
304 rm -f .misc .allmods; \
307 # modules disabled....
309 else
310 modules modules_install: dummy
311 @echo
312 @echo "The present kernel configuration has modules disabled."
313 @echo "Type 'make config' and enable loadable module support."
314 @echo "Then build a kernel with module support enabled."
315 @echo
316 @exit 1
317 endif
319 clean: archclean
320 rm -f kernel/ksyms.lst include/linux/compile.h
321 rm -f core `find . -name '*.[oas]' ! -regex '.*lxdialog/.*' -print`
322 rm -f core `find . -type f -name 'core' -print`
323 rm -f vmlinux System.map
324 rm -f .tmp* drivers/sound/configure
325 rm -f `find modules/ -type f -print`
326 rm -f submenu*
328 mrproper: clean
329 rm -f include/linux/autoconf.h include/linux/version.h
330 rm -f drivers/sound/local.h drivers/sound/.defines
331 rm -f drivers/scsi/aic7xxx_asm drivers/scsi/aic7xxx_seq.h
332 rm -f drivers/char/uni_hash.tbl drivers/char/conmakehash
333 rm -f drivers/net/soundmodem/sm_tbl_{afsk1200,afsk2666,fsk9600}.h
334 rm -f drivers/net/soundmodem/sm_tbl_{hapn4800,psk4800}.h
335 rm -f drivers/net/soundmodem/gentbl
336 rm -f .version .config* config.in config.old
337 rm -f scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp
338 rm -f scripts/lxdialog/*.o scripts/lxdialog/lxdialog
339 rm -f .menuconfig .menuconfig.log
340 rm -f include/asm
341 rm -f .depend `find . -name .depend -print`
342 rm -f .hdepend scripts/mkdep
343 rm -f $(TOPDIR)/include/linux/modversions.h
344 rm -rf $(TOPDIR)/include/linux/modules
345 rm -rf modules
348 distclean: mrproper
349 rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
350 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
351 -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print` TAGS
353 backup: mrproper
354 cd .. && tar cf - linux/ | gzip -9 > backup.gz
355 sync
357 sums:
358 find . -type f -print | sort | xargs sum > .SUMS
360 dep-files: scripts/mkdep archdep include/linux/version.h
361 scripts/mkdep init/*.c > .tmpdepend
362 scripts/mkdep `find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print` > .hdepend
363 set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i fastdep; done
364 mv .tmpdepend .depend
366 MODVERFILE :=
368 ifdef CONFIG_MODVERSIONS
369 MODVERFILE := $(TOPDIR)/include/linux/modversions.h
370 endif
372 depend dep: dep-files $(MODVERFILE)
374 ifdef CONFIGURATION
375 ..$(CONFIGURATION):
376 @echo
377 @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
378 @echo
379 $(MAKE) $(CONFIGURATION)
380 @echo
381 @echo "Successful. Try re-making (ignore the error that follows)"
382 @echo
383 exit 1
385 #dummy: ..$(CONFIGURATION)
386 dummy:
388 else
390 dummy:
392 endif
394 include Rules.make
397 # This generates dependencies for the .h files.
400 scripts/mkdep: scripts/mkdep.c
401 $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c