##
## Plugin compilation and distribution rules
## Copyright 2002-2004, Board of Trustees of the University of Illinois
## Theoretical and Computational Biophysics Group
##

.SILENT:

default: make-arch-help

world:
	@echo "Building all supported targets..."
	csh -f build.csh

# These plugins are kept in a separate multiseq CVS tree and must be
# periodically synced up with the main VMD plugin CVS when updated.
# They are listed separately here to make this distinction more transparent.
MSEQBUILDDIRS = blast clustalw cluster colorbar libbiokit \
                multiseq multiseqdialog phylotree plotter \
                seqdata seqedit simpleedit stamp

BUILDDIRS = \
  molfile_plugin \
  apbsrun \
  atomedit \
  autoimd \
  autoionize \
  autopsf \
  bignum \
  biocore \
  catdcd \
  cgtools \
  cionize \
  cliptool \
  clonerep \
  colorscalebar \
  contactmap \
  dataimport \
  demomaster \
  dipwatch \
  dowser \
  exectool \
  extendedpdb \
  gofrgui \
  hesstrans \
  idatm \
  imdmenu \
  intersurf \
  irspecgui \
  membrane \
  molefacture \
  moltoptools \
  multimolanim \
  multiplot \
  mutator \
  namdenergy \
  namdgui \
  namdplot \
  namdserver \
  navfly \
  navigate \
  optimization \
  palettetool \
  paratool \
  pbctools \
  pdbtool \
  pmepot \
  psfgen \
  qmtool \
  ramaplot \
  readcharmmpar \
  readcharmmtop \
  resptool \
  rmsd \
  rmsdtt \
  saltbr \
  solvate \
  stingtool \
  textview \
  timeline \
  vdna \
  viewmaster \
  volmapgui \
  vmdmovie \
  vmdtkcon \
  zoomseq \
  $(MSEQBUILDDIRS)

INCLUDEDIR = include
PLUGINHEADERS = vmdplugin.h molfile_plugin.h

distrib: 
	@echo "Populating distribution directory with compiled plugins"
	-mkdir -p $(PLUGINDIR)/include
	for header in $(PLUGINHEADERS); do cp -p $(INCLUDEDIR)/$$header $(PLUGINDIR)/include || exit 1 ; done
	for dir in $(BUILDDIRS); do cd $$dir && $(MAKE) distrib && cd .. || exit 1 ; done

include Make-arch

dynlibs:
	for dir in $(BUILDDIRS); do cd $$dir && $(MAKE) dynlibs && cd .. || exit 1 ; done

staticlibs: 
	for dir in $(BUILDDIRS); do cd $$dir && $(MAKE) staticlibs && cd .. || exit 1 ; done

win32staticlibs: 
	for dir in $(BUILDDIRS); do cd $$dir && $(MAKE) win32staticlibs && cd .. || exit 1 ; done

bins:
	for dir in $(BUILDDIRS); do cd $$dir && $(MAKE) bins && cd .. || exit 1 ; done

win32bins:
	for dir in $(BUILDDIRS); do cd $$dir && $(MAKE) win32bins && cd .. || exit 1 ; done

clean:
	find compile \( -name *.o -o -name *.a -o -name *.so -o -name *.exp -o -name *.lib -o -name *.h \) -print | xargs rm -f
	find compile \( -name lib_* \) -print | xargs rm -rf
	rm -f log.*
	rm -f psfgen/so_locations
	rm -f molfile_plugin/so_locations

checkperms:
	@echo "Looking for bad file permissions..."
	find . ! -perm +004

