-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
42 lines (34 loc) · 933 Bytes
/
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
COUNT_SCRIPT = wordcount.py
PNG_SCRIPT = plotcount.py
TXT_FILES = $(wildcard books/*.txt)
DAT_FILES = $(patsubst books/%.txt, %.dat, $(TXT_FILES))
PNG_FILES = $(patsubst %.dat, %.png, $(DAT_FILES))
#make zip
analysis.zip : $(DAT_FILES) $(PNG_FILES) $(COUNT_SCRIPT) $(PNG_SCRIPT)
zip $@ $^
.PHONY : dats
dats : $(DAT_FILES)
.PHONY : pngs
pngs : $(PNG_FILES)
.PHONY : variables
variables:
@echo TXT_FILES:$(TXT_FILES)
@echo DAT_FILES:$(DAT_FILES)
@echo PNG_FILES:$(PNG_FILES)
#count words
%.dat : books/%.txt $(COUNT_SCRIPT)
python $(COUNT_SCRIPT) $< $*.dat
#make PNGs
%.png : %.dat $(PNG_SCRIPT)
python $(PNG_SCRIPT) $< $*.png
#last.dat : books/last.txt wordcount.py
# python wordcount.py $< $@
#isles.dat : books/isles.txt wordcount.py
# python wordcount.py $< $@
#abyss.dat : books/abyss.txt wordcount.py
# python wordcount.py $< $@
.PHONY : clean
clean :
rm -f $(DAT_FILES)
rm -f analysis.zip
# rm -f *.dat *.zip