-
Notifications
You must be signed in to change notification settings - Fork 9
/
MakefileHelper
164 lines (115 loc) · 4.24 KB
/
MakefileHelper
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
.PHONY: default pull push all compile overall section lab hw test quiz final zone clean src_clean remove_json_comments version
default: overall
# =============================================================================
# This is the helper Makefile
# Don't directly use this Makefile, it should be included from the
# per-course Makefile with these variables set:
ifndef USERNAME
$(error Variable USERNAME not set)
endif
ifndef RAINBOW_GRADES_DIRECTORY
$(error Variable RAINBOW_GRADES_DIRECTORY not set)
endif
ifndef HWSERVER
$(error Variable HWSERVER not set)
endif
ifndef REPORTS_DIRECTORY
$(error Variable REPORTS_DIRECTORY not set)
endif
nlohmann_json_dir=${RAINBOW_GRADES_DIRECTORY}/../vendor/nlohmann/json
export RAINBOW_GRADES_DIRECTORY
export REPORTS_DIRECTORY
${nlohmann_json_dir}:
mkdir -p ${nlohmann_json_dir}
wget https://github.com/nlohmann/json/releases/download/v3.1.2/include.zip -O ${RAINBOW_GRADES_DIRECTORY}/../vendor/nlohmann_json.zip
unzip -o ${RAINBOW_GRADES_DIRECTORY}/../vendor/nlohmann_json.zip -d ${nlohmann_json_dir}
# =============================================================================
pull:
mkdir -p raw_data/
rsync -azP ${USERNAME}@${HWSERVER}:${REPORTS_DIRECTORY}/ raw_data/
push:
rsync -azP individual_summary_html/*.html ${USERNAME}@${HWSERVER}:${REPORTS_DIRECTORY}/summary_html/
rsync -azP individual_summary_html/*.json ${USERNAME}@${HWSERVER}:${REPORTS_DIRECTORY}/seating/final_exam/
local_pull:
mkdir -p raw_data/
rsync -azPq ${REPORTS_DIRECTORY}/ raw_data/
local_push:
rsync -azPq individual_summary_html/*.html ${REPORTS_DIRECTORY}/summary_html/
rsync -azPq individual_summary_html/*.json ${REPORTS_DIRECTORY}/seating/final_exam/
pull_test:
mkdir -p raw_data/
rsync -azPq ${REPORTS_DIRECTORY}/ raw_data/
push_test:
rsync -azPq individual_summary_html/* ${REPORTS_DIRECTORY}/summary_html/
flags = -g
memory_debug : memory_flags = -m32
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
flags = -g -std=c++11
endif
ifeq ($(UNAME_S),Linux)
flags = -g -std=c++0x
endif
ifeq ($(findstring CYGWIN,$(UNAME_S)),CYGWIN)
flags = -g -std=c++11
endif
json_include = -I${nlohmann_json_dir}/include/
version:
python3 ${RAINBOW_GRADES_DIRECTORY}/track_Rainbow_version.py
remove_json_comments: customization.json
cpp -xc++ $< | sed -e '/^#/d' > customization_no_comments.json
python3 -m json.tool customization_no_comments.json > /dev/null
process_grades.out: \
${RAINBOW_GRADES_DIRECTORY}/main.cpp \
${RAINBOW_GRADES_DIRECTORY}/output.cpp \
${RAINBOW_GRADES_DIRECTORY}/table.cpp \
${RAINBOW_GRADES_DIRECTORY}/student.cpp \
${RAINBOW_GRADES_DIRECTORY}/zone.cpp \
${RAINBOW_GRADES_DIRECTORY}/benchmark.cpp \
${RAINBOW_GRADES_DIRECTORY}/submini_polls.cpp
clang++ -Wall -Wextra ${flags} ${memory_flags} ${json_include} $^ -g -o $@
individual_summary_html all_students_summary_csv all_students_summary_html:
mkdir -p $@
compile: remove_json_comments version process_grades.out individual_summary_html all_students_summary_html all_students_summary_csv
clean:
rm -rf *~ *.dSYM
rm -f process_grades.out
rm -f customization_no_comments.json files_json.txt RG_version.json
src_clean: clean
rm -f ${json_syntax_checker.py}
rm -rf ${nlohmann_json_dir}
all: pull overall push
# =============================================================================
# the different sorting orders & details of tables
overall: ${nlohmann_json_dir} ${json_syntax_checker.py} compile
./process_grades.out by_overall
memory_debug: compile
drmemory -- ./process_grades.out by_overall
#valgrind ./process_grades.out by_overall
name: compile
./process_grades.out by_name
section: compile
./process_grades.out by_section
lab: compile
./process_grades.out by_lab
hw: compile
./process_grades.out by_hw
test: compile
./process_grades.out by_test
quiz: compile
./process_grades.out by_quiz
exam: compile
./process_grades.out by_exam
reading: compile
./process_grades.out by_reading
worksheet: compile
./process_grades.out by_worksheet
project: compile
./process_grades.out by_project
participation: compile
./process_grades.out by_participation
test_exam: compile
./process_grades.out by_test_and_exam
zone: compile
./process_grades.out by_zone
# =============================================================================