-
Notifications
You must be signed in to change notification settings - Fork 35
/
Makefile
49 lines (47 loc) · 1.95 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
# This is the Makefile helping you submit the labs.
# Just create 6.824/api.key with your API key in it,
# and submit your lab with the following command:
# $ make [lab1|lab2a|lab2b|lab2c|lab3a|lab3b|lab4a|lab4b]
LABS=" lab1 lab2a lab2b lab2c lab3a lab3b lab4a lab4b "
%:
@echo "Preparing [email protected]"
@echo "Checking for committed temporary files..."
@if git ls-files | grep -E 'mrtmp|mrinput' > /dev/null; then \
echo "" ; \
echo "OBS! You have committed some large temporary files:" ; \
echo "" ; \
git ls-files | grep -E 'mrtmp|mrinput' | sed 's/^/\t/' ; \
echo "" ; \
echo "Follow the instructions at http://stackoverflow.com/a/308684/472927" ; \
echo "to remove them, and then run make again." ; \
echo "" ; \
exit 1 ; \
fi
@if echo $(LABS) | grep -q " $@ " ; then \
echo "Tarring up your submission..." ; \
tar cvzf [email protected] \
"--exclude=src/main/pg-*.txt" \
"--exclude=src/main/diskvd" \
"--exclude=src/mapreduce/824-mrinput-*.txt" \
"--exclude=mrtmp.*" \
"--exclude=src/main/diff.out" \
Makefile src; \
if ! test -e api.key ; then \
echo "Missing $(PWD)/api.key. Please create the file with your key in it or submit the [email protected] via the web interface."; \
else \
echo "Are you sure you want to submit $@? Enter 'yes' to continue:"; \
read line; \
if test "$$line" != "yes" ; then echo "Giving up submission"; exit; fi; \
if test `stat -c "%s" "[email protected]" 2>/dev/null || stat -f "%z" "[email protected]"` -ge 20971520 ; then echo "File exceeds 20MB."; exit; fi; \
mv api.key api.key.fix ; \
cat api.key.fix | tr -d '\n' > api.key ; \
rm api.key.fix ; \
curl -F file=@[email protected] -F "key=<api.key" \
https://6824.scripts.mit.edu/2018/handin.py/upload > /dev/null || { \
echo ; \
echo "Submit seems to have failed."; \
echo "Please upload the tarball manually on the submission website."; } \
fi; \
else \
echo "Bad target $@. Usage: make [$(LABS)]"; \
fi