# Makefile - main program makefile
#
# This program is part of Crank, a cryptanalysis tool
# Copyright (C) 2000 Matthew Russell
# See LICENSE for more info    

prefix=@prefix@
CRANK_DIR = ..
INSTALL_DIR = ..
DATA_DIR = @datadir@/crank
CC = gcc
CFLAGS = -O2 -Wall -fPIC @GTK_CFLAGS@ -I$(CRANK_DIR) -DDATA_DIR=\"$(DATA_DIR)\"

all: monoalphabetic.key-controls.so \
     statistics.n-grams.so \
     monoalphabetic.hillclimb-cracker.so \
     text.simple-filters.so \
     utilities.notepad.so \
     steganalysis.word-gaps.so \
     transpositions.grid-controls.so \
     transpositions.grid-brute-force.so \
     fitness.word-count.so

monoalphabetic.key-controls.so: monoalphabetic.key-controls.o common.monoalphabetic.o
	$(CC) $(CFLAGS) -shared -o $@ $< common.monoalphabetic.o

statistics.n-grams.so: statistics.n-grams.o common.statistics.n-grams.o
	$(CC) $(CFLAGS) -shared -o $@ $< common.statistics.n-grams.o

monoalphabetic.hillclimb-cracker.so: monoalphabetic.hillclimb-cracker.o common.statistics.n-grams.o common.monoalphabetic.o
	$(CC) $(CFLAGS) -shared -o $@ $< common.statistics.n-grams.o common.monoalphabetic.o

text.simple-filters.so: text.simple-filters.o
	$(CC) $(CFLAGS) -shared -o $@ $<

utilities.notepad.so: utilities.notepad.o
	$(CC) $(CFLAGS) -shared -o $@ $<

steganalysis.word-gaps.so: steganalysis.word-gaps.o
	$(CC) $(CFLAGS) -shared -o $@ $<

transpositions.grid-controls.so: transpositions.grid-controls.o common.transpositions.rectangular.o
	$(CC) $(CFLAGS) -shared -o $@ $< common.transpositions.rectangular.o

transpositions.grid-brute-force.so: transpositions.grid-brute-force.o common.transpositions.rectangular.o common.statistics.n-grams.o
	$(CC) $(CFLAGS) -shared -o $@ $< common.transpositions.rectangular.o common.statistics.n-grams.o

fitness.word-count.so: fitness.word-count.o
	$(CC) $(CFLAGS) -shared -o $@ $<

common.monoalphabetic.o: common.monoalphabetic.c $(CRANK_DIR)/crank.h common.monoalphabetic.h

common.transpositions.rectangular.o: common.transpositions.rectangular.c $(CRANK_DIR)/crank.h common.transpositions.rectangular.h

monoalphabetic.key-controls.o: monoalphabetic.key-controls.c $(CRANK_DIR)/crank.h crank-interface.h common.monoalphabetic.h
statistics.n-grams.o: statistics.n-grams.c $(CRANK_DIR)/crank.h crank-interface.h common.statistics.n-grams.h
monoalphabetic.hillclimb-cracker.o: monoalphabetic.hillclimb-cracker.c $(CRANK_DIR)/crank.h crank-interface.h common.monoalphabetic.h common.statistics.n-grams.h
text.simple-filters.o: text.simple-filters.c $(CRANK_DIR)/crank.h crank-interface.h
utilities.notepad.o: utilities.notepad.c $(CRANK_DIR)/crank.h crank-interface.h
steganalysis.word-gaps.o: steganalysis.word-gaps.c $(CRANK_DIR)/crank.h crank-interface.h
transpositions.grid-controls.o: transpositions.grid-controls.c $(CRANK_DIR)/crank.h crank-interface.h common.transpositions.rectangular.h
transpositions.grid-brute-force.o: transpositions.grid-brute-force.c $(CRANK_DIR)/crank.h crank-interface.h common.transpositions.rectangular.h common.statistics.n-grams.h
fitness.word-count.o: fitness.word-count.c $(CRANK_DIR)/crank.h crank-interface.h

clean:
	-rm *.o
	rm *.so
install:
	cp *.so $(INSTALL_DIR)/plugins/
