Makefile 844 Bytes
Newer Older
1
# directory containing source data
Radovan Bast's avatar
Radovan Bast committed
2
SRCDIR := data
3
4

# directory containing intermediate data
Radovan Bast's avatar
Radovan Bast committed
5
TMPDIR := processed_data
6
7

# results directory
Radovan Bast's avatar
Radovan Bast committed
8
RESDIR := results
9

10
# all source files (book texts)
Radovan Bast's avatar
Radovan Bast committed
11
SRCS = $(wildcard $(SRCDIR)/*.txt)
12
13

# all generated files
Radovan Bast's avatar
Radovan Bast committed
14
15
16
OBJS = $(patsubst $(SRCDIR)/%.txt,$(TMPDIR)/%.dat,$(SRCS))
OBJS += $(patsubst $(SRCDIR)/%.txt,$(RESDIR)/%.png,$(SRCS))
OBJS += $(RESDIR)/results.txt
17
18

# all intermediate data files
Radovan Bast's avatar
Radovan Bast committed
19
DATA = $(patsubst $(SRCDIR)/%.txt,$(TMPDIR)/%.dat,$(SRCS))
20

Radovan Bast's avatar
Radovan Bast committed
21
all: $(OBJS)
22

Radovan Bast's avatar
Radovan Bast committed
23
24
$(TMPDIR)/%.dat: $(SRCDIR)/%.txt source/wordcount.py
	python source/wordcount.py $< $@
25

Radovan Bast's avatar
Radovan Bast committed
26
27
28
29
30
31
32
33
34
35
36
$(RESDIR)/%.png: $(TMPDIR)/%.dat source/plotcount.py
	python source/plotcount.py $< $@

$(RESDIR)/results.txt: $(DATA) source/zipf_test.py
	python source/zipf_test.py $(DATA) > $@

clean:
	@$(RM) $(TMPDIR)/*
	@$(RM) $(RESDIR)/*

.PHONY: clean directories