diff options
Diffstat (limited to 'src/Makefile')
-rw-r--r-- | src/Makefile | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..581dbeb --- /dev/null +++ b/src/Makefile | |||
@@ -0,0 +1,132 @@ | |||
1 | # if you want the ram-disk device, define this to be the | ||
2 | # size in blocks. | ||
3 | # | ||
4 | RAMDISK = #-DRAMDISK=512 | ||
5 | |||
6 | # This is a basic Makefile for setting the general configuration | ||
7 | include Makefile.header | ||
8 | |||
9 | LDFLAGS += -Ttext 0 -e startup_32 | ||
10 | CFLAGS += $(RAMDISK) -Iinclude | ||
11 | CPP += -Iinclude | ||
12 | |||
13 | # | ||
14 | # ROOT_DEV specifies the default root-device when making the image. | ||
15 | # This can be either FLOPPY, /dev/xxxx or empty, in which case the | ||
16 | # default of /dev/hd6 is used by 'build'. | ||
17 | # | ||
18 | ROOT_DEV= #FLOPPY | ||
19 | |||
20 | ARCHIVES=kernel/kernel.o mm/mm.o fs/fs.o | ||
21 | DRIVERS =kernel/blk_drv/blk_drv.a kernel/chr_drv/chr_drv.a | ||
22 | MATH =kernel/math/math.a | ||
23 | LIBS =lib/lib.a | ||
24 | |||
25 | .c.s: | ||
26 | @$(CC) $(CFLAGS) -S -o $*.s $< | ||
27 | .s.o: | ||
28 | @$(AS) -o $*.o $< | ||
29 | .c.o: | ||
30 | @$(CC) $(CFLAGS) -c -o $*.o $< | ||
31 | |||
32 | all: Image | ||
33 | |||
34 | Image: boot/bootsect boot/setup tools/system | ||
35 | @cp -f tools/system system.tmp | ||
36 | @$(STRIP) system.tmp | ||
37 | @$(OBJCOPY) -O binary -R .note -R .comment -R .note.gnu.property system.tmp tools/kernel | ||
38 | @tools/build.sh boot/bootsect boot/setup tools/kernel Image $(ROOT_DEV) | ||
39 | @rm system.tmp | ||
40 | @rm -f tools/kernel | ||
41 | @sync | ||
42 | |||
43 | disk: Image | ||
44 | @dd bs=8192 if=Image of=/dev/fd0 | ||
45 | |||
46 | boot/head.o: boot/head.s | ||
47 | @make head.o -C boot/ | ||
48 | |||
49 | tools/system: boot/head.o init/main.o \ | ||
50 | $(ARCHIVES) $(DRIVERS) $(MATH) $(LIBS) | ||
51 | @$(LD) $(LDFLAGS) boot/head.o init/main.o \ | ||
52 | $(ARCHIVES) \ | ||
53 | $(DRIVERS) \ | ||
54 | $(MATH) \ | ||
55 | $(LIBS) \ | ||
56 | -o tools/system | ||
57 | @nm tools/system | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)'| sort > System.map | ||
58 | |||
59 | kernel/math/math.a: | ||
60 | @make -C kernel/math | ||
61 | |||
62 | kernel/blk_drv/blk_drv.a: | ||
63 | @make -C kernel/blk_drv | ||
64 | |||
65 | kernel/chr_drv/chr_drv.a: | ||
66 | @make -C kernel/chr_drv | ||
67 | |||
68 | kernel/kernel.o: | ||
69 | @make -C kernel | ||
70 | |||
71 | mm/mm.o: | ||
72 | @make -C mm | ||
73 | |||
74 | fs/fs.o: | ||
75 | @make -C fs | ||
76 | |||
77 | lib/lib.a: | ||
78 | @make -C lib | ||
79 | |||
80 | boot/setup: boot/setup.s | ||
81 | @make setup -C boot | ||
82 | |||
83 | boot/bootsect: boot/bootsect.s | ||
84 | @make bootsect -C boot | ||
85 | |||
86 | tmp.s: boot/bootsect.s tools/system | ||
87 | @(echo -n "SYSSIZE = (";ls -l tools/system | grep system \ | ||
88 | | cut -c25-31 | tr '\012' ' '; echo "+ 15 ) / 16") > tmp.s | ||
89 | @cat boot/bootsect.s >> tmp.s | ||
90 | |||
91 | clean: | ||
92 | @rm -f Image System.map tmp_make core boot/bootsect boot/setup | ||
93 | @rm -f init/*.o tools/system boot/*.o typescript* info bochsout.txt | ||
94 | @for i in mm fs kernel lib boot; do make clean -C $$i; done | ||
95 | info: | ||
96 | @make clean | ||
97 | @script -q -c "make all" | ||
98 | @cat typescript | col -bp | grep -E "warning|Error" > info | ||
99 | @cat info | ||
100 | |||
101 | distclean: clean | ||
102 | @rm -f tag cscope* linux-0.11.* $(CALLTREE) | ||
103 | @(find tools/calltree-2.3 -name "*.o" | xargs -i rm -f {}) | ||
104 | @make clean -C tools/calltree-2.3 | ||
105 | @make clean -C tools/bochs/bochs-2.3.7 | ||
106 | |||
107 | backup: clean | ||
108 | @(cd .. ; tar cf - linux | compress16 - > backup.Z) | ||
109 | @sync | ||
110 | |||
111 | dep: | ||
112 | @sed '/\#\#\# Dependencies/q' < Makefile > tmp_make | ||
113 | @(for i in init/*.c;do echo -n "init/";$(CPP) -M $$i;done) >> tmp_make | ||
114 | @cp tmp_make Makefile | ||
115 | @for i in fs kernel mm; do make dep -C $$i; done | ||
116 | |||
117 | tag: tags | ||
118 | tags: | ||
119 | @ctags -R | ||
120 | |||
121 | cscope: | ||
122 | @cscope -Rbkq | ||
123 | |||
124 | |||
125 | |||
126 | ### Dependencies: | ||
127 | init/main.o: init/main.c include/unistd.h include/sys/stat.h \ | ||
128 | include/sys/types.h include/sys/times.h include/sys/utsname.h \ | ||
129 | include/utime.h include/time.h include/linux/tty.h include/termios.h \ | ||
130 | include/linux/sched.h include/linux/head.h include/linux/fs.h \ | ||
131 | include/linux/mm.h include/signal.h include/asm/system.h \ | ||
132 | include/asm/io.h include/stddef.h include/stdarg.h include/fcntl.h | ||