# Makefile.install for Unix Squeak using VMMaker		-*- makefile -*-
# 
# Author: ian.piumarta@inria.fr
# 
# Last edited: 2004-04-02 04:17:33 by piumarta on emilia.local

DOCFILES	= COPYING COPYRIGHT LICENSE \
		  README.Contributing README.Keyboard README.Sound

ICONS		= $(topdir)/platforms/unix/vm-display-Quartz/Resources/SqueakVM.icns

install : install-squeak install-plugins install-doc $(install_nps)

uninstall : uninstall-squeak uninstall-plugins uninstall-doc $(uninstall_nps)

# squeak

install-squeak : $(squeak)
	$(MKINSTALLDIRS) $(ROOT)$(plgdir)
	$(INSTALL_PROG) $(squeak) $(ROOT)$(plgdir)
	$(MKINSTALLDIRS) $(ROOT)$(bindir)
	if test -n "$(VM_APP_ICONS)"; then \
	  $(INSTALL_DATA) $(ICONS) $(ROOT)$(VM_APP_ICONS); \
	fi
	( path=`$(cfgdir)/relpath $(bindir) $(plgdir)`; \
	  cd $(ROOT)$(bindir); \
	  rm -f $(squeak); \
	  $(LN_S) $$path/$(squeak) .; )

uninstall-squeak : .force
	if test -n "$(VM_APP_ICONS)"; then \
	  $(UNINSTALL) $(ROOT)$(VM_APP_ICONS); \
	fi
	@$(UNINSTALL) $(ROOT)$(plgdir) $(squeak)
	@$(UNINSTALL) $(ROOT)$(bindir) $(squeak)

# plugins

install-plugins : plugins
	$(MKINSTALLDIRS) $(ROOT)$(plgdir)
	@list='$(PLUGINS_LA)'; for p in $$list; do \
	  if test -f */$$p; then \
	    echo "$(LIBTOOL) --mode=install $(INSTALL_PROG) $$p $(ROOT)$(plgdir)/$$p"; \
	    $(LIBTOOL) --mode=install $(INSTALL_PROG) */$$p $(ROOT)$(plgdir)/$$p; \
	  else :; fi; \
	done
	-rm $(ROOT)$(plgdir)/*.la

uninstall-plugins : .force
	@list='$(PLUGINS_LA)'; for p in $$list; do \
	  if test -f $(ROOT)/$(plgdir)/$$p; then \
	    echo "$(LIBTOOL) --mode=uninstall rm -f $(ROOT)$(plgdir)/$$p"; \
	    $(LIBTOOL) --mode=uninstall rm -f $(ROOT)$(plgdir)/$$p; \
	  else :; fi; \
	done
	@$(UNINSTALL) $(ROOT)$(plgdir)

# doc

install-doc : squeak.1
	$(MKINSTALLDIRS) $(ROOT)$(docdir)
	@list='$(DOCFILES)'; for f in $$list; do \
	  echo $(INSTALL_DATA) $(topdir)/platforms/unix/doc/$$f $(ROOT)$(docdir); \
	  $(INSTALL_DATA) $(topdir)/platforms/unix/doc/$$f $(ROOT)$(docdir); \
	done
	gzip -f9 $(ROOT)$(docdir)/*
	$(MKINSTALLDIRS) $(ROOT)$(mandir)/man1
	$(INSTALL_DATA) squeak.1 $(ROOT)$(mandir)/man1
	rm -f $(ROOT)$(mandir)/man1/inisqueak.1
	$(LN_S) squeak.1 $(ROOT)$(mandir)/man1/inisqueak.1

uninstall-doc :
	@$(UNINSTALL) $(ROOT)$(docdir) $(DOCFILES)
	@$(UNINSTALL) $(ROOT)$(mandir)/man1 squeak.1 inisqueak.1

# image

install-image : inisqueak $(topdir)/Squeak$(SQ_VERSION).image.gz $(topdir)/Squeak$(SQ_VERSION).changes.gz
	$(MKINSTALLDIRS) $(ROOT)$(imgdir)
	$(INSTALL_PROG) inisqueak $(ROOT)$(imgdir)
	$(INSTALL_DATA) $(topdir)/Squeak$(SQ_VERSION).image.gz $(ROOT)$(imgdir)
	$(INSTALL_DATA) $(topdir)/Squeak$(SQ_VERSION).changes.gz $(ROOT)$(imgdir)
	$(LN_S) Squeak$(SQ_VERSION).image.gz $(ROOT)$(imgdir)/squeak.image.gz
	$(LN_S) Squeak$(SQ_VERSION).changes.gz $(ROOT)$(imgdir)/squeak.changes.gz
	$(MKINSTALLDIRS) $(ROOT)$(bindir)
	( path=`$(cfgdir)/relpath $(bindir) $(imgdir)`; \
	  cd $(ROOT)$(bindir); \
	  rm -f inisqueak; \
	  $(LN_S) $$path/inisqueak .; )

uninstall-image :
	@$(UNINSTALL) $(ROOT)$(plgdir) Squeak$(SQ_VERSION).image.gz
	@$(UNINSTALL) $(ROOT)$(plgdir) Squeak$(SQ_VERSION).changes.gz
	@$(UNINSTALL) $(ROOT)$(plgdir) inisqueak

# sources

install-sources :
	$(MKINSTALLDIRS) $(ROOT)$(imgdir)
	$(INSTALL_DATA) $(topdir)/SqueakV$(SQ_MAJOR).sources $(ROOT)$(imgdir)

uninstall-sources :
	@$(UNINSTALL) $(ROOT)$(imgdir) SqueakV$(SQ_MAJOR).sources

# npsqueak

install-npsqueak : npsqueak .force
	$(SHELL) -ec 'cd nps; $(MAKE) install VM_VERSION=$(VM_VERSION) SQ_DIR=$(ROOT)$(imgdir) imgdir=$(imgdir)'

uninstall-npsqueak : npsqueak .force
	$(SHELL) -ec 'cd nps; $(MAKE) uninstall VM_VERSION=$(VM_VERSION) SQ_DIR=$(ROOT)$(imgdir) imgdir=$(imgdir)'
