forked from Hin1209/jungle-pintos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.build
64 lines (49 loc) · 1.63 KB
/
Makefile.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# -*- makefile -*-
SRCDIR = ../..
all: os.dsk
include ../../Make.config
include ../Make.vars
include ../../tests/Make.tests
# Compiler and assembler options.
os.dsk: CPPFLAGS += -I$(SRCDIR)/lib/kernel
# Core kernel.
include ../../threads/targets.mk
# User process code.
include ../../userprog/targets.mk
# Virtual memory code.
include ../../vm/targets.mk
# Filesystem code.
include ../../filesys/targets.mk
# Library code shared between kernel and user programs.
include ../../lib/targets.mk
# Kernel-specific library code.
include ../../lib/kernel/targets.mk
# Device driver code.
include ../../devices/targets.mk
SOURCES = $(foreach dir,$(KERNEL_SUBDIRS),$($(dir)_SRC))
OBJECTS = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(SOURCES)))
DEPENDS = $(patsubst %.o,%.d,$(OBJECTS))
threads/kernel.lds.s: CPPFLAGS += -P
threads/kernel.lds.s: threads/kernel.lds.S
kernel.o: threads/kernel.lds.s $(OBJECTS)
$(LD) $(LDFLAGS) -T $< -o $@ $(OBJECTS)
kernel.bin: kernel.o
$(OBJCOPY) -O binary -R .note -R .comment -S $< [email protected]
dd [email protected] of=$@ bs=4096 conv=sync
threads/loader.o: threads/loader.S kernel.bin
$(CC) -c $< -o $@ $(ASFLAGS) $(CPPFLAGS) $(DEFINES) -DKERNEL_LOAD_PAGES=`perl -e 'print +(-s "kernel.bin") / 4096;'`
loader.bin: threads/loader.o
$(LD) $(LDFLAGS) -N -e start -Ttext 0x7c00 --oformat binary -o $@ $<
os.dsk: loader.bin kernel.bin
cat $^ > $@
clean::
rm -f $(OBJECTS) $(DEPENDS)
rm -f threads/loader.o threads/kernel.lds.s threads/loader.d
rm -f kernel.o kernel.lds.s
rm -f kernel.bin loader.bin os.dsk
rm -f bochsout.txt bochsrc.txt
rm -f results grade
Makefile: $(SRCDIR)/Makefile.build
cp $< $@
-include $(DEPENDS)