forked from trinabh/cs170-labs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (41 loc) · 1.26 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
LAB?=2 # optional lab number; should be overwritten by inner makefiles
#
# NYU CS 202 - Spring 2015 - Lab
#
# Handin
HANDIN = python submit.py
LAB_NAME ?= lab$(LAB)
.PHONY: tarball
handin-check:
@if ! test -d .git; then \
echo No .git directory, is this a git repository?; \
false; \
fi
@if test "$$(git symbolic-ref HEAD)" != refs/heads/lab$(LAB); then \
git branch; \
read -p "You are not on the lab$(LAB) branch. Hand-in the current branch? [y/N] " r; \
test "$$r" = y; \
fi
@if ! git diff-files --quiet || ! git diff-index --quiet --cached HEAD; then \
git status; \
echo; \
echo "You have uncomitted changes. Please commit or stash them."; \
false; \
fi
@if test -n "`git ls-files -o --exclude-standard`"; then \
git status; \
read -p "Untracked files will not be handed in. Continue? [y/N] " r; \
test "$$r" = y; \
fi
tarball-check: handin-check
-@for lab in $(shell seq 1 $(LAB)); do \
$(MAKE) -C lab$${lab} realclean; \
done
handin: tarball-check handin-check
@git archive --format=tar HEAD > lab$(LAB)-handin.tar
@echo CREATE lab$(LAB)-handin.tar
@tar -rf lab$(LAB)-handin.tar .git
@gzip -c lab$(LAB)-handin.tar > lab$(LAB)-handin.tgz
@rm -f lab$(LAB)-handin.tar
@echo " SUBMITTING ..."
@$(HANDIN) $(LAB_NAME) lab$(LAB)-handin.tgz