include Makefile.inc

DIR=TAPIOCA
TARGET=tapioca

All: $(TARGET)

SRCS  = main.cc \
	matrix.cc imatrix.cc namelist.cc dtcif.cc \
	dtatoms.cc dtcell.cc dtsymmetry.cc dtlattice.cc \
	dtfield.cc dtband.cc dtdos.cc dttapp.cc dtxtapp.cc dtmodel.cc \
	glbase.cc gloption.cc glmisc.cc glspline.cc \
	glatoms.cc glbonds.cc glcell.cc gllattice.cc \
	glcrosec.cc glisosurf.cc glfog.cc \
	glframe.cc glbar.cc glfield.cc \
	glview.cc glview2d.cc glband.cc gldos.cc gleps.cc \
	glbrillouin.cc \
	qtexception.cc qtwidgets.cc \
	qtcell.cc qtalignment.cc qtsymmetry.cc qtcluster.cc \
	qtlattice.cc qttapp.cc qtxtapp.cc \
	qtglfield.cc qtgllattice.cc qtglperiodic.cc qtglmisc.cc \
	qtgraphics.cc qtxml.cc qtatoms.cc qtctrl.cc \
	qtbrillouin.cc \
	window.cc

QTHEADS = dtmodel.h \
	gllattice.h glfield.h glview2d.h glview.h glband.h gldos.h \
	glbrillouin.h \
	qtwidgets.h qtatoms.h \
	qtcell.h qtalignment.h qtsymmetry.h qtcluster.h \
	qtlattice.h qttapp.h qtxtapp.h \
	qtglfield.h qtgllattice.h qtglperiodic.h qtglmisc.h qtgraphics.h \
	qtbrillouin.h \
	qtctrl.h window.h

OBJS   = ${SRCS:%.cc=%.o}
QTMOCS = ${QTHEADS:%.h=%.moc.o}

.SUFFIXES:
.SUFFIXES: .o .cc
.SUFFIXES: .moc.o .h .moc.cpp

.h.moc.o:
	$(MOC) $*.h -o $*.moc.cpp
	$(CC) -c $(CFLAGS) $(INCS) $*.moc.cpp
	@rm -f  $*.moc.cpp

.cc.o:
	$(CC) -c $(CFLAGS) $(INCS) $*.cc

$(TARGET): $(OBJS) $(QTMOCS) $(ICON)
	$(CC) $(OBJS) $(QTMOCS) $(ICON) $(LFLAGS) $(LIBS) -o $@

icon.ico: icon16.bmp icon32.bmp icon48.bmp icon64.bmp
	toico.exe -o icon.ico icon16.bmp icon32.bmp icon48.bmp icon64.bmp

$(ICON): icon.rc icon.ico
	windres.exe -i icon.rc -o icon.o

clean:
	rm -f *.moc.cpp *.exe *.exe.stackdump *.o *~ *.bak $(TARGET)

tgz:
	make clean
	(cd ..; tar zcvf $(TARGET).tgz $(DIR) )

depend:
	touch Makefile.dep
	makedepend -fMakefile.dep -Y -- *.cc 2> /dev/null

include Makefile.dep
