#
# pdb2vrml
#
# Copyright 2001 by Vieri Di Paola.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
#
# Please report all bugs and problems to "gnubioq@yahoo.com".
#

CPPFILES = \
	AtomInfo.cpp MolInfo.cpp pdb2vrml.cpp

CLEAN =

################################################################

include ../makeinclude

LIBRARY = ../lib/$(LIBNAME)

OBJECTS = $(CPPFILES:.cpp=.o)

all:	$(LIBRARY) $(DSONAME)

$(LIBRARY): $(OBJECTS)
	echo $(LIBCOMMAND) $@ ...
	$(LIBCOMMAND) $@ $(OBJECTS)
	$(RANLIB) $@

libpdb2vrml.so.1 libpdb2vrml.sl.1: $(OBJECTS)
	echo $(DSOCOMMAND) $@ ...
	$(DSOCOMMAND) $@ $(OBJECTS)

clean :
	-@ rm -f *.o *.do $(DSONAME) $(LIBRARY) $(CLEAN) core *~ makedepend
	touch makedepend

depend:
	$(MAKEDEPEND) -I.. $(CXXFLAGS) $(CPPFILES) $(CFILES) > makedepend

include makedepend

################################################################

install: $(LIBRARY) $(DSONAME)
	echo "Installing library..."
	-mkdir -p $(libdir)
	rm -f $(libdir)/$(LIBNAME)
	-cp $(LIBRARY) $(libdir)
	-chmod 644 $(libdir)/$(LIBNAME)
	if test "$(DSONAME)" = libpdb2vrml.so.1; then\
		rm -f $(libdir)/libpdb2vrml.so*;\
		cp libpdb2vrml.so.1 $(libdir); \
		chmod 755 $(libdir)/libpdb2vrml.so.1; \
		ln -s libpdb2vrml.so.1 $(libdir)/libpdb2vrml.so;\
	fi
	if test "$(DSONAME)" = libpdb2vrml.sl.1; then\
		rm -f $(libdir)/libpdb2vrml.sl*;\
		cp libpdb2vrml.sl.1 $(libdir); \
		chmod 755 $(libdir)/libpdb2vrml.sl.1; \
		ln -s libpdb2vrml.sl.1 $(libdir)/libpdb2vrml.sl;\
	fi
	echo "Installing include files..."
	-mkdir -p $(includedir)
	rm -rf $(includedir)/pdb2vrml
	mkdir $(includedir)/pdb2vrml
	cp ../include/*.[hH] $(includedir)/pdb2vrml
	-chmod 755 $(includedir)/pdb2vrml
	-chmod 644 $(includedir)/pdb2vrml/*

