#-----------------------------------------#
#  Makefile for the tbtools Tersoff-      #
#  Brenner software for Molecular         #
#  Dynamics. Written by Stephen Jordan in #
#  2002.                                  #
#-----------------------------------------#
CC=gcc
#For normal Compilation use:
CFLAGS=-O2
#For Debugging use:
#CFLAGS=-g
#For Profiling use:
#CFLAGS=-O2 -pg

all: deform tb_force tb_energy cones relax hydrogenate autobond abcstats pdb2abc colorize paramgen slash perturb anneal

deform: deform.o radic.o pij.o g.o abcio.o potential.o defs.o calculate.o force.o constants.o diags.o tbinit.o conjgrad.o handy.o
	$(CC) $(CFLAGS) -lm -o deform deform.o radic.o pij.o g.o abcio.o potential.o defs.o calculate.o force.o constants.o diags.o tbinit.o conjgrad.o handy.o

tb_force: tb_force.o abcio.o potential.o constants.o radic.o pij.o g.o tbinit.o
	$(CC) $(CFLAGS) -lm -o tb_force tb_force.o abcio.o potential.o constants.o radic.o pij.o g.o tbinit.o

tb_energy: tb_energy.o abcio.o potential.o constants.o radic.o pij.o g.o tbinit.o
	$(CC) $(CFLAGS) -lm -o tb_energy tb_energy.o abcio.o potential.o constants.o radic.o pij.o g.o tbinit.o

colorize: colorize.o abcio.o potential.o constants.o radic.o pij.o g.o tbinit.o handy.o
	$(CC) $(CFLAGS) -lm -o colorize colorize.o abcio.o potential.o constants.o radic.o pij.o g.o tbinit.o handy.o

cones: cones.o abcio.o constants.o calculate.o potential.o radic.o pij.o g.o conjgrad.o     force.o defs.o tbinit.o handy.o
	$(CC) $(CFLAGS) -lm -o cones cones.o abcio.o constants.o calculate.o potential.o radic.o pij.o g.o conjgrad.o     force.o defs.o tbinit.o handy.o

relax: relax.o calculate.o abcio.o potential.o radic.o g.o pij.o tbinit.o defs.o constants.o force.o conjgrad.o handy.o
	$(CC) $(CFLAGS) -lm -o relax relax.o calculate.o abcio.o potential.o radic.o g.o pij.o tbinit.o defs.o constants.o force.o conjgrad.o handy.o

anneal: anneal.o calculate.o abcio.o potential.o radic.o g.o pij.o tbinit.o defs.o constants.o force.o conjgrad.o handy.o
	$(CC) $(CFLAGS) -lm -o anneal anneal.o calculate.o abcio.o potential.o radic.o g.o pij.o tbinit.o defs.o constants.o force.o conjgrad.o handy.o


hydrogenate: hydrogenate.o abcio.o constants.o
	$(CC) $(CFLAGS) -lm -o hydrogenate hydrogenate.o abcio.o constants.o

autobond: autobond.o abcio.o constants.o handy.o
	$(CC) $(CFLAGS) -lm -o autobond autobond.o abcio.o constants.o handy.o

abcstats: abcstats.o abcio.o constants.o
	$(CC) $(CFLAGS) -lm -o abcstats abcstats.o abcio.o constants.o

pdb2abc: pdb2abc.o
	$(CC) $(CFLAGS) -o pdb2abc pdb2abc.o

paramgen: paramgen.o
	$(CC) $(CFLAGS) -o paramgen paramgen.o

slash: slash.o
	$(CC) $(CFLAGS) -o slash slash.o

perturb: perturb.o abcio.o constants.o
	$(CC) $(CFLAGS) -lm -o perturb perturb.o abcio.o constants.o

clean:
	rm -f deform tb_force tb_energy cones relax hydrogenate autobond pdb2abc colorize paramgen slash perturb anneal abcstats *.o

%.o: %.c
	$(CC) $(CFLAGS) -c $<
