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

