TOP=../..
CONFIG=$(TOP)/config/default
include $(CONFIG)

CHROMA_CC=$(shell $(CHROMA)/bin/chroma-config --cxx)
CHROMA_CCFLAGS=$(shell $(CHROMA)/bin/chroma-config --cxxflags) \
              -I/home/avp/sandbox/kostas/tmp/chroma/lib/actions/ferm/fermacts \
               -I$(TOP) $(CFLAGS)
CHROMA_LDFLAGS=-g $(shell $(CHROMA)/bin/chroma-config --ldflags) $(LDFLAGS)
#CHROMA_LIBS=$(shell $(CHROMA)/bin/chroma-config --libs) -llevel3
CHROMA_LIBS=$(shell $(CHROMA)/bin/chroma-config --libs) $(LIBS)

source = inchroma.cc \
         kno.cc \
         operator.cc \
         solver.cc

objects = $(TOP)/dwf.o

.PHONY: all clean realclean tar

all: $(source:%.cc=%)

clean:
	$(RM) $(source:%.cc=%.o) *~ make-dump cout-* cerr-* core.*

realclean: clean
	$(RM) $(source:%.cc=%)

################
$(source:%.cc=%): % : %.o
	$(CHROMA_CC) $(CHROMA_LDFLAGS) -o $@ $< $(objects) $(CHROMA_LIBS)

$(source:%.cc=%.o): %.o : %.cc
	$(CHROMA_CC) $(CHROMA_CCFLAGS) -c -o $@ $<


$(source:%.cc=%.o): converter.cc read-gauge.cc write-propagator.cc lattice.c
$(source:%.cc=%): $(objects)


kno.o: qprop.cc
operator.o: dirac.cc
solver.o: cg5.cc
