Linux-2.1.125 ... pre-2.2 imminent
[davej-history.git] / Makefile
blobcc16579e7d184cc62205e9bd549da030a49bcf82
1 VERSION = 2
2 PATCHLEVEL = 1
3 SUBLEVEL = 125
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 OBJDUMP =$(CROSS_COMPILE)objdump
39 MAKE =make
40 GENKSYMS=/sbin/genksyms
42 all: do-it-all
45 # Make "config" the default target if there is no configuration file or
46 # "depend" the target if there is no top-level dependency information.
48 ifeq (.config,$(wildcard .config))
49 include .config
50 ifeq (.depend,$(wildcard .depend))
51 include .depend
52 do-it-all: Version vmlinux
53 else
54 CONFIGURATION = depend
55 do-it-all: depend
56 endif
57 else
58 CONFIGURATION = config
59 do-it-all: config
60 endif
63 # ROOT_DEV specifies the default root-device when making the image.
64 # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
65 # the default of FLOPPY is used by 'build'.
68 ROOT_DEV = CURRENT
71 # INSTALL_PATH specifies where to place the updated kernel and system map
72 # images. Uncomment if you want to place them anywhere other than root.
74 #INSTALL_PATH=/boot
77 # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
78 # relocations required by build roots. This is not defined in the
79 # makefile but the arguement can be passed to make if needed.
83 # If you want to preset the SVGA mode, uncomment the next line and
84 # set SVGA_MODE to whatever number you want.
85 # Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
86 # The number is the same as you would ordinarily press at bootup.
89 SVGA_MODE= -DSVGA_MODE=NORMAL_VGA
92 # standard CFLAGS
95 CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
97 ifdef SMP
98 CFLAGS += -D__SMP__
99 AFLAGS += -D__SMP__
100 endif
103 # if you want the RAM disk device, define this to be the
104 # size in blocks.
107 #RAMDISK = -DRAMDISK=512
109 # Include the make variables (CC, etc...)
112 CORE_FILES =kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o
113 FILESYSTEMS =fs/filesystems.a
114 NETWORKS =net/network.a
115 DRIVERS =drivers/block/block.a \
116 drivers/char/char.a \
117 drivers/misc/misc.a
118 LIBS =$(TOPDIR)/lib/lib.a
119 SUBDIRS =kernel drivers mm fs net ipc lib
121 ifdef CONFIG_NUBUS
122 DRIVERS := $(DRIVERS) drivers/nubus/nubus.a
123 endif
125 ifeq ($(CONFIG_ISDN),y)
126 DRIVERS := $(DRIVERS) drivers/isdn/isdn.a
127 endif
129 DRIVERS := $(DRIVERS) drivers/net/net.a
131 ifeq ($(CONFIG_SCSI),y)
132 DRIVERS := $(DRIVERS) drivers/scsi/scsi.a
133 endif
135 ifneq ($(CONFIG_CD_NO_IDESCSI)$(CONFIG_BLK_DEV_IDECD)$(CONFIG_BLK_DEV_SR)$(CONFIG_PARIDE_PCD),)
136 DRIVERS := $(DRIVERS) drivers/cdrom/cdrom.a
137 endif
139 ifeq ($(CONFIG_SOUND),y)
140 DRIVERS := $(DRIVERS) drivers/sound/sound.a
141 endif
143 ifdef CONFIG_PCI
144 DRIVERS := $(DRIVERS) drivers/pci/pci.a
145 endif
147 ifdef CONFIG_DIO
148 DRIVERS := $(DRIVERS) drivers/dio/dio.a
149 endif
151 ifdef CONFIG_SBUS
152 DRIVERS := $(DRIVERS) drivers/sbus/sbus.a
153 endif
155 ifdef CONFIG_ZORRO
156 DRIVERS := $(DRIVERS) drivers/zorro/zorro.a
157 endif
159 ifeq ($(CONFIG_FC4),y)
160 DRIVERS := $(DRIVERS) drivers/fc4/fc4.a
161 endif
163 ifdef CONFIG_PPC
164 DRIVERS := $(DRIVERS) drivers/macintosh/macintosh.a
165 endif
167 ifdef CONFIG_PNP
168 DRIVERS := $(DRIVERS) drivers/pnp/pnp.a
169 endif
171 ifdef CONFIG_VT
172 DRIVERS := $(DRIVERS) drivers/video/video.a
173 endif
175 ifeq ($(CONFIG_PARIDE),y)
176 DRIVERS := $(DRIVERS) drivers/block/paride/paride.a
177 endif
179 ifdef CONFIG_HAMRADIO
180 DRIVERS := $(DRIVERS) drivers/net/hamradio/hamradio.a
181 endif
183 include arch/$(ARCH)/Makefile
185 .S.s:
186 $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -E -o $*.s $<
187 .S.o:
188 $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c -o $*.o $<
190 Version: dummy
191 @rm -f include/linux/compile.h
193 boot: vmlinux
194 @$(MAKE) -C arch/$(ARCH)/boot
196 vmlinux: $(CONFIGURATION) init/main.o init/version.o linuxsubdirs
197 $(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o \
198 $(CORE_FILES) \
199 $(FILESYSTEMS) \
200 $(NETWORKS) \
201 $(DRIVERS) \
202 $(LIBS) \
203 -o vmlinux
204 $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
206 symlinks:
207 rm -f include/asm
208 ( cd include ; ln -sf asm-$(ARCH) asm)
209 @if [ ! -d modules ]; then \
210 mkdir modules; \
212 @if [ ! -d include/linux/modules ]; then \
213 mkdir include/linux/modules; \
216 oldconfig: symlinks scripts/split-include
217 $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
218 if [ -r include/linux/autoconf.h ]; then \
219 scripts/split-include include/linux/autoconf.h include/config; \
222 xconfig: symlinks scripts/split-include
223 $(MAKE) -C scripts kconfig.tk
224 wish -f scripts/kconfig.tk
225 if [ -r include/linux/autoconf.h ]; then \
226 scripts/split-include include/linux/autoconf.h include/config; \
229 menuconfig: include/linux/version.h symlinks scripts/split-include
230 $(MAKE) -C scripts/lxdialog all
231 $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
232 if [ -r include/linux/autoconf.h ]; then \
233 scripts/split-include include/linux/autoconf.h include/config; \
236 config: symlinks scripts/split-include
237 $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
238 if [ -r include/linux/autoconf.h ]; then \
239 scripts/split-include include/linux/autoconf.h include/config; \
242 linuxsubdirs: $(patsubst %, _dir_%, $(SUBDIRS))
244 $(patsubst %, _dir_%, $(SUBDIRS)) : dummy
245 $(MAKE) -C $(patsubst _dir_%, %, $@)
247 $(TOPDIR)/include/linux/version.h: include/linux/version.h
248 $(TOPDIR)/include/linux/compile.h: include/linux/compile.h
250 newversion:
251 @if [ ! -f .version ]; then \
252 echo 1 > .version; \
253 else \
254 expr 0`cat .version` + 1 > .version; \
257 include/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion
258 @echo -n \#define UTS_VERSION \"\#`cat .version` > .ver
259 @if [ -n "$(SMP)" ] ; then echo -n " SMP" >> .ver; fi
260 @if [ -f .name ]; then echo -n \-`cat .name` >> .ver; fi
261 @echo ' '`date`'"' >> .ver
262 @echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
263 @echo \#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
264 @echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> .ver
265 @if [ -x /bin/dnsdomainname ]; then \
266 echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\"; \
267 elif [ -x /bin/domainname ]; then \
268 echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\"; \
269 else \
270 echo \#define LINUX_COMPILE_DOMAIN ; \
271 fi >> .ver
272 @echo \#define LINUX_COMPILER \"`$(CC) -v 2>&1 | tail -1`\" >> .ver
273 @mv -f .ver $@
275 include/linux/version.h: ./Makefile
276 @echo \#define UTS_RELEASE \"$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)\" > .ver
277 @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
278 @echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
279 @mv -f .ver $@
281 init/version.o: init/version.c include/linux/compile.h
282 $(CC) $(CFLAGS) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c
284 init/main.o: init/main.c
285 $(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<
287 fs lib mm ipc kernel drivers net: dummy
288 $(MAKE) $(subst $@, _dir_$@, $@)
290 MODFLAGS = -DMODULE
291 ifdef CONFIG_MODULES
292 ifdef CONFIG_MODVERSIONS
293 MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
294 endif
296 modules: $(patsubst %, _mod_%, $(SUBDIRS))
298 $(patsubst %, _mod_%, $(SUBDIRS)) : include/linux/version.h
299 $(MAKE) -C $(patsubst _mod_%, %, $@) CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules
301 modules_install:
302 @( \
303 MODLIB=$(INSTALL_MOD_PATH)/lib/modules/$(VERSION).$(PATCHLEVEL).$(SUBLEVEL); \
304 cd modules; \
305 MODULES=""; \
306 inst_mod() { These="`cat $$1`"; MODULES="$$MODULES $$These"; \
307 mkdir -p $$MODLIB/$$2; cp $$These $$MODLIB/$$2; \
308 echo Installing modules under $$MODLIB/$$2; \
309 }; \
311 if [ -f BLOCK_MODULES ]; then inst_mod BLOCK_MODULES block; fi; \
312 if [ -f NET_MODULES ]; then inst_mod NET_MODULES net; fi; \
313 if [ -f IPV4_MODULES ]; then inst_mod IPV4_MODULES ipv4; fi; \
314 if [ -f IPV6_MODULES ]; then inst_mod IPV6_MODULES ipv6; fi; \
315 if [ -f SCSI_MODULES ]; then inst_mod SCSI_MODULES scsi; fi; \
316 if [ -f FS_MODULES ]; then inst_mod FS_MODULES fs; fi; \
317 if [ -f NLS_MODULES ]; then inst_mod NLS_MODULES fs; fi; \
318 if [ -f CDROM_MODULES ]; then inst_mod CDROM_MODULES cdrom; fi; \
319 if [ -f HAM_MODULES ]; then inst_mod HAM_MODULES net; fi; \
320 if [ -f SOUND_MODULES ]; then inst_mod SOUND_MODULES sound; fi; \
321 if [ -f VIDEO_MODULES ]; then inst_mod VIDEO_MODULES video; fi; \
322 if [ -f FC4_MODULES ]; then inst_mod FC4_MODULES fc4; fi; \
324 ls *.o > $$MODLIB/.allmods; \
325 echo $$MODULES | tr ' ' '\n' | sort | comm -23 $$MODLIB/.allmods - > $$MODLIB/.misc; \
326 if [ -s $$MODLIB/.misc ]; then inst_mod $$MODLIB/.misc misc; fi; \
327 rm -f $$MODLIB/.misc $$MODLIB/.allmods; \
330 # modules disabled....
332 else
333 modules modules_install: dummy
334 @echo
335 @echo "The present kernel configuration has modules disabled."
336 @echo "Type 'make config' and enable loadable module support."
337 @echo "Then build a kernel with module support enabled."
338 @echo
339 @exit 1
340 endif
342 clean: archclean
343 rm -f kernel/ksyms.lst include/linux/compile.h
344 rm -f core `find . -name '*.[oas]' ! -regex '.*lxdialog/.*' -print`
345 rm -f core `find . -type f -name 'core' -print`
346 rm -f core `find . -name '.*.flags' -print`
347 rm -f vmlinux System.map
348 rm -f .tmp*
349 rm -f drivers/char/consolemap_deftbl.c drivers/video/promcon_tbl.c
350 rm -f drivers/char/conmakehash
351 rm -f drivers/sound/bin2hex drivers/sound/hex2hex
352 if [ -d modules ]; then \
353 rm -f core `find modules/ -type f -print`; \
355 rm -f submenu*
357 mrproper: clean archmrproper
358 rm -f include/linux/autoconf.h include/linux/version.h
359 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk1200,afsk2666,fsk9600}.h
360 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{hapn4800,psk4800}.h
361 rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk2400_7,afsk2400_8}.h
362 rm -f drivers/net/hamradio/soundmodem/gentbl
363 rm -f drivers/char/hfmodem/gentbl drivers/char/hfmodem/tables.h
364 rm -f drivers/sound/*_boot.h drivers/sound/.*.boot
365 rm -f .version .config* config.in config.old
366 rm -f scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp
367 rm -f scripts/lxdialog/*.o scripts/lxdialog/lxdialog
368 rm -f .menuconfig.log
369 rm -f include/asm
370 rm -rf include/config
371 rm -f .depend `find . -name .depend -print`
372 rm -f core `find . -size 0 -print`
373 rm -f .hdepend scripts/mkdep scripts/split-include
374 rm -f $(TOPDIR)/include/linux/modversions.h
375 rm -rf $(TOPDIR)/include/linux/modules
376 rm -rf modules
378 distclean: mrproper
379 rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
380 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
381 -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print` TAGS
383 backup: mrproper
384 cd .. && tar cf - linux/ | gzip -9 > backup.gz
385 sync
387 sums:
388 find . -type f -print | sort | xargs sum > .SUMS
390 dep-files: scripts/mkdep archdep include/linux/version.h
391 scripts/mkdep init/*.c > .depend
392 scripts/mkdep `find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print` > .hdepend
393 # set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i fastdep ;done
394 # let this be made through the fastdep rule in Rules.make
395 $(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) _FASTDEP_ALL_SUB_DIRS="$(SUBDIRS)"
397 MODVERFILE :=
399 ifdef CONFIG_MODVERSIONS
400 MODVERFILE := $(TOPDIR)/include/linux/modversions.h
401 endif
403 depend dep: dep-files $(MODVERFILE)
405 checkconfig:
406 perl -w scripts/checkconfig.pl `find * -name '*.[hcS]' -print | sort`
408 ifdef CONFIGURATION
409 ..$(CONFIGURATION):
410 @echo
411 @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
412 @echo
413 $(MAKE) $(CONFIGURATION)
414 @echo
415 @echo "Successful. Try re-making (ignore the error that follows)"
416 @echo
417 exit 1
419 #dummy: ..$(CONFIGURATION)
420 dummy:
422 else
424 dummy:
426 endif
428 include Rules.make
431 # This generates dependencies for the .h files.
434 scripts/mkdep: scripts/mkdep.c
435 $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
437 scripts/split-include: scripts/split-include.c
438 $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c