xref: /xv6-public/Makefile (revision 8b4e2a08)
1OBJS = main.o console.o string.o kalloc.o proc.o trapasm.o trap.o vectors.o \
2       syscall.o ide.o picirq.o mp.o spinlock.o fd.o pipe.o
3
4CC = i386-jos-elf-gcc
5LD = i386-jos-elf-ld
6OBJCOPY = i386-jos-elf-objcopy
7OBJDUMP = i386-jos-elf-objdump
8CFLAGS = -nostdinc -I. -O2 -Wall -MD
9
10xv6.img : bootblock kernel
11	dd if=/dev/zero of=xv6.img count=10000
12	dd if=bootblock of=xv6.img conv=notrunc
13	dd if=kernel of=xv6.img seek=1 conv=notrunc
14
15bootblock : bootasm.S bootmain.c
16	$(CC) -O -nostdinc -I. -c bootmain.c
17	$(CC) -nostdinc -I. -c bootasm.S
18	$(LD) -N -e start -Ttext 0x7C00 -o bootblock.o bootasm.o bootmain.o
19	$(OBJDUMP) -S bootblock.o > bootblock.asm
20	$(OBJCOPY) -S -O binary bootblock.o bootblock
21	./sign.pl bootblock
22
23kernel : $(OBJS) bootother.S user1 usertests
24	$(CC) -nostdinc -I. -c bootother.S
25	$(LD) -N -e start -Ttext 0x7000 -o bootother.out bootother.o
26	$(OBJCOPY) -S -O binary bootother.out bootother
27	$(OBJDUMP) -S bootother.o > bootother.asm
28	$(LD) -Ttext 0x100000 -e main -o kernel $(OBJS) -b binary bootother user1 usertests
29	$(OBJDUMP) -S kernel > kernel.asm
30
31vectors.S : vectors.pl
32	perl vectors.pl > vectors.S
33
34user1 : user1.c ulib.o
35	$(CC) -nostdinc -I. -c user1.c
36	$(LD) -N -e main -Ttext 0 -o user1 user1.o ulib.o
37	$(OBJDUMP) -S user1 > user1.asm
38
39usertests : usertests.c ulib.o
40	$(CC) -nostdinc -I. -c usertests.c
41	$(LD) -N -e main -Ttext 0 -o usertests usertests.o ulib.o
42	$(OBJDUMP) -S usertests > usertests.asm
43
44ulib.o : ulib.c
45	$(CC) -nostdinc -I. -c ulib.c
46
47-include *.d
48
49clean :
50	rm -f *.o bootblock kernel kernel.asm xv6.img *.d user1
51