-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (53 loc) · 1.54 KB
/
Makefile
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
65
66
67
68
69
70
71
72
73
74
75
76
77
##### global settings #####
.PHONY: nemu entry all_testcase kernel run gdb test submit clean
CC := gcc
LD := ld
CFLAGS := -MMD -Wall -Werror -c
LIB_COMMON_DIR := lib-common
NEWLIBC_DIR := $(LIB_COMMON_DIR)/newlib
NEWLIBC := $(NEWLIBC_DIR)/libc.a
FLOAT := obj/$(LIB_COMMON_DIR)/FLOAT.a
include config/Makefile.git
include config/Makefile.build
all: nemu
##### rules for building the project #####
include nemu/Makefile.part
include testcase/Makefile.part
include lib-common/Makefile.part
include kernel/Makefile.part
include game/Makefile.part
nemu: $(nemu_BIN)
all_testcase: $(testcase_BIN)
kernel: $(kernel_BIN)
game: $(game_BIN)
##### rules for cleaning the project #####
clean-nemu:
-rm -rf obj/nemu 2> /dev/null
clean-testcase:
-rm -rf obj/testcase 2> /dev/null
clean-kernel:
-rm -rf obj/kernel 2> /dev/null
clean-game:
-rm -rf obj/game 2> /dev/null
clean: clean-cpp
-rm -rf obj 2> /dev/null
-rm -f *log.txt entry $(FLOAT) 2> /dev/null
##### some convinient rules #####
# USERPROG := obj/testcase/mov
#USERPROG := obj/testcase/mov-c
USERPROG := obj/testcase/hello
#ENTRY := $(USERPROG)
ENTRY := $(kernel_BIN)
entry: $(ENTRY)
objcopy -S -O binary $(ENTRY) entry
run: $(nemu_BIN) $(USERPROG) entry
# $(call git_commit, "run")
$(nemu_BIN) $(USERPROG)
gdb: $(nemu_BIN) $(USERPROG) entry
# $(call git_commit, "gdb")
gdb -s $(nemu_BIN) --args $(nemu_BIN) $(USERPROG)
test: $(nemu_BIN) $(testcase_BIN) entry
# $(call git_commit, "test")
bash test.sh $(testcase_BIN)
submit: clean
cd .. && tar cvj $(shell pwd | grep -o '[^/]*$$') > $(STU_ID).tar.bz2