Import 2.1.46
[davej-history.git] / Makefile
blob4fcf1a91586c14086f5bf916e47e070fec634066
1 VERSION = 2
2 PATCHLEVEL = 1
3 SUBLEVEL = 46
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/pnp/pnp.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 include arch/$(ARCH)/Makefile
154 ifdef SMP
156 .S.s:
157 $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -E -o $*.s $<
158 .S.o:
159 $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c -o $*.o $<
161 else
163 .S.s:
164 $(CC) -D__ASSEMBLY__ -traditional -E -o $*.s $<
165 .S.o:
166 $(CC) -D__ASSEMBLY__ -traditional -c -o $*.o $<
168 endif
170 Version: dummy
171 @rm -f include/linux/compile.h
173 boot: vmlinux
174 @$(MAKE) -C arch/$(ARCH)/boot
176 vmlinux: $(CONFIGURATION) init/main.o init/version.o linuxsubdirs
177 $(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o \
178 $(CORE_FILES) \
179 $(FILESYSTEMS) \
180 $(NETWORKS) \
181 $(DRIVERS) \
182 $(LIBS) \
183 -o vmlinux
184 $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
186 symlinks:
187 rm -f include/asm
188 ( cd include ; ln -sf asm-$(ARCH) asm)
189 @if [ ! -d modules ]; then \
190 mkdir modules; \
192 @if [ ! -d include/linux/modules ]; then \
193 mkdir include/linux/modules; \
196 oldconfig: symlinks
197 $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
199 xconfig: symlinks
200 $(MAKE) -C scripts kconfig.tk
201 wish -f scripts/kconfig.tk
203 menuconfig: include/linux/version.h symlinks
204 $(MAKE) -C scripts/lxdialog all
205 $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
207 config: symlinks
208 $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
210 linuxsubdirs: dummy
211 set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done
213 $(TOPDIR)/include/linux/version.h: include/linux/version.h
214 $(TOPDIR)/include/linux/compile.h: include/linux/compile.h
216 newversion:
217 @if [ ! -f .version ]; then \
218 echo 1 > .version; \
219 else \
220 expr 0`cat .version` + 1 > .version; \
223 include/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion
224 @if [ -f .name ]; then \
225 echo \#define UTS_VERSION \"\#`cat .version`-`cat .name` `date`\"; \
226 else \
227 echo \#define UTS_VERSION \"\#`cat .version` `date`\"; \
228 fi >> .ver
229 @echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
230 @echo \#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
231 @echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> .ver
232 @if [ -x /bin/dnsdomainname ]; then \
233 echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\"; \
234 elif [ -x /bin/domainname ]; then \
235 echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\"; \
236 else \
237 echo \#define LINUX_COMPILE_DOMAIN ; \
238 fi >> .ver
239 @echo \#define LINUX_COMPILER \"`$(CC) -v 2>&1 | tail -1`\" >> .ver
240 @mv -f .ver $@
242 include/linux/version.h: ./Makefile
243 @echo \#define UTS_RELEASE \"$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)\" > .ver
244 @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
245 @mv -f .ver $@
247 init/version.o: init/version.c include/linux/compile.h
248 $(CC) $(CFLAGS) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c
250 init/main.o: init/main.c
251 $(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<
253 fs: dummy
254 $(MAKE) linuxsubdirs SUBDIRS=fs
256 lib: dummy
257 $(MAKE) linuxsubdirs SUBDIRS=lib
259 mm: dummy
260 $(MAKE) linuxsubdirs SUBDIRS=mm
262 ipc: dummy
263 $(MAKE) linuxsubdirs SUBDIRS=ipc
265 kernel: dummy
266 $(MAKE) linuxsubdirs SUBDIRS=kernel
268 drivers: dummy
269 $(MAKE) linuxsubdirs SUBDIRS=drivers
271 net: dummy
272 $(MAKE) linuxsubdirs SUBDIRS=net
274 MODFLAGS = -DMODULE
275 ifdef CONFIG_MODULES
276 ifdef CONFIG_MODVERSIONS
277 MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
278 endif
280 modules: include/linux/version.h
281 @set -e; \
282 for i in $(SUBDIRS); \
283 do $(MAKE) -C $$i CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules; \
284 done
286 modules_install:
287 @( \
288 MODLIB=/lib/modules/$(VERSION).$(PATCHLEVEL).$(SUBLEVEL); \
289 cd modules; \
290 MODULES=""; \
291 inst_mod() { These="`cat $$1`"; MODULES="$$MODULES $$These"; \
292 mkdir -p $$MODLIB/$$2; cp -p $$These $$MODLIB/$$2; \
293 echo Installing modules under $$MODLIB/$$2; \
294 }; \
296 if [ -f BLOCK_MODULES ]; then inst_mod BLOCK_MODULES block; fi; \
297 if [ -f NET_MODULES ]; then inst_mod NET_MODULES net; fi; \
298 if [ -f IPV4_MODULES ]; then inst_mod IPV4_MODULES ipv4; fi; \
299 if [ -f IPV6_MODULES ]; then inst_mod IPV6_MODULES ipv6; fi; \
300 if [ -f SCSI_MODULES ]; then inst_mod SCSI_MODULES scsi; fi; \
301 if [ -f FS_MODULES ]; then inst_mod FS_MODULES fs; fi; \
302 if [ -f CDROM_MODULES ]; then inst_mod CDROM_MODULES cdrom; fi; \
304 ls *.o > .allmods; \
305 echo $$MODULES | tr ' ' '\n' | sort | comm -23 .allmods - > .misc; \
306 if [ -s .misc ]; then inst_mod .misc misc; fi; \
307 rm -f .misc .allmods; \
310 # modules disabled....
312 else
313 modules modules_install: dummy
314 @echo
315 @echo "The present kernel configuration has modules disabled."
316 @echo "Type 'make config' and enable loadable module support."
317 @echo "Then build a kernel with module support enabled."
318 @echo
319 @exit 1
320 endif
322 clean: archclean
323 rm -f kernel/ksyms.lst include/linux/compile.h
324 rm -f core `find . -name '*.[oas]' ! -regex '.*lxdialog/.*' -print`
325 rm -f core `find . -type f -name 'core' -print`
326 rm -f vmlinux System.map
327 rm -f .tmp* drivers/sound/configure
328 rm -f `find modules/ -type f -print`
329 rm -f submenu*
331 mrproper: clean
332 rm -f include/linux/autoconf.h include/linux/version.h
333 rm -f drivers/sound/local.h drivers/sound/.defines
334 rm -f drivers/scsi/aic7xxx_asm drivers/scsi/aic7xxx_seq.h
335 rm -f drivers/char/uni_hash.tbl drivers/char/conmakehash
336 rm -f drivers/net/soundmodem/sm_tbl_{afsk1200,afsk2666,fsk9600}.h
337 rm -f drivers/net/soundmodem/sm_tbl_{hapn4800,psk4800}.h
338 rm -f drivers/net/soundmodem/gentbl
339 rm -f .version .config* config.in config.old
340 rm -f scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp
341 rm -f scripts/lxdialog/*.o scripts/lxdialog/lxdialog
342 rm -f .menuconfig .menuconfig.log
343 rm -f include/asm
344 rm -f .depend `find . -name .depend -print`
345 rm -f .hdepend scripts/mkdep
346 rm -f $(TOPDIR)/include/linux/modversions.h
347 rm -rf $(TOPDIR)/include/linux/modules
348 rm -rf modules
351 distclean: mrproper
352 rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
353 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
354 -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print` TAGS
355 rm -f drivers/sound/Config.in
356 cp drivers/sound/Config.std drivers/sound/Config.in
358 backup: mrproper
359 cd .. && tar cf - linux/ | gzip -9 > backup.gz
360 sync
362 sums:
363 find . -type f -print | sort | xargs sum > .SUMS
365 dep-files: scripts/mkdep archdep include/linux/version.h
366 scripts/mkdep init/*.c > .tmpdepend
367 scripts/mkdep `find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print` > .hdepend
368 set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i fastdep; done
369 mv .tmpdepend .depend
371 MODVERFILE :=
373 ifdef CONFIG_MODVERSIONS
374 MODVERFILE := $(TOPDIR)/include/linux/modversions.h
375 endif
377 depend dep: dep-files $(MODVERFILE)
379 ifdef CONFIGURATION
380 ..$(CONFIGURATION):
381 @echo
382 @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
383 @echo
384 $(MAKE) $(CONFIGURATION)
385 @echo
386 @echo "Successful. Try re-making (ignore the error that follows)"
387 @echo
388 exit 1
390 #dummy: ..$(CONFIGURATION)
391 dummy:
393 else
395 dummy:
397 endif
399 include Rules.make
402 # This generates dependencies for the .h files.
405 scripts/mkdep: scripts/mkdep.c
406 $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c