summaryrefslogtreecommitdiffstats
path: root/pintos-progos/Makefile.build
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2012-03-26 12:54:45 +0200
committermanuel <manuel@mausz.at>2012-03-26 12:54:45 +0200
commitb5f0874cd96ee2a62aabc645b9626c2749cb6a01 (patch)
tree1262e4bbe0634de6650be130c36e0538240f4cbf /pintos-progos/Makefile.build
downloadprogos-b5f0874cd96ee2a62aabc645b9626c2749cb6a01.tar.gz
progos-b5f0874cd96ee2a62aabc645b9626c2749cb6a01.tar.bz2
progos-b5f0874cd96ee2a62aabc645b9626c2749cb6a01.zip
initial pintos checkin
Diffstat (limited to 'pintos-progos/Makefile.build')
-rw-r--r--pintos-progos/Makefile.build109
1 files changed, 109 insertions, 0 deletions
diff --git a/pintos-progos/Makefile.build b/pintos-progos/Makefile.build
new file mode 100644
index 0000000..e997d27
--- /dev/null
+++ b/pintos-progos/Makefile.build
@@ -0,0 +1,109 @@
1# -*- makefile -*-
2
3SRCDIR = ../..
4
5all: kernel.bin loader.bin
6
7include ../../Make.config
8include ../Make.vars
9include ../../tests/Make.tests
10
11# Compiler and assembler options.
12kernel.bin: CPPFLAGS += -I$(SRCDIR)/lib/kernel
13
14# Core kernel.
15threads_SRC = threads/start.S # Startup code.
16threads_SRC += threads/init.c # Main program.
17threads_SRC += threads/thread.c # Thread management core.
18threads_SRC += threads/switch.S # Thread switch routine.
19threads_SRC += threads/interrupt.c # Interrupt core.
20threads_SRC += threads/intr-stubs.S # Interrupt stubs.
21threads_SRC += threads/synch.c # Synchronization.
22threads_SRC += threads/palloc.c # Page allocator.
23threads_SRC += threads/malloc.c # Subpage allocator.
24
25# Device driver code.
26devices_SRC = devices/pit.c # Programmable interrupt timer chip.
27devices_SRC += devices/timer.c # Periodic timer device.
28devices_SRC += devices/kbd.c # Keyboard device.
29devices_SRC += devices/vga.c # Video device.
30devices_SRC += devices/serial.c # Serial port device.
31devices_SRC += devices/block.c # Block device abstraction layer.
32devices_SRC += devices/partition.c # Partition block device.
33devices_SRC += devices/ide.c # IDE disk block device.
34devices_SRC += devices/input.c # Serial and keyboard input.
35devices_SRC += devices/intq.c # Interrupt queue.
36devices_SRC += devices/rtc.c # Real-time clock.
37devices_SRC += devices/shutdown.c # Reboot and power off.
38devices_SRC += devices/speaker.c # PC speaker.
39
40# Library code shared between kernel and user programs.
41lib_SRC = lib/debug.c # Debug helpers.
42lib_SRC += lib/random.c # Pseudo-random numbers.
43lib_SRC += lib/stdio.c # I/O library.
44lib_SRC += lib/stdlib.c # Utility functions.
45lib_SRC += lib/string.c # String functions.
46lib_SRC += lib/arithmetic.c # 64-bit arithmetic for GCC.
47lib_SRC += lib/ustar.c # Unix standard tar format utilities.
48
49# Kernel-specific library code.
50lib/kernel_SRC = lib/kernel/debug.c # Debug helpers.
51lib/kernel_SRC += lib/kernel/list.c # Doubly-linked lists.
52lib/kernel_SRC += lib/kernel/bitmap.c # Bitmaps.
53lib/kernel_SRC += lib/kernel/hash.c # Hash tables.
54lib/kernel_SRC += lib/kernel/console.c # printf(), putchar().
55
56# User process code.
57userprog_SRC = userprog/process.c # Process loading.
58userprog_SRC += userprog/pagedir.c # Page directories.
59userprog_SRC += userprog/exception.c # User exception handler.
60userprog_SRC += userprog/syscall.c # System call handler.
61userprog_SRC += userprog/gdt.c # GDT initialization.
62userprog_SRC += userprog/tss.c # TSS management.
63
64# No virtual memory code yet.
65#vm_SRC = vm/file.c # Some file.
66
67# Filesystem code.
68filesys_SRC = filesys/filesys.c # Filesystem core.
69filesys_SRC += filesys/free-map.c # Free sector bitmap.
70filesys_SRC += filesys/file.c # Files.
71filesys_SRC += filesys/directory.c # Directories.
72filesys_SRC += filesys/inode.c # File headers.
73filesys_SRC += filesys/fsutil.c # Utilities.
74
75SOURCES = $(foreach dir,$(KERNEL_SUBDIRS),$($(dir)_SRC))
76OBJECTS = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(SOURCES)))
77DEPENDS = $(patsubst %.o,%.d,$(OBJECTS))
78
79threads/kernel.lds.s: CPPFLAGS += -P
80threads/kernel.lds.s: threads/kernel.lds.S threads/loader.h
81
82kernel.o: threads/kernel.lds.s $(OBJECTS)
83 $(LD) -T $< -o $@ $(OBJECTS)
84
85kernel.bin: kernel.o
86 $(OBJCOPY) -R .note -R .comment -S $< $@
87
88threads/loader.o: threads/loader.S
89 $(CC) -c $< -o $@ $(ASFLAGS) $(CPPFLAGS) $(DEFINES)
90
91loader.bin: threads/loader.o
92 $(LD) -N -e 0 -Ttext 0x7c00 --oformat binary -o $@ $<
93
94os.dsk: kernel.bin
95 cat $^ > $@
96
97clean::
98 rm -f $(OBJECTS) $(DEPENDS)
99 rm -f threads/loader.o threads/kernel.lds.s threads/loader.d
100 rm -f kernel.bin.tmp
101 rm -f kernel.o kernel.lds.s
102 rm -f kernel.bin loader.bin
103 rm -f bochsout.txt bochsrc.txt
104 rm -f results grade
105
106Makefile: $(SRCDIR)/Makefile.build
107 cp $< $@
108
109-include $(DEPENDS)