-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
91 lines (64 loc) · 1.87 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
##### global settings #####
.PHONY: nemu entry all_testcase kernel run gdb profile test submit clean
MAKEFLAGS := -j4
CC := gcc
CXX := g++
RUSTC := rustc
HC := ghc
LD := ld
ASFLAGS := -m32 -MMD -c
CFLAGS := -MMD -Wall -Werror -c -std=gnu11
CXXFLAGS := -MMD -Wall -Werror -c -std=c++14 -fno-exceptions
HCFLAGS := -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-log:
-rm -f *log.txt entry $(FLOAT) 2> /dev/null
clean: clean-cpp clean-log
-rm -rf obj 2> /dev/null
##### some convinient rules #####
TEST=fast_memcpy
#USERPROG := obj/testcase/$(TEST)
USERPROG := $(game_BIN)
#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)
profile: $(nemu_BIN) $(USERPROG) entry
perf record $(nemu_BIN) $(USERPROG)
perf report
gdb: $(nemu_BIN) $(USERPROG) entry
gdb -s $(nemu_BIN) --args $(nemu_BIN) $(USERPROG)
test: $(nemu_BIN) $(testcase_BIN) entry
bash test.sh $(testcase_BIN)
submit: clean
cd .. && tar cvj $(shell pwd | grep -o '[^/]*$$') > $(STU_ID).tar.bz2
count-nemu:
find nemu/ -regextype posix-egrep -regex ".*\.c|.*\.h|.*\.hc|.*\.hs" -exec cat '{}' \; | sed '/^\s*$$/d' | wc -l