# Emacs, this is -*- Mode: makefile -*-
#
# Makefile [10. Jun 2007]
# Makefile for the installation of Ayam (precompiled wrapped version)

# Choose an installation prefix.
PREFIX = /usr/local/ayam
#PREFIX = /opt/ayam
# if you use one of the following, be sure to change LIBDIR
# and DOCDIR to a more suitable (Ayam specific) path
#PREFIX = /usr/freeware
#PREFIX = /usr

# if PREFIX points to a generic directory (e.g. /usr) and not
# to a directory specific to Ayam (e.g. /usr/local/ayam) you
# probably want to switch LN to echo (this way the installation
# will not create a softlink named "plugins" in PREFIX/bin)
LN = ln -s
#LN = echo

# Where shall the executable be installed?
BINDIR = $(PREFIX)/bin

# Where shall the plugins and custom objects be installed?
LIBDIR = $(PREFIX)/lib
#LIBDIR = $(PREFIX)/lib/ayam

# Where shall the documentation be installed?
DOCDIR = $(PREFIX)/doc
#DOCDIR = $(PREFIX)/doc/ayam

INSTALL = ./ninstall
#INSTALL = install
MKDIR = mkdir -p

# Nothing needs to be changed below this line.

DOCFILES = ../Setup.txt ../Changes.txt ../License.txt ../doc/refcard.tcl\
../doc/refcard.ps ../doc/ayam.pdf

install:
	$(MKDIR) $(BINDIR)
	$(INSTALL) ayam $(BINDIR)
	$(MKDIR) $(LIBDIR)
	-$(LN) $(LIBDIR) $(BINDIR)/plugins
	-$(INSTALL) plugins/metaobj.so $(LIBDIR)
	-$(INSTALL) plugins/metaobj.tcl $(LIBDIR)
	-$(INSTALL) plugins/metacomp.tcl $(LIBDIR)
	-$(INSTALL) plugins/mfio.so $(LIBDIR)
	-$(INSTALL) plugins/mfio.tcl $(LIBDIR)
	-$(INSTALL) plugins/loadmfio.tcl $(LIBDIR)
	-$(INSTALL) plugins/mopsi.so $(LIBDIR)
	-$(INSTALL) plugins/mopsi.tcl $(LIBDIR)
	-$(INSTALL) plugins/loadmopsi.tcl $(LIBDIR)
	-$(INSTALL) plugins/objio.so $(LIBDIR)
	-$(INSTALL) plugins/objio.tcl $(LIBDIR)
	-$(INSTALL) plugins/loadobjio.tcl $(LIBDIR)
	-$(INSTALL) plugins/dxfio.so $(LIBDIR)
	-$(INSTALL) plugins/dxfio.tcl $(LIBDIR)
	-$(INSTALL) plugins/loaddxfio.tcl $(LIBDIR)
	-$(INSTALL) plugins/x3dio.so $(LIBDIR)
	-$(INSTALL) plugins/x3dio.tcl $(LIBDIR)
	-$(INSTALL) plugins/loadx3dio.tcl $(LIBDIR)
	-$(INSTALL) plugins/idr.so $(LIBDIR)
	-$(INSTALL) plugins/idr.tcl $(LIBDIR)
	-$(INSTALL) plugins/loadidr.tcl $(LIBDIR)
	-$(INSTALL) plugins/rrib.so $(LIBDIR)
	-$(INSTALL) plugins/rrib.tcl $(LIBDIR)
	-$(INSTALL) plugins/loadrrib.tcl $(LIBDIR)
	-$(INSTALL) plugins/ayslb.so $(LIBDIR)
	-$(INSTALL) plugins/loadayslb.tcl $(LIBDIR)
	-$(INSTALL) plugins/ayslo.so $(LIBDIR)
	-$(INSTALL) plugins/loadayslo.tcl $(LIBDIR)
	-$(INSTALL) plugins/ayslo3d.so $(LIBDIR)
	-$(INSTALL) plugins/loadayslo3d.tcl $(LIBDIR)
	-$(INSTALL) plugins/ayslx.so $(LIBDIR)
	-$(INSTALL) plugins/loadayslx.tcl $(LIBDIR)
	-$(INSTALL) plugins/ayso.so $(LIBDIR)
	-$(INSTALL) plugins/loadayso.tcl $(LIBDIR)
	-$(INSTALL) plugins/aysdr.so $(LIBDIR)
	-$(INSTALL) plugins/aysdr.tcl $(LIBDIR)
	-$(INSTALL) plugins/loadaysdr.tcl $(LIBDIR)
	-$(INSTALL) plugins/aygso.so $(LIBDIR)
	-$(INSTALL) plugins/loadaygso.tcl $(LIBDIR)
	-$(INSTALL) plugins/ayslc.so $(LIBDIR)
	-$(INSTALL) plugins/loadayslc.tcl $(LIBDIR)
	-$(INSTALL) plugins/aycsg.so $(LIBDIR)
	-$(INSTALL) plugins/aycsg.tcl $(LIBDIR)
	-$(INSTALL) plugins/loadaycsg.tcl $(LIBDIR)
	-$(INSTALL) plugins/onio.so $(LIBDIR)
	-$(INSTALL) plugins/onio.tcl $(LIBDIR)
	-$(INSTALL) plugins/loadonio.tcl $(LIBDIR)
	-$(INSTALL) plugins/sdnpatch.so $(LIBDIR)
	-$(INSTALL) plugins/sdnpatch.tcl $(LIBDIR)
	-$(INSTALL) plugins/loadsdnpatch.tcl $(LIBDIR)
	-$(INSTALL) plugins/libsnurbs.so $(LIBDIR)
	-$(INSTALL) Makefile $(LIBDIR)
	$(MKDIR) $(DOCDIR)
	$(INSTALL) $(DOCFILES) $(DOCDIR)
	$(MKDIR) $(DOCDIR)/html
	$(MKDIR) $(DOCDIR)/html/pics
	$(INSTALL) ../doc/html/*.html $(DOCDIR)/html
	$(INSTALL) ../doc/html/pics/* $(DOCDIR)/html/pics
	@echo "Installation completed."
	@echo "Add $(BINDIR) to your PATH."
	@echo "Add $(LIBDIR) to your LD_LIBRARY_PATH."
	@echo "Use 'make -f $(LIBDIR)/Makefile uninstall' to uninstall."

uninstall:
	-rm -f $(BINDIR)/ayam
	-rm -rf $(LIBDIR)/metaobj.so
	-rm -rf $(LIBDIR)/metaobj.tcl $(LIBDIR)/metacomp.tcl
	-rm -rf $(LIBDIR)/mfio.so $(LIBDIR)/mfio.tcl $(LIBDIR)/loadmfio.tcl
	-rm -rf $(LIBDIR)/mopsi.so $(LIBDIR)/mopsi.tcl $(LIBDIR)/loadmopsi.tcl
	-rm -rf $(LIBDIR)/objio.so $(LIBDIR)/objio.tcl $(LIBDIR)/loadobjio.tcl
	-rm -rf $(LIBDIR)/idr.so $(LIBDIR)/idr.tcl
	-rm -rf $(LIBDIR)/rrib.so $(LIBDIR)/rrib.tcl
	-rm -rf $(LIBDIR)/loadrrib.tcl $(LIBDIR)/loadidr.tcl
	-rm -rf $(LIBDIR)/ayslb.so $(LIBDIR)/loadayslb.tcl
	-rm -rf $(LIBDIR)/ayslo.so $(LIBDIR)/loadayslo.tcl
	-rm -rf $(LIBDIR)/ayslo3d.so $(LIBDIR)/loadayslo3d.tcl
	-rm -rf $(LIBDIR)/ayslx.so $(LIBDIR)/loadayslx.tcl
	-rm -rf $(LIBDIR)/ayso.so $(LIBDIR)/loadayso.tcl
	-rm -rf $(LIBDIR)/aysdr.so $(LIBDIR)/loadaysdr.tcl $(LIBDIR)/aysdr.tcl
	-rm -rf $(LIBDIR)/aygso.so $(LIBDIR)/loadaygso.tcl
	-rm -rf $(LIBDIR)/aycsg.so $(LIBDIR)/aycsg.tcl $(LIBDIR)/loadaycsg.tcl
	-rm -rf $(LIBDIR)/onio.so $(LIBDIR)/onio.tcl $(LIBDIR)/loadonio.tcl
	-rm -rf $(LIBDIR)/dxfio.so $(LIBDIR)/dxfio.tcl $(LIBDIR)/loaddxfio.tcl
	-rm -rf $(LIBDIR)/x3dio.so $(LIBDIR)/x3dio.tcl $(LIBDIR)/loadx3dio.tcl
	-rm -rf $(LIBDIR)/sdnpatch.so $(LIBDIR)/sdnpatch.tcl
	-rm -rf $(LIBDIR)/loadsdnpatch.tcl
	-rm -rf $(LIBDIR)/libsnurbs.so
	-cd $(DOCDIR); rm -rf Setup.txt Changes.txt License.txt refcard.tcl\
refcard.ps ayam.pdf html;
	-rm -rf $(LIBDIR)/Makefile
