xv6-cs450/Makefile

133 lines
3.1 KiB
Makefile
Raw Normal View History

2006-07-16 17:35:18 +02:00
OBJS = \
console.o\
2006-09-06 20:40:28 +02:00
file.o\
2006-07-16 17:35:18 +02:00
ide.o\
kalloc.o\
lapic.o\
ioapic.o\
2006-07-16 17:35:18 +02:00
main.o\
mp.o\
picirq.o\
pipe.o\
proc.o\
setjmp.o\
spinlock.o\
string.o\
syscall.o\
2006-09-06 20:18:43 +02:00
sysfile.o\
sysproc.o\
2006-07-16 17:35:18 +02:00
trapasm.o\
trap.o\
vectors.o\
bio.o\
fs.o\
8253pit.o\
2006-06-12 17:22:12 +02:00
2006-07-11 03:07:40 +02:00
# Cross-compiling (e.g., on Mac OS X)
TOOLPREFIX = i386-jos-elf-
# Using native tools (e.g., on X86 Linux)
# TOOLPREFIX =
CC = $(TOOLPREFIX)gcc
LD = $(TOOLPREFIX)ld
OBJCOPY = $(TOOLPREFIX)objcopy
OBJDUMP = $(TOOLPREFIX)objdump
2006-07-17 03:51:47 +02:00
CFLAGS = -fno-builtin -O2 -Wall -MD
2006-07-11 03:07:40 +02:00
AS = $(TOOLPREFIX)gas
2006-06-12 17:22:12 +02:00
xv6.img : bootblock kernel fs.img
2006-06-12 17:22:12 +02:00
dd if=/dev/zero of=xv6.img count=10000
dd if=bootblock of=xv6.img conv=notrunc
dd if=kernel of=xv6.img seek=1 conv=notrunc
bootblock : bootasm.S bootmain.c
$(CC) -O -nostdinc -I. -c bootmain.c
$(CC) -nostdinc -I. -c bootasm.S
$(LD) -N -e start -Ttext 0x7C00 -o bootblock.o bootasm.o bootmain.o
$(OBJDUMP) -S bootblock.o > bootblock.asm
$(OBJCOPY) -S -O binary bootblock.o bootblock
./sign.pl bootblock
2006-09-07 16:10:52 +02:00
kernel : $(OBJS) bootother.S _init
$(CC) -nostdinc -I. -c bootother.S
$(LD) -N -e start -Ttext 0x7000 -o bootother.out bootother.o
$(OBJCOPY) -S -O binary bootother.out bootother
$(OBJDUMP) -S bootother.o > bootother.asm
2006-09-07 16:10:52 +02:00
$(LD) -Ttext 0x100000 -e main0 -o kernel $(OBJS) -b binary bootother _init
2006-06-12 17:22:12 +02:00
$(OBJDUMP) -S kernel > kernel.asm
2006-09-07 16:10:52 +02:00
tags: $(OBJS) bootother.S _init
etags *.S *.c
2006-08-29 19:50:19 +02:00
PRINT = \
runoff.list \
2006-08-29 19:50:19 +02:00
README\
types.h param.h defs.h x86.h asm.h elf.h mmu.h spinlock.h\
2006-09-07 16:10:52 +02:00
bootasm.S bootother.S main.c _init.c spinlock.c\
proc.h proc.c setjmp.S kalloc.c\
2006-09-06 21:22:24 +02:00
syscall.h trapasm.S traps.h trap.c vectors.pl syscall.c sysproc.c\
buf.h dev.h fcntl.h stat.h file.h fs.h fsvar.h fd.c fs.c bio.c ide.c sysfile.c\
pipe.c\
mp.h ioapic.h mp.c lapic.c ioapic.c picirq.c\
console.c\
string.c\
# make a printout
xv6.pdf : $(PRINT)
./runoff
print : xv6.pdf
2006-06-13 17:50:06 +02:00
vectors.S : vectors.pl
perl vectors.pl > vectors.S
ULIB = ulib.o usys.o printf.o umalloc.o
2006-07-11 03:07:40 +02:00
2006-07-16 17:35:18 +02:00
usertests : usertests.o $(ULIB)
2006-07-11 03:07:40 +02:00
$(LD) -N -e main -Ttext 0 -o usertests usertests.o $(ULIB)
2006-06-27 16:35:53 +02:00
$(OBJDUMP) -S usertests > usertests.asm
2006-09-07 15:07:39 +02:00
_echo : echo.o $(ULIB)
$(LD) -N -e main -Ttext 0 -o _echo echo.o $(ULIB)
$(OBJDUMP) -S _echo > echo.asm
2006-07-29 00:33:07 +02:00
2006-09-07 15:07:39 +02:00
_cat : cat.o $(ULIB)
$(LD) -N -e main -Ttext 0 -o _cat cat.o $(ULIB)
$(OBJDUMP) -S _cat > cat.asm
2006-09-07 15:07:39 +02:00
_init : init.o $(ULIB)
$(LD) -N -e main -Ttext 0 -o _init init.o $(ULIB)
$(OBJDUMP) -S _init > init.asm
2006-09-07 15:07:39 +02:00
_sh : sh.o $(ULIB)
$(LD) -N -e main -Ttext 0 -o _sh sh.o $(ULIB)
$(OBJDUMP) -S _sh > sh.asm
2006-09-07 15:07:39 +02:00
_ls : ls.o $(ULIB)
$(LD) -N -e main -Ttext 0 -o _ls ls.o $(ULIB)
$(OBJDUMP) -S _ls > ls.asm
2006-08-12 06:33:50 +02:00
2006-09-07 15:07:39 +02:00
_mkdir : mkdir.o $(ULIB)
$(LD) -N -e main -Ttext 0 -o _mkdir mkdir.o $(ULIB)
$(OBJDUMP) -S _mkdir > mkdir.asm
2006-09-07 15:07:39 +02:00
_rm : rm.o $(ULIB)
$(LD) -N -e main -Ttext 0 -o _rm rm.o $(ULIB)
$(OBJDUMP) -S _rm > rm.asm
mkfs : mkfs.c fs.h
cc -o mkfs mkfs.c
2006-09-07 15:23:41 +02:00
fs.img : mkfs usertests _echo _cat README _init _sh _ls _mkdir _rm fstests
./mkfs fs.img usertests _echo _cat README _init _sh _ls _mkdir _rm fstests
2006-06-15 21:58:01 +02:00
-include *.d
2006-06-12 17:22:12 +02:00
clean :
2006-09-06 20:18:43 +02:00
/bin/rm -f rm
2006-09-03 16:38:10 +02:00
rm -f *.ps *.tex *.dvi *.idx *.aux *.log *.ind *.ilg \
2006-08-29 19:50:19 +02:00
*.o *.d *.asm vectors.S parport.out \
2006-09-07 15:23:41 +02:00
bootblock kernel xv6.img usertests \
fs.img mkfs echo init