# Compiled and linked by.
compiler = g++
linker = g++

# Default path to binary.
binary = pace

# Params to compiler and linker.
# 64-bit, full optimization, warnings on.
# params = -m64 -O3 -W
# 32-bit, full optimization, warnings on.
# params = -m32 -O3 -W

objects = main.o buffer.o config.o context.o dependencies.o evaluation.o extractor.o filter.o init.o ngram.o ngrams.o notifier.o ntree.o params.o parser.o persistent.o processor.o utils.o writer.o

# The main goal is:
pace : $(objects)
	$(linker) -o $(binary) $(params) $^

main.o : main.cpp config.h init.h notifier.h params.h processor.h writer.h
	$(compiler) -c $< -o $@ $(params)
buffer.o : buffer.cpp buffer.h config.h parser.h stats.h
	$(compiler) -c $< $(params)
config.o : config.cpp config.h
	$(compiler) -c $< -o $@ $(params)
context.o : context.cpp config.h context.h
	$(compiler) -c $< -o $@ $(params)
dependencies.o : dependencies.cpp config.h dependencies.h
	$(compiler) -c $< -o $@ $(params)
extractor.o : extractor.cpp buffer.h config.h extractor.h ngram.h notifier.h ntree.h parser.h persistent.h stats.h utils.h word.h
	$(compiler) -c $< -o $@ $(params)
evaluation.o : evaluation.cpp evaluation.h ngrams.h utils.h
	$(compiler) -c $< -o $@ $(params)
filter.o : filter.cpp config.h filter.h
	$(compiler) -c $< -o $@ $(params)
init.o : init.cpp config.h evaluation.h init.h ngram.h ngrams.h notifier.h persistent.h processor.h
	$(compiler) -c $< -o $@ $(params)
ngram.o : ngram.cpp config.h context.h dependencies.h ngram.h overflow.h utils.h word.h
	$(compiler) -c $< -o $@ $(params)
ngrams.o : ngrams.cpp config.h hash_vector.h ngram.h ngrams.h pool.h
	$(compiler) -c $< -o $@ $(params)
notifier.o : notifier.cpp config.h notifier.h utils.h
	$(compiler) -c $< -o $@ $(params)
ntree.o : ntree.cpp ntree.h utils.h
	$(compiler) -c $< -o $@ $(params)
params.o : params.cpp config.h params.h
	$(compiler) -c $< -o $@ $(params)
parser.o : parser.cpp config.h dependencies.h notifier.h parser.h persistent.h utils.h word.h
	$(compiler) -c $< -o $@ $(params)
persistent.o : persistent.cpp config.h filter.h ngrams.h persistent.h stats.h strings.h
	$(compiler) -c $< -o $@ $(params)
processor.o : processor.cpp extractor.h notifier.h persistent.h processor.h stats.h
	$(compiler) -c $< -o $@ $(params)
utils.o : utils.cpp config.h utils.h
	$(compiler) -c $< -o $@ $(params)
writer.o : writer.cpp config.h dependencies.h evaluation.h filter.h ngrams.h notifier.h persistent.h utils.h writer.h
	$(compiler) -c $< -o $@ $(params)

.PHONY : clean
clean :
	-rm *.o
