-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
128 lines (112 loc) · 3.41 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
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
.PHONY: Collatz.log
FILES := \
Collatz.html \
Collatz.log \
Collatz.py \
RunCollatz.in \
RunCollatz.out \
RunCollatz.py \
TestCollatz.out \
TestCollatz.py \
cs330e-collatz-tests/didelatorre792-RunCollatz.in \
cs330e-collatz-tests/didelatorre792-RunCollatz.out \
cs330e-collatz-tests/didelatorre792-TestCollatz.out \
cs330e-collatz-tests/didelatorre792-TestCollatz.py \
ifeq ($(shell uname), Darwin) # Apple
PYTHON := python3
PIP := pip3
PYLINT := pylint
COVERAGE := coverage
PYDOC := pydoc3
AUTOPEP8 := autopep8
else ifeq ($(shell uname -p), unknown) # Windows
PYTHON := python # on my machine it's python
PIP := pip3
PYLINT := pylint
COVERAGE := coverage
PYDOC := python -m pydoc # on my machine it's pydoc
AUTOPEP8 := autopep8
else # UTCS
PYTHON := python3
PIP := pip3
PYLINT := pylint3
COVERAGE := coverage
PYDOC := pydoc3
AUTOPEP8 := autopep8
endif
collatz-tests:
git clone https://gitlab.com/fareszf/cs330e-collatz-tests.git
Collatz.html: Collatz.py
$(PYDOC) -w Collatz
Collatz.log:
git log > Collatz.log
RunCollatz.tmp: RunCollatz.in RunCollatz.out RunCollatz.py
$(PYTHON) RunCollatz.py < RunCollatz.in > RunCollatz.tmp
diff --strip-trailing-cr RunCollatz.tmp RunCollatz.out
TestCollatz.tmp: TestCollatz.py
$(COVERAGE) run --branch TestCollatz.py > TestCollatz.tmp 2>&1
$(COVERAGE) report -m >> TestCollatz.tmp
cat TestCollatz.tmp
check:
@not_found=0; \
for i in $(FILES); \
do \
if [ -e $$i ]; \
then \
echo "$$i found"; \
else \
echo "$$i NOT FOUND"; \
not_found=`expr "$$not_found" + "1"`; \
fi \
done; \
if [ $$not_found -ne 0 ]; \
then \
echo "$$not_found failures"; \
exit 1; \
fi; \
echo "success";
clean:
rm -f .coverage
rm -f *.pyc
rm -f RunCollatz.tmp
rm -f TestCollatz.tmp
rm -rf __pycache__
rm -rf cs330e-collatz-tests
config:
git config -l
format:
$(AUTOPEP8) -i Collatz.py
$(AUTOPEP8) -i RunCollatz.py
$(AUTOPEP8) -i TestCollatz.py
scrub:
make clean
rm -f Collatz.html
rm -f Collatz.log
status:
make clean
@echo
git branch
git remote -v
git status
versions:
which $(AUTOPEP8)
$(AUTOPEP8) --version
@echo
which $(COVERAGE)
$(COVERAGE) --version
@echo
which git
git --version
@echo
which make
make --version
@echo
which $(PIP)
$(PIP) --version
@echo
which $(PYLINT)
$(PYLINT) --version
@echo
which $(PYTHON)
$(PYTHON) --version
test: Collatz.html Collatz.log RunCollatz.tmp TestCollatz.tmp collatz-tests check