Redo makefiles.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 5 Sep 2004 21:55:24 +0000 (21:55 +0000)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 5 Sep 2004 21:55:24 +0000 (21:55 +0000)
Adjust all #include lines appropriately.

45 files changed:
src/Makefile.build [new file with mode: 0644]
src/Makefile.inc [deleted file]
src/Makefile.kernel [new file with mode: 0644]
src/devices/16550a.h
src/devices/disk.c
src/devices/kbd.c
src/devices/serial.c
src/devices/timer.c
src/devices/vga.c
src/filesys/Makefile
src/filesys/Makefile.vars [new file with mode: 0644]
src/filesys/directory.c
src/filesys/directory.h
src/filesys/file.c
src/filesys/file.h
src/filesys/filehdr.c
src/filesys/filehdr.h
src/filesys/filesys.c
src/filesys/fsutil.c
src/lib/bitmap.c
src/lib/debug.c
src/lib/hash.c
src/lib/lib.c
src/threads/Makefile
src/threads/Makefile.vars [new file with mode: 0644]
src/threads/init.c
src/threads/interrupt.c
src/threads/intr-stubs.pl
src/threads/malloc.c
src/threads/malloc.h
src/threads/mmu.h
src/threads/paging.c
src/threads/palloc.c
src/threads/synch.c
src/threads/synch.h
src/threads/thread.c
src/threads/thread.h
src/userprog/Makefile
src/userprog/Makefile.vars [new file with mode: 0644]
src/userprog/addrspace.c
src/userprog/exception.c
src/userprog/gdt.c
src/userprog/gdt.h
src/userprog/syscall.c
src/userprog/tss.c

diff --git a/src/Makefile.build b/src/Makefile.build
new file mode 100644 (file)
index 0000000..0a25309
--- /dev/null
@@ -0,0 +1,93 @@
+# -*- makefile -*-
+
+include ../Makefile.vars
+
+SHELL = /bin/sh
+
+CC = gcc
+
+SRC_ROOT = ../..
+VPATH = $(SRC_ROOT)
+
+WARNINGS = -Wall -W -Wstrict-prototypes -Wmissing-prototypes
+INCLUDES = -I$(SRC_ROOT)
+CFLAGS = -g -O3 -MMD -msoft-float $(INCLUDES) $(WARNINGS) $(DEFINES)
+ASFLAGS = -Wa,--gstabs $(INCLUDES) $(DEFINES)
+
+# Core kernel.
+threads_SRC  = threads/init.c          # Main program.
+threads_SRC += threads/thread.c                # Thread management core.
+threads_SRC += threads/switch.S                # Thread switch routine.
+threads_SRC += threads/interrupt.c     # Interrupt core.
+threads_SRC += threads/intr-stubs.S    # Interrupt stubs.
+threads_SRC += threads/synch.c         # Synchronization.
+threads_SRC += threads/paging.c                # Page tables.
+threads_SRC += threads/palloc.c                # Page allocator.
+threads_SRC += threads/malloc.c                # Subpage allocator.
+threads_SRC += threads/start.S         # Startup code.
+
+# Device driver code.
+devices_SRC  = devices/timer.c         # Timer device.
+devices_SRC += devices/kbd.c           # Keyboard device.
+devices_SRC += devices/vga.c           # Video device.
+devices_SRC += devices/serial.c                # Serial port device.
+devices_SRC += devices/disk.c          # IDE disk device.
+
+# Library code.
+lib_SRC  = lib/debug.c         # Debug helpers.
+lib_SRC += lib/lib.c           # Standard C library.
+lib_SRC += lib/random.c                # Pseudo-random numbers.
+lib_SRC += lib/list.c          # Doubly-linked lists.
+lib_SRC += lib/bitmap.c                # Bitmaps.
+lib_SRC += lib/hash.c          # Hash tables.
+
+# Filesystem code.
+filesys_SRC  = filesys/filesys.c       # Filesystem core.
+filesys_SRC += filesys/file.c          # Files.
+filesys_SRC += filesys/directory.c     # Directories.
+filesys_SRC += filesys/filehdr.c       # File headers (inodes).
+filesys_SRC += filesys/fsutil.c                # Utilities.
+
+# User process code.
+userprog_SRC  = userprog/addrspace.c   # Address spaces.
+userprog_SRC += userprog/exception.c   # User exception handler.
+userprog_SRC += userprog/syscall.c     # System call handler.
+userprog_SRC += userprog/gdt.c         # GDT initialization.
+userprog_SRC += userprog/tss.c         # TSS management.
+
+SOURCES = $(foreach dir,$(SUBDIRS),$($(dir)_SRC))
+OBJECTS = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(SOURCES)))
+DEPENDS = $(patsubst %.o,%.d,$(OBJECTS))
+
+all: os.dsk
+
+threads/intr-stubs.S: threads/intr-stubs.pl threads/loader.h
+       $< > $@
+
+threads/kernel.lds.s: CPPFLAGS += -P -C
+threads/kernel.lds.s: threads/kernel.lds.S threads/loader.h
+
+kernel.o: threads/kernel.lds.s $(OBJECTS) 
+       ld -T $< -o $@ $(OBJECTS) `$(CC) -print-libgcc-file-name`
+
+kernel.bin: kernel.o
+       objcopy -O binary -R .note -R .comment -S $< $@.tmp
+       $(SRC_ROOT)/pad 4096 < $@.tmp > $@
+       rm $@.tmp
+
+threads/loader.o: threads/loader.S threads/loader.h kernel.bin
+       gcc -c $< -o $@ -DKERNEL_LOAD_PAGES=`perl -e 'print +(-s "kernel.bin") / 4096;'`
+
+loader.bin: threads/loader.o
+       ld -N -e start -Ttext 0x7c00 --oformat binary -o $@ $<
+
+os.dsk: loader.bin kernel.bin
+       cat $^ > $@
+
+clean:
+       rm -f $(OBJECTS) $(DEPENDS) 
+       rm -f threads/intr-stubs.S threads/loader.o
+       rm -f kernel.o kernel.lds.s
+       rm -f kernel.bin loader.bin
+
+-include $(DEPENDS)
diff --git a/src/Makefile.inc b/src/Makefile.inc
deleted file mode 100644 (file)
index df6b010..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-# -*- makefile -*-
-
-SHELL = /bin/sh
-
-CC = gcc
-
-VPATH := $(TOP_SRCDIR)/threads
-VPATH := $(VPATH):$(TOP_SRCDIR)/devices
-VPATH := $(VPATH):$(TOP_SRCDIR)/lib
-VPATH := $(VPATH):$(TOP_SRCDIR)/filesys
-VPATH := $(VPATH):$(TOP_SRCDIR)/userprog
-
-WARNINGS = -Wall -W -Wstrict-prototypes -Wmissing-prototypes
-CFLAGS = -g -O3 -MMD -msoft-float $(WARNINGS) $(INCLUDES) $(DEFINES)
-ASFLAGS = -Wa,--gstabs $(INCLUDES) $(DEFINES)
-
-# Core kernel.
-THREADS_SRC  = init.c          # Main program.
-THREADS_SRC += thread.c                # Thread management core.
-THREADS_SRC += switch.S                # Thread switch routine.
-THREADS_SRC += interrupt.c     # Interrupt core.
-THREADS_SRC += intr-stubs.S    # Interrupt stubs.
-THREADS_SRC += synch.c         # Synchronization.
-THREADS_SRC += paging.c                # Page tables.
-THREADS_SRC += palloc.c                # Page allocator.
-THREADS_SRC += malloc.c                # Subpage allocator.
-THREADS_SRC += start.S         # Startup code.
-
-# Device driver code.
-DEVICES_SRC  = timer.c         # Timer device.
-DEVICES_SRC += kbd.c           # Keyboard device.
-DEVICES_SRC += vga.c           # Video device.
-DEVICES_SRC += serial.c                # Serial port device.
-DEVICES_SRC += disk.c          # IDE disk device.
-
-# Library code.
-LIB_SRC  = debug.c             # Debug helpers.
-LIB_SRC += lib.c               # Standard C library.
-LIB_SRC += random.c            # Pseudo-random numbers.
-LIB_SRC += list.c              # Doubly-linked lists.
-LIB_SRC += bitmap.c            # Bitmaps.
-LIB_SRC += hash.c              # Hash tables.
-
-# Filesystem code.
-FILESYS_SRC  = filesys.c       # Filesystem core.
-FILESYS_SRC += file.c          # Files.
-FILESYS_SRC += directory.c     # Directories.
-FILESYS_SRC += filehdr.c       # File headers (inodes).
-FILESYS_SRC += fsutil.c                # Utilities.
-
-# User process code.
-USERPROG_SRC  = addrspace.c    # Address spaces.
-USERPROG_SRC += exception.c    # User exception handler.
-USERPROG_SRC += syscall.c      # System call handler.
-USERPROG_SRC += gdt.c          # GDT initialization.
-USERPROG_SRC += tss.c          # TSS management.
-
-# Objects.
-OBJECTS = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(SOURCES)))
-
-all: diskimage.bin
-
-intr-stubs.S: $(TOP_SRCDIR)/threads/intr-stubs.pl $(TOP_SRCDIR)/threads/loader.h
-       $< > $@
-
-kernel.lds.s: CPPFLAGS += -P -C
-kernel.lds.s: $(TOP_SRCDIR)/threads/kernel.lds.S $(TOP_SRCDIR)/threads/loader.h
-
-kernel.o: $(OBJECTS) kernel.lds.s
-       ld -T kernel.lds.s -o $@ $(OBJECTS) `$(CC) -print-libgcc-file-name`
-
-kernel.bin: kernel.o
-       objcopy -O binary -R .note -R .comment -S $< $@.tmp
-       $(TOP_SRCDIR)/pad 4096 < $@.tmp > $@
-
-loader.bin: loader.S loader.h kernel.bin
-       gcc -c $< -DKERNEL_LOAD_PAGES=`perl -e 'print +(-s "kernel.bin") / 4096;'`
-       ld -N -e start -Ttext 0x7c00 --oformat binary -o $@ loader.o
-
-diskimage.bin: loader.bin kernel.bin
-       cat loader.bin kernel.bin > diskimage.bin
-
-clean:
-       rm -f *.o *.d *.bin
-       rm -f kernel.bin.data kernel.bin.pad intr-stubs.S kernel.lds.s
-
--include *.d
diff --git a/src/Makefile.kernel b/src/Makefile.kernel
new file mode 100644 (file)
index 0000000..9337203
--- /dev/null
@@ -0,0 +1,15 @@
+include Makefile.vars
+BUILD_SUBDIRS = $(addprefix build/, $(SUBDIRS))
+
+all: build build/Makefile $(BUILD_SUBDIRS)
+       $(MAKE) -C build
+
+$(BUILD_SUBDIRS):
+       mkdir $@
+build:
+       mkdir $@
+build/Makefile: ../Makefile.build
+       cp $< $@
+
+clean:
+       rm -rf build
index bfe948489dbcb0a052765794cb052f94842b5a60..9a1e37d733b0efe66482849618c183713d03cbcd 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <stdbool.h>
 #include <stdint.h>
-#include "debug.h"
+#include "lib/debug.h"
 
 /* Register definitions for the 16550A UART used in PCs.  This is
    a full definition of all the registers and their bits.  We
index dc0c1819cb0df583dcb40c7621697addd2d6ffd1..9e4b9f506358296c0eb2f9b49760059e12a95282 100644 (file)
@@ -1,11 +1,11 @@
 #include "disk.h"
 #include <stdbool.h>
-#include "debug.h"
-#include "io.h"
-#include "interrupt.h"
-#include "lib.h"
-#include "synch.h"
 #include "timer.h"
+#include "lib/debug.h"
+#include "lib/lib.h"
+#include "threads/io.h"
+#include "threads/interrupt.h"
+#include "threads/synch.h"
 
 /* ATA command block port addresses. */
 #define reg_data(CHANNEL) ((CHANNEL)->reg_base + 0)     /* Data. */
index 0bd2d99972f9a5deed372e4a528fd5d263a8ff74..867c64ae6b721897fd00405ab0ee94c3ccda28cc 100644 (file)
@@ -1,8 +1,8 @@
 #include "kbd.h"
-#include "debug.h"
-#include "interrupt.h"
-#include "io.h"
-#include "lib.h"
+#include "lib/debug.h"
+#include "lib/lib.h"
+#include "threads/interrupt.h"
+#include "threads/io.h"
 
 static void
 irq21_keyboard (struct intr_frame *args UNUSED) 
index e5b2fb7de3f0d5fe4fae45fbdf02fb6ee3cd0067..eeac40a165443e7c883022093a7d352627030126 100644 (file)
@@ -1,8 +1,8 @@
 #include "serial.h"
 #include "16550a.h"
-#include "debug.h"
-#include "io.h"
 #include "timer.h"
+#include "lib/debug.h"
+#include "threads/io.h"
 
 static void set_serial (int bps, int bits, enum parity_type parity, int stop);
 
index d23bed3efb043618feb465a4259c85c8f77e5868..85bc3ee33d3345fa519f6d3cbd80c1011aee01e1 100644 (file)
@@ -1,7 +1,7 @@
 #include "timer.h"
-#include "debug.h"
-#include "interrupt.h"
-#include "io.h"
+#include "lib/debug.h"
+#include "threads/interrupt.h"
+#include "threads/io.h"
   
 #if TIMER_FREQ < 19
 #error 8254 timer requires TIMER_FREQ >= 19
index fdddd91de7b94e062869d416472b373f0a939e8b..fcdc689e9a1dc6dd8e0dab5d11394a8596f58b78 100644 (file)
@@ -1,9 +1,9 @@
 #include "vga.h"
 #include <stdint.h>
 #include <stddef.h>
-#include "io.h"
-#include "lib.h"
-#include "mmu.h"
+#include "lib/lib.h"
+#include "threads/io.h"
+#include "threads/mmu.h"
 
 /* VGA text screen support.  See [FREEVGA] for more information. */
 
index 495615dda62b9c7a82675bb25102c23b91e2392b..bc2307b342f5b8fbdfdaf0c8cac9fd9a16d6f749 100644 (file)
@@ -1,3 +1,2 @@
-all:
-%:
-       $(MAKE) -C build $@
+include Makefile.vars
+include ../Makefile.kernel
diff --git a/src/filesys/Makefile.vars b/src/filesys/Makefile.vars
new file mode 100644 (file)
index 0000000..db29a74
--- /dev/null
@@ -0,0 +1,2 @@
+DEFINES = -DUSERPROG -DFILESYS
+SUBDIRS = threads devices lib userprog filesys
index 1384d8d5268f696b001dd46059e045729851ac09..32911b8f172a57e0643e64901679455b9cecad87 100644 (file)
@@ -1,8 +1,8 @@
 #include "directory.h"
 #include "file.h"
 #include "fsutil.h"
-#include "lib.h"
-#include "malloc.h"
+#include "lib/lib.h"
+#include "threads/malloc.h"
 
 /* Initializes D as a directory that holds ENTRY_CNT entries. */
 bool
index f5f5ebdde8c041b85cf8046eb6fceb604f38e6ac..a3364aeb75e1d076002842fcd47ded7886ea2920 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <stdbool.h>
 #include <stddef.h>
-#include "disk.h"
+#include "devices/disk.h"
 
 /* Maximum length of a filename.
    This is the traditional UNIX maximum.
index 323470efdd568a5dcea711366c8bd1bd263ff80d..a40c07356e2a9de62ea1bc118cb05a8ec0e083fa 100644 (file)
@@ -1,10 +1,10 @@
 #include "file.h"
-#include "debug.h"
-#include "lib.h"
-#include "malloc.h"
 #include "directory.h"
 #include "filehdr.h"
 #include "filesys.h"
+#include "lib/debug.h"
+#include "lib/lib.h"
+#include "threads/malloc.h"
 
 bool
 file_open (struct file *file, disk_sector_t hdr_sector) 
index c3cde121ad0b55ef6189272382019602b55ac0e8..afa1990102ac84db4dd929ff2eaa16a72dac6d1d 100644 (file)
@@ -4,7 +4,7 @@
 #include <stdbool.h>
 #include <stdint.h>
 #include <stddef.h>
-#include "disk.h"
+#include "devices/disk.h"
 #include "off_t.h"
 
 struct file 
index d7d2cc2af52ba24cc31f21419dd606c28f6a0fec..eafe2114704bc8b09eb324a9b6bf26f79deacedf 100644 (file)
@@ -1,9 +1,9 @@
 #include "filehdr.h"
-#include "bitmap.h"
-#include "debug.h"
-#include "malloc.h"
 #include "filesys.h"
-#include "lib.h"
+#include "lib/bitmap.h"
+#include "lib/debug.h"
+#include "lib/lib.h"
+#include "threads/malloc.h"
 
 /* Allocates sectors from bitmap B for the content of a file
    whose size is LENGTH bytes, and returns a new `struct filehdr'
index 235a1e69dd706b96d5ef81e28e1296ee8bbda5dc..cb28416066862af204e105f6dedcce6e6ece6507 100644 (file)
@@ -3,8 +3,8 @@
 
 #include <stdbool.h>
 #include <stddef.h>
-#include "disk.h"
 #include "off_t.h"
+#include "devices/disk.h"
 
 /* Number of direct sector pointers in a file header. */
 #define DIRECT_CNT ((DISK_SECTOR_SIZE - sizeof (off_t) * 2)     \
index 57dab76265486bc44ec1cb5019f80a4244b1c89e..77284ad26c9b56584526eb2d9cf66166cc301762 100644 (file)
 */
 
 #include "filesys.h"
-#include "bitmap.h"
-#include "debug.h"
-#include "directory.h"
-#include "disk.h"
 #include "file.h"
 #include "filehdr.h"
-#include "lib.h"
+#include "directory.h"
+#include "devices/disk.h"
+#include "lib/bitmap.h"
+#include "lib/debug.h"
+#include "lib/lib.h"
 
 /* Filesystem.
 
index 67dab6fdc59768fd4587a47f379308f24a525865..659878510a338f7b2c3b17094493dd27bd75cc49 100644 (file)
@@ -1,11 +1,11 @@
 #include "fsutil.h"
 #include <stdbool.h>
-#include "debug.h"
-#include "filesys.h"
 #include "file.h"
-#include "lib.h"
-#include "mmu.h"
-#include "palloc.h"
+#include "filesys.h"
+#include "lib/debug.h"
+#include "lib/lib.h"
+#include "threads/mmu.h"
+#include "threads/palloc.h"
 
 /* Filename and file size to use for copy operations,
    as "filename:size". */
index 8357d2e1fe2f951a6713efb7572b065e3eb3bb2a..eb18a4963924187b66d6bb17f6aef8a2ff2e8970 100644 (file)
@@ -3,9 +3,9 @@
 #include <limits.h>
 #include "debug.h"
 #include "lib.h"
-#include "malloc.h"
+#include "threads/malloc.h"
 #ifdef FILESYS
-#include "file.h"
+#include "filesys/file.h"
 #endif
 \f
 /* Number of bits in an element. */
index 534fc02c6d9066438f04e3538bd4a09dd6c3a741..babf2298320bf0c9061487fc601d9f4f1d4820ef 100644 (file)
@@ -1,7 +1,7 @@
 #include "debug.h"
 #include <stdarg.h>
-#include "interrupt.h"
 #include "lib.h"
+#include "threads/interrupt.h"
 
 #define MAX_CLASSES 16
 static bool all_enabled;
index 665fd0990a4537c0bfbcef861be86a295f6efc42..a6b18a9de9543e1637629f8177c3dba87c364fd7 100644 (file)
@@ -1,5 +1,6 @@
 #include "hash.h"
-#include "malloc.h"
+#include "debug.h"
+#include "threads/malloc.h"
 
 static struct list *find_bucket (struct hash *, hash_elem *);
 static struct list_elem *find_elem (struct hash *, struct list *, hash_elem *);
index 8fe516194ff0b89cef848b4eb0b551f4be005f2d..91fb318f2c8ebaf5898019c32f1b802e1d429147 100644 (file)
@@ -1,12 +1,12 @@
+#include "lib.h"
 #include <stdint.h>
 #include <stdarg.h>
 #include <stdbool.h>
 #include <stddef.h>
 #include "debug.h"
-#include "interrupt.h"
-#include "lib.h"
-#include "serial.h"
-#include "vga.h"
+#include "devices/serial.h"
+#include "devices/vga.h"
+#include "threads/interrupt.h"
 
 static void
 vprintf_core (const char *format, va_list args,
index 495615dda62b9c7a82675bb25102c23b91e2392b..bc2307b342f5b8fbdfdaf0c8cac9fd9a16d6f749 100644 (file)
@@ -1,3 +1,2 @@
-all:
-%:
-       $(MAKE) -C build $@
+include Makefile.vars
+include ../Makefile.kernel
diff --git a/src/threads/Makefile.vars b/src/threads/Makefile.vars
new file mode 100644 (file)
index 0000000..1ec24db
--- /dev/null
@@ -0,0 +1,2 @@
+DEFINES = 
+SUBDIRS = threads devices lib
index 57f3cbe6646d65d66df3c3d233d5160c5e3cba63..57d5301c3ae3a0477e3aeb846c0ec97b01d940b3 100644 (file)
@@ -2,31 +2,31 @@
 #include <stdint.h>
 #include <stddef.h>
 #include <limits.h>
-#include "debug.h"
 #include "interrupt.h"
 #include "io.h"
-#include "kbd.h"
-#include "lib.h"
 #include "loader.h"
 #include "malloc.h"
 #include "mmu.h"
 #include "paging.h"
 #include "palloc.h"
-#include "random.h"
-#include "serial.h"
 #include "thread.h"
-#include "timer.h"
-#include "vga.h"
+#include "devices/kbd.h"
+#include "devices/serial.h"
+#include "devices/timer.h"
+#include "devices/vga.h"
+#include "lib/debug.h"
+#include "lib/lib.h"
+#include "lib/random.h"
 #ifdef USERPROG
-#include "exception.h"
-#include "syscall.h"
-#include "gdt.h"
-#include "tss.h"
+#include "userprog/exception.h"
+#include "userprog/gdt.h"
+#include "userprog/syscall.h"
+#include "userprog/tss.h"
 #endif
 #ifdef FILESYS
-#include "filesys.h"
-#include "disk.h"
-#include "fsutil.h"
+#include "devices/disk.h"
+#include "filesys/filesys.h"
+#include "filesys/fsutil.h"
 #endif
 
 /* Amount of physical memory, in 4 kB pages. */
index eb10cd603669cabfa417fd48d9dd87f227945a17..4c7ec9e41e19c5a09428d1601b8eb2b325d07581 100644 (file)
@@ -2,12 +2,12 @@
 #include <inttypes.h>
 #include <stdint.h>
 #include "intr-stubs.h"
-#include "debug.h"
 #include "io.h"
-#include "lib.h"
 #include "mmu.h"
 #include "thread.h"
-#include "timer.h"
+#include "devices/timer.h"
+#include "lib/debug.h"
+#include "lib/lib.h"
 
 /* Number of x86 interrupts. */
 #define INTR_CNT 256
index a52f37974e4749bbd319fd339b0ca83dbbb282c5..c333260eef7a812e4262e783e968fa0a342fe99c 100755 (executable)
@@ -1,7 +1,7 @@
 #! /usr/bin/perl
 
 print <<'EOF';
-#include "loader.h"
+#include "threads/loader.h"
 
        .data
 .globl intr_stubs
index 7af11563795e925884ecc56269bf5eb8e5950f00..28f2324c79ef190d3357393546d80f5caff03546 100644 (file)
@@ -1,11 +1,11 @@
 #include "malloc.h"
 #include <stdint.h>
-#include "debug.h"
-#include "lib.h"
-#include "list.h"
-#include "synch.h"
 #include "mmu.h"
 #include "palloc.h"
+#include "synch.h"
+#include "lib/debug.h"
+#include "lib/lib.h"
+#include "lib/list.h"
 
 /* A simple implementation of malloc().
 
index 1fb531f42ca0bd4cb9802ec9f08a6ff2ad04ba17..4a3bee7c512aa2c2c8f946d7a8e0090fc6888ee5 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef HEADER_MALLOC_H
 #define HEADER_MALLOC_H
 
-#include "debug.h"
+#include "lib/debug.h"
 #include <stddef.h>
 
 void malloc_init (void);
index 4a32b7369681015dc984955610005d4c10476ad7..7e68b29481442dbb399c2559917f14ff41b6cdcb 100644 (file)
@@ -3,7 +3,7 @@
 
 #ifndef __ASSEMBLER__
 #include <stdint.h>
-#include "debug.h"
+#include "lib/debug.h"
 #endif
 
 #include "loader.h"
index a86969b3290c1a946da5df37105be2aa731ddf34..ca5f4b49ac0e56ea4c1bad738230f26f9c83e69e 100644 (file)
@@ -2,9 +2,9 @@
 #include <stdbool.h>
 #include <stddef.h>
 #include "init.h"
-#include "lib.h"
 #include "mmu.h"
 #include "palloc.h"
+#include "lib/lib.h"
 
 static uint32_t *base_page_dir;
 
index 2b07ad769c139ff3f7f661980936fbde0e6eea5e..e3cfafb7fc1bd468345288cef3ffafa61e7c7a4e 100644 (file)
@@ -1,13 +1,13 @@
 #include "palloc.h"
 #include <stddef.h>
 #include <stdint.h>
-#include "debug.h"
 #include "init.h"
 #include "loader.h"
-#include "lib.h"
-#include "list.h"
 #include "mmu.h"
 #include "synch.h"
+#include "lib/debug.h"
+#include "lib/lib.h"
+#include "lib/list.h"
 
 /* Page allocator.  Hands out memory in page-size chunks.
    See malloc.h for an allocator that hands out smaller
index d7601dacddc89f7c772d3340cf0e856b81c82f09..7993543016448f5fa55b4ed5378a022e181c0fc6 100644 (file)
@@ -28,8 +28,8 @@
 
 #include "synch.h"
 #include "interrupt.h"
-#include "lib.h"
 #include "thread.h"
+#include "lib/lib.h"
 
 /* Initializes semaphore SEMA to VALUE and names it NAME (for
    debugging purposes only).  A semaphore is a nonnegative
index d21ecff08ca546473cbfc7d84229fa5d54310fab..c74ba6813455f102c6540feb8a433952508c32d5 100644 (file)
@@ -2,7 +2,7 @@
 #define HEADER_SYNCH_H 1
 
 #include <stdbool.h>
-#include "list.h"
+#include "lib/list.h"
 
 /* A counting semaphore. */
 struct semaphore 
index 61351b569add5a112f66f2210f9bb70989ced7c6..f24f1fe4b3777d729b8a5fdd3374946076d8cb1f 100644 (file)
@@ -1,15 +1,15 @@
 #include "thread.h"
 #include <stddef.h>
-#include "debug.h"
 #include "interrupt.h"
 #include "intr-stubs.h"
-#include "lib.h"
 #include "mmu.h"
 #include "palloc.h"
-#include "random.h"
 #include "switch.h"
+#include "lib/debug.h"
+#include "lib/lib.h"
+#include "lib/random.h"
 #ifdef USERPROG
-#include "gdt.h"
+#include "userprog/gdt.h"
 #endif
 
 /* Value for struct thread's `magic' member.
index 421751be943f90bd7ad080b3dae9aecdb593d095..27c1f041fa8f24f094cd666a3b50d8cd63840c0f 100644 (file)
@@ -2,11 +2,11 @@
 #define HEADER_THREAD_H 1
 
 #include <stdint.h>
-#include "debug.h"
-#include "list.h"
+#include "lib/debug.h"
+#include "lib/list.h"
 
 #ifdef USERPROG
-#include "addrspace.h"
+#include "userprog/addrspace.h"
 #endif
 
 /* States in a thread's life cycle. */
index 495615dda62b9c7a82675bb25102c23b91e2392b..bc2307b342f5b8fbdfdaf0c8cac9fd9a16d6f749 100644 (file)
@@ -1,3 +1,2 @@
-all:
-%:
-       $(MAKE) -C build $@
+include Makefile.vars
+include ../Makefile.kernel
diff --git a/src/userprog/Makefile.vars b/src/userprog/Makefile.vars
new file mode 100644 (file)
index 0000000..db29a74
--- /dev/null
@@ -0,0 +1,2 @@
+DEFINES = -DUSERPROG -DFILESYS
+SUBDIRS = threads devices lib userprog filesys
index 2574c31d7d91737c7f57194ed2571544bd21a039..bb2dc606a427d2929052dfa27d936fcfa5716858 100644 (file)
@@ -1,15 +1,15 @@
 #include "addrspace.h"
 #include <inttypes.h>
-#include "debug.h"
-#include "file.h"
-#include "filesys.h"
-#include "init.h"
-#include "lib.h"
-#include "mmu.h"
-#include "paging.h"
-#include "palloc.h"
-#include "thread.h"
 #include "tss.h"
+#include "filesys/file.h"
+#include "filesys/filesys.h"
+#include "lib/debug.h"
+#include "lib/lib.h"
+#include "threads/init.h"
+#include "threads/mmu.h"
+#include "threads/paging.h"
+#include "threads/palloc.h"
+#include "threads/thread.h"
 
 /* We load ELF binaries.  The following definitions are taken
    from the ELF specification, [ELF1], more-or-less verbatim.  */
index 6383a4b99f591489ec7dd0099cc151318c59dfd0..0d5461a31078a20145490c668ae5fd302f51569f 100644 (file)
@@ -1,9 +1,9 @@
 #include "exception.h"
 #include <inttypes.h>
-#include "lib.h"
 #include "gdt.h"
-#include "interrupt.h"
-#include "thread.h"
+#include "lib/lib.h"
+#include "threads/interrupt.h"
+#include "threads/thread.h"
 
 static void kill (struct intr_frame *);
 static void page_fault (struct intr_frame *);
index c1228495499c664a00b60092c57003a5c6cef23f..4e338f7604df43a264499b1e95827b68e307825e 100644 (file)
@@ -1,8 +1,8 @@
 #include "gdt.h"
-#include "debug.h"
-#include "mmu.h"
-#include "palloc.h"
 #include "tss.h"
+#include "lib/debug.h"
+#include "threads/mmu.h"
+#include "threads/palloc.h"
 
 /* The Global Descriptor Table (GDT).
 
index ae89681c1a4176a091cabe131ad224ea3ea9a542..599e40e6526cf706552306a3ea70850cc5ad40e5 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef HEADER_GDT_H
 #define HEADER_GDT_H 1
 
-#include "loader.h"
+#include "threads/loader.h"
 
 /* Segment selectors.
    More selectors are defined by the loader in loader.h. */
index 6084726f607506aa97a137c98303dc9732364a8d..e6dfe94fb354b6162e92eb4c3b79719103426d43 100644 (file)
@@ -1,7 +1,7 @@
 #include "syscall.h"
-#include "lib.h"
-#include "interrupt.h"
-#include "thread.h"
+#include "lib/lib.h"
+#include "threads/interrupt.h"
+#include "threads/thread.h"
 
 static void syscall_handler (struct intr_frame *);
 
index 4b32d8507976f6995d8c242bdc8664b9ce034fbb..69113e4d36e376424fe9c6a1b916f6f402220602 100644 (file)
@@ -1,9 +1,9 @@
 #include "tss.h"
 #include <stddef.h>
-#include "debug.h"
 #include "gdt.h"
-#include "mmu.h"
-#include "palloc.h"
+#include "lib/debug.h"
+#include "threads/mmu.h"
+#include "threads/palloc.h"
 
 /* The Task-State Segment (TSS).