This repository has been archived by the owner on Feb 28, 2023. It is now read-only.
forked from tjuics2020/NEMU2020
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
executable file
·114 lines (81 loc) · 2.56 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
##### global settings #####
.PHONY: nemu entry testcase kernel run gdb test submit clean
CC := gcc
LD := ld
CFLAGS := -MMD -Wall -Werror -c
LIB_COMMON_DIR := lib-common
LIBC_INC_DIR := $(LIB_COMMON_DIR)/uclibc/include
LIBC_LIB_DIR := $(LIB_COMMON_DIR)/uclibc/lib
LIBC := $(LIBC_LIB_DIR)/libc.a
FLOAT := obj/$(LIB_COMMON_DIR)/FLOAT/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/FLOAT/Makefile.part
include kernel/Makefile.part
include game/Makefile.part
nemu: $(nemu_BIN)
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/add
# USERPROG := obj/testcase/mov
# USERPROG := obj/testcase/matrix-mul
USERPROG := obj/testcase/if-else
# USERPROG := obj/testcase/bit
# USERPROG := obj/testcase/bubble-sort
# USERPROG := obj/testcase/fact
# USERPROG := obj/testcase/fib
# USERPROG := obj/testcase/gotbaha
# USERPROG := obj/testcase/hello-inline-asm
# USERPROG := obj/testcase/hello-str
# USERPROG := obj/testcase/hello
# USERPROG := obj/testcase/leap-year
# USERPROG := obj/testcase/max
# USERPROG := obj/testcase/min3
# USERPROG := obj/testcase/movsx
# USERPROG := obj/testcase/mul-longlong
# USERPROG := obj/testcase/pascal
# USERPROG := obj/testcase/prime
# USERPROG := obj/testcase/print-FLOAT
# USERPROG := obj/testcase/quadratic-eq
# USERPROG := obj/testcase/quick-sort
# USERPROG := obj/testcase/select-sort
# USERPROG := obj/testcase/shuixianhua
# USERPROG := obj/testcase/string
# USERPROG := obj/testcase/struct
# USERPROG := obj/testcase/sub-longlong
# USERPROG := obj/testcase/sum
# USERPROG := obj/testcase/switch
# USERPROG := obj/testcase/to-lower-case
# USERPROG := obj/testcase/wanshu
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 .. && zip -r $(STU_ID).zip $(shell pwd | grep -o '[^/]*$$')