Makefile 6.07 KB
Newer Older
1
#
2 3
# Make "config" the default target if there is no configuration file or
# "depend" the target if there is no top-level dependency information.
4 5
#
ifeq (.config,$(wildcard .config))
6
include .config
7 8 9 10 11
ifeq (.depend,$(wildcard .depend))
include .depend
else
CONFIGURATION = depend
endif
12 13 14
else
CONFIGURATION = config
endif
15

16 17 18 19
ifdef CONFIGURATION
CONFIGURE = dummy
endif

20
#
21 22 23
# ROOT_DEV specifies the default root-device when making the image.
# This can be either FLOPPY, /dev/xxxx or empty, in which case the
# default of FLOPPY is used by 'build'.
24 25
#

26
ROOT_DEV = /dev/hdb1
27 28 29 30

#
# uncomment the correct keyboard:
#
31 32
# The value of KBDFLAGS should be or'ed together from the following
# bits, depending on which features you want enabled.
33
#
34 35 36 37 38 39 40 41
# The least significant bits control if the following keys are "dead".
# The key is dead by default if the bit is on.
# 0x01 - backquote (`)
# 0x02 - accent acute
# 0x04 - circumflex (^)
# 0x08 - tilde (~)
# 0x10 - dieresis (umlaut)

42
KEYBOARD = -DKBD_FINNISH -DKBDFLAGS=0
43
# KEYBOARD = -DKBD_FINNISH_LATIN1 -DKBDFLAGS=0x9F
44
# KEYBOARD = -DKBD_US -DKBDFLAGS=0
45 46 47 48 49 50 51 52 53 54
# KEYBOARD = -DKBD_GR -DKBDFLAGS=0
# KEYBOARD = -DKBD_GR_LATIN1 -DKBDFLAGS=0x9F
# KEYBOARD = -DKBD_FR -DKBDFLAGS=0
# KEYBOARD = -DKBD_FR_LATIN1 -DKBDFLAGS=0x9F
# KEYBOARD = -DKBD_UK -DKBDFLAGS=0
# KEYBOARD = -DKBD_DK -DKBDFLAGS=0
# KEYBOARD = -DKBD_DK_LATIN1 -DKBDFLAGS=0x9F
# KEYBOARD = -DKBD_DVORAK -DKBDFLAGS=0
# KEYBOARD = -DKBD_SG -DKBDFLAGS=0
# KEYBOARD = -DKBD_SG_LATIN1 -DKBDFLAGS=0x9F
55 56
# KEYBOARD = -DKBD_SF -DKBDFLAGS=0
# KEYBOARD = -DKBD_SF_LATIN1 -DKBDFLAGS=0x9F
57
# KEYBOARD = -DKBD_NO -DKBDFLAGS=0
58

59 60 61 62 63 64 65 66
#
# If you want to preset the SVGA mode, uncomment the next line and
# set SVGA_MODE to whatever number you want.
# Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
# The number is the same as you would ordinarily press at bootup.
#

SVGA_MODE=	-DSVGA_MODE=1
67

68 69 70 71 72 73 74 75
# 
# Edit the SOUND_SUPPORT line to suit your setup if you have configured
# the sound driver to be in the kernel (not really there yet).
#
# The DSP_BUFFSIZE defines size of the DMA buffer used for PCM voice I/O. 
# You should use one of the values 4096 (SB), 16384 (SB Pro), 32768 (PAS+) 
# or 65536 (PAS16). The SBC_IRQ defines the IRQ line used by SoundBlaster and
# the PAS_IRQ is the IRQ number for ProAudioSpectrum.
76
#
77 78 79

SOUND_SUPPORT = -DKERNEL_SOUNDCARD -DDSP_BUFFSIZE=16384 -DSBC_IRQ=7 -DPAS_IRQ=5

80
#
81
# standard CFLAGS
82 83
#

84
CFLAGS = -Wall -O6 -fomit-frame-pointer
85

86 87 88 89
ifdef CONFIG_M486
CFLAGS := $(CFLAGS) -m486
endif

Linus Torvalds's avatar
Linus Torvalds committed
90 91 92 93
#
# if you want the ram-disk device, define this to be the
# size in blocks.
#
94

95
#RAMDISK = -DRAMDISK=512
96

Linus Torvalds's avatar
Linus Torvalds committed
97 98
AS86	=as86 -0 -a
LD86	=ld86 -0
99

100 101
AS	=as
LD	=ld
102
HOSTCC	=gcc
103
CC	=gcc -DKERNEL
104
MAKE	=make
105
CPP	=$(CC) -E
106
AR	=ar
107
STRIP	=strip
108 109

ARCHIVES	=kernel/kernel.o mm/mm.o fs/fs.o net/net.o
110
FILESYSTEMS	=fs/filesystems.a
111
DRIVERS		=kernel/blk_drv/blk_drv.a kernel/chr_drv/chr_drv.a \
112
		 kernel/blk_drv/scsi/scsi.a kernel/chr_drv/sound/sound.a
113
MATH		=kernel/FPU-emu/math.a
114
LIBS		=lib/lib.a
115 116 117
SUBDIRS		=kernel mm fs net lib

KERNELHDRS	=/usr/src/linux/include
118 119

.c.s:
120
	$(CC) $(CFLAGS) -S -o $*.s $<
121 122 123
.s.o:
	$(AS) -c -o $*.o $<
.c.o:
124
	$(CC) $(CFLAGS) -c -o $*.o $<
125

126 127
all:	Version Image

128 129 130 131
Version: dummy
	rm tools/version.h

lilo: $(CONFIGURE) Image
132
	if [ -f /vmlinux ]; then mv /vmlinux /vmlinux.old; fi
133 134
	cat Image > /vmlinux
	/etc/lilo/install
135

136 137
config:
	sh Configure < config.in
138
	mv .config~ .config
139

140
linuxsubdirs: dummy
141
	@for i in $(SUBDIRS); do (cd $$i && echo $$i && $(MAKE)) || exit; done
142

143
tools/version.h: $(CONFIGURE) Makefile
144
	@./makever.sh
145
	@echo \#define UTS_RELEASE \"0.99.pl3-`cat .version`\" > tools/version.h
146 147 148 149
	@echo \#define UTS_VERSION \"`date +%D`\" >> tools/version.h
	@echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> tools/version.h
	@echo \#define LINUX_COMPILE_BY \"`whoami`\" >> tools/version.h
	@echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> tools/version.h
150

151
Image: $(CONFIGURE) boot/bootsect boot/setup tools/system tools/build
152
	cp tools/system system.tmp
153
	$(STRIP) system.tmp
154 155
	tools/build boot/bootsect boot/setup system.tmp $(ROOT_DEV) > Image
	rm system.tmp
156 157
	sync

Linus Torvalds's avatar
Linus Torvalds committed
158
disk: Image
159
	dd bs=8192 if=Image of=/dev/fd0
Linus Torvalds's avatar
Linus Torvalds committed
160

161
tools/build: $(CONFIGURE) tools/build.c
162
	$(HOSTCC) $(CFLAGS) \
163 164
	-o tools/build tools/build.c

165
boot/head.o: $(CONFIGURE) boot/head.s
166

167
boot/head.s: $(CONFIGURE) boot/head.S
168 169
	$(CPP) -traditional boot/head.S -o boot/head.s

170 171
tools/version.o: tools/version.c tools/version.h

172
init/main.o: $(CONFIGURE) init/main.c
173 174
	$(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<

175 176
tools/system:	boot/head.o init/main.o tools/version.o linuxsubdirs
	$(LD) $(LDFLAGS) -M boot/head.o init/main.o tools/version.o \
177 178 179 180 181 182
		$(ARCHIVES) \
		$(FILESYSTEMS) \
		$(DRIVERS) \
		$(MATH) \
		$(LIBS) \
		-o tools/system > System.map
183

Linus Torvalds's avatar
Linus Torvalds committed
184 185 186
boot/setup: boot/setup.s
	$(AS86) -o boot/setup.o boot/setup.s
	$(LD86) -s -o boot/setup boot/setup.o
187

188
boot/setup.s: $(CONFIGURE) boot/setup.S include/linux/config.h Makefile
189
	$(CPP) -traditional $(SVGA_MODE) $(RAMDISK) boot/setup.S -o boot/setup.s
Linus Torvalds's avatar
Linus Torvalds committed
190

191
boot/bootsect.s: $(CONFIGURE) boot/bootsect.S include/linux/config.h Makefile
192
	$(CPP) -traditional $(SVGA_MODE) $(RAMDISK) boot/bootsect.S -o boot/bootsect.s
Linus Torvalds's avatar
Linus Torvalds committed
193

Linus Torvalds's avatar
Linus Torvalds committed
194 195 196
boot/bootsect:	boot/bootsect.s
	$(AS86) -o boot/bootsect.o boot/bootsect.s
	$(LD86) -s -o boot/bootsect boot/bootsect.o
197

198 199 200
fs: dummy
	$(MAKE) linuxsubdirs SUBDIRS=fs

201 202 203 204 205 206
mm: dummy
	$(MAKE) linuxsubdirs SUBDIRS=mm

kernel: dummy
	$(MAKE) linuxsubdirs SUBDIRS=kernel

207
clean:
208
	rm -f Image System.map core boot/bootsect boot/setup \
209
		boot/bootsect.s boot/setup.s boot/head.s init/main.s
210
	rm -f init/*.o tools/system tools/build boot/*.o tools/*.o
211
	for i in $(SUBDIRS); do (cd $$i && $(MAKE) clean); done
212 213

backup: clean
214
	cd .. && tar cf - linux | compress - > backup.Z
215 216
	sync

217
depend dep:
218 219
	for i in init/*.c;do echo -n "init/";$(CPP) -M $$i;done > .depend~
	for i in tools/*.c;do echo -n "tools/";$(CPP) -M $$i;done >> .depend~
220
	for i in $(SUBDIRS); do (cd $$i && $(MAKE) dep) || exit; done
221
	mv .depend~ .depend
222

223 224 225 226 227 228 229 230 231 232
ifdef CONFIGURATION
..$(CONFIGURATION):
	@echo
	@echo "You have no" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
	@echo
	$(MAKE) $(CONFIGURATION)
	@echo
	@echo "Successful. Try re-making (ignore the error that follows)"
	@echo
	exit 1
233

234
dummy: ..$(CONFIGURATION)
235

236 237 238 239 240
else

dummy:

endif