1VERSION = 1 2PATCHLEVEL = 0 3SUBLEVEL = 9 4 5all: Version zImage 6 7.EXPORT_ALL_VARIABLES: 8 9CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ 10 else if [ -x /bin/bash ]; then echo /bin/bash; \ 11 else echo sh; fi ; fi) 12 13# 14# Make "config" the default target if there is no configuration file or 15# "depend" the target if there is no top-level dependency information. 16# 17ifeq (.config,$(wildcard .config)) 18include .config 19ifeq (.depend,$(wildcard .depend)) 20include .depend 21else 22CONFIGURATION = depend 23endif 24else 25CONFIGURATION = config 26endif 27 28ifdef CONFIGURATION 29CONFIGURE = dummy 30endif 31 32# 33# ROOT_DEV specifies the default root-device when making the image. 34# This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case 35# the default of FLOPPY is used by 'build'. 36# 37 38ROOT_DEV = CURRENT 39 40# 41# If you want to preset the SVGA mode, uncomment the next line and 42# set SVGA_MODE to whatever number you want. 43# Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode. 44# The number is the same as you would ordinarily press at bootup. 45# 46 47SVGA_MODE= -DSVGA_MODE=NORMAL_VGA 48 49# 50# standard CFLAGS 51# 52 53CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe 54 55ifdef CONFIG_CPP 56CFLAGS := $(CFLAGS) -x c++ 57endif 58 59ifdef CONFIG_M486 60CFLAGS := $(CFLAGS) -m486 61else 62CFLAGS := $(CFLAGS) -m386 63endif 64 65# 66# if you want the ram-disk device, define this to be the 67# size in blocks. 68# 69 70#RAMDISK = -DRAMDISK=512 71 72AS86 =as86 -0 -a 73LD86 =ld86 -0 74 75AS =as 76LD =ld 77LDFLAGS =#-qmagic 78HOSTCC =gcc 79CC =gcc -D__KERNEL__ 80MAKE =make 81CPP =$(CC) -E 82AR =ar 83STRIP =strip 84 85ARCHIVES =kernel/kernel.o mm/mm.o fs/fs.o net/net.o ipc/ipc.o 86FILESYSTEMS =fs/filesystems.a 87DRIVERS =drivers/block/block.a \ 88 drivers/char/char.a \ 89 drivers/net/net.a \ 90 ibcs/ibcs.o 91LIBS =lib/lib.a 92SUBDIRS =kernel drivers mm fs net ipc ibcs lib 93 94KERNELHDRS =/usr/src/linux/include 95 96ifdef CONFIG_SCSI 97DRIVERS := $(DRIVERS) drivers/scsi/scsi.a 98endif 99 100ifdef CONFIG_SOUND 101DRIVERS := $(DRIVERS) drivers/sound/sound.a 102endif 103 104ifdef CONFIG_MATH_EMULATION 105DRIVERS := $(DRIVERS) drivers/FPU-emu/math.a 106endif 107 108.c.s: 109 $(CC) $(CFLAGS) -S -o $*.s $< 110.s.o: 111 $(AS) -c -o $*.o $< 112.c.o: 113 $(CC) $(CFLAGS) -c -o $*.o $< 114 115Version: dummy 116 rm -f tools/version.h 117 118config: 119 $(CONFIG_SHELL) Configure $(OPTS) < config.in 120 @if grep -s '^CONFIG_SOUND' .tmpconfig ; then \ 121 $(MAKE) -C drivers/sound config; \ 122 else : ; fi 123 mv .tmpconfig .config 124 125linuxsubdirs: dummy 126 set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done 127 128tools/./version.h: tools/version.h 129 130tools/version.h: $(CONFIGURE) Makefile 131 @./makever.sh 132 @echo \#define UTS_RELEASE \"$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)\" > tools/version.h 133 @echo \#define UTS_VERSION \"\#`cat .version` `date`\" >> tools/version.h 134 @echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> tools/version.h 135 @echo \#define LINUX_COMPILE_BY \"`whoami`\" >> tools/version.h 136 @echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> tools/version.h 137 @echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\" >> tools/version.h 138 139tools/build: tools/build.c $(CONFIGURE) 140 $(HOSTCC) $(CFLAGS) -o $@ $< 141 142boot/head.o: $(CONFIGURE) boot/head.s 143 144boot/head.s: boot/head.S $(CONFIGURE) include/linux/tasks.h 145 $(CPP) -traditional $< -o $@ 146 147tools/version.o: tools/version.c tools/version.h 148 149init/main.o: $(CONFIGURE) init/main.c 150 $(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $< 151 152tools/system: boot/head.o init/main.o tools/version.o linuxsubdirs 153 $(LD) $(LDFLAGS) -Ttext 1000 boot/head.o init/main.o tools/version.o \ 154 $(ARCHIVES) \ 155 $(FILESYSTEMS) \ 156 $(DRIVERS) \ 157 $(LIBS) \ 158 -o tools/system 159 nm tools/zSystem | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | \ 160 sort > System.map 161 162boot/setup: boot/setup.o 163 $(LD86) -s -o $@ $< 164 165boot/setup.o: boot/setup.s 166 $(AS86) -o $@ $< 167 168boot/setup.s: boot/setup.S $(CONFIGURE) include/linux/config.h Makefile 169 $(CPP) -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@ 170 171boot/bootsect: boot/bootsect.o 172 $(LD86) -s -o $@ $< 173 174boot/bootsect.o: boot/bootsect.s 175 $(AS86) -o $@ $< 176 177boot/bootsect.s: boot/bootsect.S $(CONFIGURE) include/linux/config.h Makefile 178 $(CPP) -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@ 179 180zBoot/zSystem: zBoot/*.c zBoot/*.S tools/zSystem 181 $(MAKE) -C zBoot 182 183zImage: $(CONFIGURE) boot/bootsect boot/setup zBoot/zSystem tools/build 184 tools/build boot/bootsect boot/setup zBoot/zSystem $(ROOT_DEV) > zImage 185 sync 186 187zdisk: zImage 188 dd bs=8192 if=zImage of=/dev/fd0 189 190zlilo: $(CONFIGURE) zImage 191 if [ -f /vmlinuz ]; then mv /vmlinuz /vmlinuz.old; fi 192 if [ -f /zSystem.map ]; then mv /zSystem.map /zSystem.old; fi 193 cat zImage > /vmlinuz 194 cp zSystem.map / 195 if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi 196 197tools/zSystem: boot/head.o init/main.o tools/version.o linuxsubdirs 198 $(LD) $(LDFLAGS) -Ttext 100000 boot/head.o init/main.o tools/version.o \ 199 $(ARCHIVES) \ 200 $(FILESYSTEMS) \ 201 $(DRIVERS) \ 202 $(LIBS) \ 203 -o tools/zSystem 204 nm tools/zSystem | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | \ 205 sort > zSystem.map 206 207fs: dummy 208 $(MAKE) linuxsubdirs SUBDIRS=fs 209 210lib: dummy 211 $(MAKE) linuxsubdirs SUBDIRS=lib 212 213mm: dummy 214 $(MAKE) linuxsubdirs SUBDIRS=mm 215 216ipc: dummy 217 $(MAKE) linuxsubdirs SUBDIRS=ipc 218 219kernel: dummy 220 $(MAKE) linuxsubdirs SUBDIRS=kernel 221 222drivers: dummy 223 $(MAKE) linuxsubdirs SUBDIRS=drivers 224 225net: dummy 226 $(MAKE) linuxsubdirs SUBDIRS=net 227 228clean: 229 rm -f kernel/ksyms.lst 230 rm -f core `find . -name '*.[oas]' -print` 231 rm -f core `find . -name 'core' -print` 232 rm -f zImage zSystem.map tools/zSystem tools/system 233 rm -f Image System.map boot/bootsect boot/setup 234 rm -f zBoot/zSystem zBoot/xtract zBoot/piggyback 235 rm -f .tmp* drivers/sound/configure 236 rm -f init/*.o tools/build boot/*.o tools/*.o 237 238mrproper: clean 239 rm -f include/linux/autoconf.h tools/version.h 240 rm -f drivers/sound/local.h 241 rm -f .version .config* config.old 242 rm -f .depend `find . -name .depend -print` 243 244distclean: mrproper 245 246backup: mrproper 247 cd .. && tar cf - linux | gzip -9 > backup.gz 248 sync 249 250depend dep: 251 touch tools/version.h 252 for i in init/*.c;do echo -n "init/";$(CPP) -M $$i;done > .tmpdepend 253 for i in tools/*.c;do echo -n "tools/";$(CPP) -M $$i;done >> .tmpdepend 254 set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i dep; done 255 rm -f tools/version.h 256 mv .tmpdepend .depend 257 258ifdef CONFIGURATION 259..$(CONFIGURATION): 260 @echo 261 @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'" 262 @echo 263 $(MAKE) $(CONFIGURATION) 264 @echo 265 @echo "Successful. Try re-making (ignore the error that follows)" 266 @echo 267 exit 1 268 269dummy: ..$(CONFIGURATION) 270 271else 272 273dummy: 274 275endif 276 277# 278# Leave these dummy entries for now to tell people that they are going away.. 279# 280lilo: 281 @echo 282 @echo Uncompressed kernel images no longer supported. Use 283 @echo \"make zlilo\" instead. 284 @echo 285 @exit 1 286 287Image: 288 @echo 289 @echo Uncompressed kernel images no longer supported. Use 290 @echo \"make zImage\" instead. 291 @echo 292 @exit 1 293 294disk: 295 @echo 296 @echo Uncompressed kernel images no longer supported. Use 297 @echo \"make zdisk\" instead. 298 @echo 299 @exit 1 300

