VPATH := $(TOP_SRCDIR)/threads
VPATH := $(VPATH):$(TOP_SRCDIR)/devices
VPATH := $(VPATH):$(TOP_SRCDIR)/lib
VPATH := $(VPATH):$(TOP_SRCDIR)/filesys
VPATH := $(VPATH):$(TOP_SRCDIR)/userprog
VPATH := $(TOP_SRCDIR)/threads
VPATH := $(VPATH):$(TOP_SRCDIR)/devices
VPATH := $(VPATH):$(TOP_SRCDIR)/lib
VPATH := $(VPATH):$(TOP_SRCDIR)/filesys
VPATH := $(VPATH):$(TOP_SRCDIR)/userprog
ASFLAGS = -Wa,--gstabs+ $(INCLUDES) $(DEFINES)
# Core kernel.
THREADS_SRC = start.S # Must be linked first.
ASFLAGS = -Wa,--gstabs+ $(INCLUDES) $(DEFINES)
# Core kernel.
THREADS_SRC = start.S # Must be linked first.
THREADS_SRC += thread.c # Thread management core.
THREADS_SRC += switch.S # Thread switch routine.
THREADS_SRC += interrupt.c # Interrupt core.
THREADS_SRC += thread.c # Thread management core.
THREADS_SRC += switch.S # Thread switch routine.
THREADS_SRC += interrupt.c # Interrupt core.
LIB_SRC += random.c # Pseudo-random numbers.
LIB_SRC += list.c # Doubly-linked lists.
LIB_SRC += bitmap.c # Bitmaps.
LIB_SRC += random.c # Pseudo-random numbers.
LIB_SRC += list.c # Doubly-linked lists.
LIB_SRC += bitmap.c # Bitmaps.
-FILESYS_SRC += file.c # Individual files.
-FILESYS_SRC += filesys-stub.c # Stub helper code.
+FILESYS_SRC += file.c # Files.
+FILESYS_SRC += directory.c # Directories.
+FILESYS_SRC += filehdr.c # File headers (inodes).
+FILESYS_SRC += fsutil.c # Utilities.
-kernel.o: $(OBJECTS)
- ld -T $(TOP_SRCDIR)/threads/kernel.lds -o $@ $^ \
- `$(CC) -print-libgcc-file-name`
+kernel.lds.s: $(TOP_SRCDIR)/threads/kernel.lds.S $(TOP_SRCDIR)/threads/loader.h
+ $(CPP) -x assembler-with-cpp -P $< -o $@
+
+kernel.o: $(OBJECTS) kernel.lds.s
+ ld -T kernel.lds.s -o $@ $(OBJECTS) `$(CC) -print-libgcc-file-name`
gcc -c $< -DKERNEL_LOAD_PAGES=`perl -e 'print +(-s "kernel.bin") / 4096;'`
ld -N -e start -Ttext 0x7c00 --oformat binary -o $@ loader.o
gcc -c $< -DKERNEL_LOAD_PAGES=`perl -e 'print +(-s "kernel.bin") / 4096;'`
ld -N -e start -Ttext 0x7c00 --oformat binary -o $@ loader.o