Makefile 1.08 KB
Newer Older
Nickolai Zeldovich's avatar
update  
Nickolai Zeldovich committed
1
2
3
4
5
6
# 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|lab3a|lab3b|lab4a|lab4b]

KEY=$(shell cat api.key)
Yandong Mao's avatar
update    
Yandong Mao committed
7
LABS=" lab1 lab2a lab2b lab3a lab3b lab4a lab4b "
Nickolai Zeldovich's avatar
update  
Nickolai Zeldovich committed
8
9

%:
Yandong Mao's avatar
update    
Yandong Mao committed
10
	@if echo $(LABS) | grep -q " $@ " ; then \
Yandong Mao's avatar
update    
Yandong Mao committed
11
	    tar cvzf $@-handin.tar.gz Makefile .git src; \
Nickolai Zeldovich's avatar
update  
Nickolai Zeldovich committed
12
13
14
	    if test -z $(KEY) ; then \
	        echo "Missing $(PWD)/api.key. Please create the file with your key in it or submit the $@-handin.tar.gz via the web interface."; \
	    else \
Yandong Mao's avatar
update    
Yandong Mao committed
15
16
17
                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; \
Yandong Mao's avatar
update    
Yandong Mao committed
18
                if test `du -b "$@-handin.tar.gz" | cut -f 1` -ge 20971520 ; then echo "File exceeds 20MB."; exit; fi; \
Nickolai Zeldovich's avatar
update  
Nickolai Zeldovich committed
19
20
21
22
23
	        curl -F file=@$@-handin.tar.gz -F key=$(KEY) http://ydmao.scripts.mit.edu/6.824/handin.py/upload; \
	    fi; \
        else \
            echo "Bad target $@. Usage: make [$(LABS)]"; \
        fi