Use i386-elf-* tools by default.
[pintos-anon] / src / Makefile.build
index e55ce566e8dfefc61c45824744c4102ef2f5ff75..43273a7f54fa743e6e9cfca2d1b6e1141eb31c2c 100644 (file)
@@ -4,7 +4,15 @@ include ../Makefile.vars
 
 SHELL = /bin/sh
 
-CC = gcc
+# Utilities.  
+# On a system where i386-elf is native (e.g. on an x86 GNU/Linux
+# machine) you want to set BINUTIL_PREFIX to expand to null, as shown
+# in the line that's commented out.
+BINUTIL_PREFIX = i386-elf-
+#BINUTIL_PREFIX =
+CC = $(BINUTIL_PREFIX)gcc
+LD = $(BINUTIL_PREFIX)ld
+OBJCOPY = $(BINUTIL_PREFIX)objcopy
 
 VPATH = ../..
 
@@ -25,6 +33,7 @@ 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.
+threads_SRC += threads/test.c          # Test code.
 
 # Device driver code.
 devices_SRC  = devices/timer.c         # Timer device.
@@ -45,13 +54,13 @@ lib_SRC += lib/string.c             # String functions.
 lib_kernel_SRC += lib/kernel/list.c    # Doubly-linked lists.
 lib_kernel_SRC += lib/kernel/bitmap.c  # Bitmaps.
 lib_kernel_SRC += lib/kernel/hash.c    # Hash tables.
-lib_kernel_SRC += lib/kernel/printf.c  # Kernel printf().
+lib_kernel_SRC += lib/kernel/console.c # printf(), putchar().
 
 # 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/inode.c         # File headers.
 filesys_SRC += filesys/fsutil.c                # Utilities.
 
 # User process code.
@@ -74,10 +83,10 @@ 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`
+       $(LD) -T $< -o $@ $(OBJECTS) `$(CC) -print-libgcc-file-name`
 
 kernel.bin: kernel.o
-       objcopy -O binary -R .note -R .comment -S $< $@.tmp
+       $(OBJCOPY) -O binary -R .note -R .comment -S $< $@.tmp
        ../../pad 4096 < $@.tmp > $@
        rm $@.tmp
 
@@ -85,7 +94,7 @@ threads/loader.o: threads/loader.S kernel.bin
        $(CC) -c $< -o $@ $(ASFLAGS) -DKERNEL_LOAD_PAGES=`perl -e 'print +(-s "kernel.bin") / 4096;'`
 
 loader.bin: threads/loader.o
-       ld -N -e start -Ttext 0x7c00 --oformat binary -o $@ $<
+       $(LD) -N -e start -Ttext 0x7c00 --oformat binary -o $@ $<
 
 os.dsk: loader.bin kernel.bin
        cat $^ > $@