# Makefile for XaoS
#
# Always use src as the top-level
prefix= @prefix@
exec_prefix= @exec_prefix@
datadir= @datadir@
bindir= @bindir@
mandir= @mandir@
infodir= @infodir@

@SET_MAKE@

default clean realclean echo help depend xaos:
	@cd src ; $(MAKE) $@

all:
	@cd src ; $(MAKE) all

distclean:
	#@$(MAKE) -C src $@
	@$(MAKE) -C src distclean
	rm -f libtool config.cache config.status config.log src/include/config.h src/include/aconfig.h
	rm -f src/Makefile.common src/arch/linux/Makefile.main
	rm -f `find . -name Makefile`
	rm -f `find . -name '*~'`
	rm -f `find . -name '*.d'`
	rm -f `find . -name '*[\.]orig'`
	rm -vf `find . -size 0`

install: 
	@INSTALL@ -d $(DESTDIR)$(datadir)/XaoS
	@INSTALL@ -d $(DESTDIR)$(datadir)/XaoS/tutorial
	@INSTALL@ -d $(DESTDIR)$(datadir)/XaoS/examples
	@INSTALL@ -d $(DESTDIR)$(datadir)/XaoS/catalogs
	@INSTALL@ -d $(DESTDIR)$(datadir)/XaoS/doc
	@INSTALL@ -d $(DESTDIR)$(datadir)/XaoS/help
	@INSTALL@ -d $(DESTDIR)$(bindir)
	@INSTALL@ -d $(DESTDIR)$(mandir)/man6
	@INSTALL@ -s bin/xaos $(DESTDIR)$(bindir)
	@INSTALL@ -m 444 tutorial/*.x[ah]f $(DESTDIR)$(datadir)/XaoS/tutorial

	@INSTALL@ -m 444 examples/README $(DESTDIR)$(datadir)/XaoS/examples
	@INSTALL@ -m 444 examples/Hubicka/*.x[ap]f $(DESTDIR)$(datadir)/XaoS/examples
	@INSTALL@ -m 444 examples/0rfelyus/*.x[ap]f $(DESTDIR)$(datadir)/XaoS/examples
	@INSTALL@ -m 444 examples/ZKovacs/*.x[ap]f $(DESTDIR)$(datadir)/XaoS/examples
	@INSTALL@ -m 444 examples/ZsKovacs/*.x[ap]f $(DESTDIR)$(datadir)/XaoS/examples
	@INSTALL@ -m 444 examples/Malczak/*.x[ap]f $(DESTDIR)$(datadir)/XaoS/examples

	@INSTALL@ -m 444 catalogs/*.cat catalogs/README $(DESTDIR)$(datadir)/XaoS/catalogs
	@INSTALL@ -m 444 help/xaos.hlp $(DESTDIR)$(datadir)/XaoS/help
	@INSTALL@ -m 444 doc/README doc/README.bugs doc/compilers.txt doc/AUTHORS doc/PROBLEMS $(DESTDIR)$(datadir)/XaoS/doc
	@INSTALL@ -m 444 doc/xaos.6 $(DESTDIR)$(mandir)/man6
	-@STICKY@
	test -z "$(infodir)" || @INSTALL@ -d "$(DESTDIR)$(infodir)"
	@INSTALL@ -m 444 doc/xaos.info $(DESTDIR)$(infodir)/xaos.info
	@if (install-info --version) >/dev/null 2>&1; then      \
	  echo " install-info --info-dir='$(DESTDIR)$(infodir)' \
	         '$(DESTDIR)$(infodir)/xaos.info'";             \
	  install-info --info-dir="$(DESTDIR)$(infodir)"        \
	               "$(DESTDIR)$(infodir)/xaos.info";        \
        else : ; fi

	if [ "@USE_NLS@" = "yes" ]; then $(MAKE) -C src/i18n/ install; fi

install-win:
	@INSTALL@ -d $(DESTDIR)/tutorial
	@INSTALL@ -d $(DESTDIR)/examples
	@INSTALL@ -d $(DESTDIR)/catalogs
	@INSTALL@ -d $(DESTDIR)/doc
	@INSTALL@ -d $(DESTDIR)/help
	@INSTALL@ -d $(DESTDIR)/bin

	@INSTALL@ tutorial/*.x[ah]f $(DESTDIR)/tutorial
	@INSTALL@ examples/README $(DESTDIR)/examples
	@INSTALL@ examples/Hubicka/*.x[ap]f $(DESTDIR)/examples
	@INSTALL@ examples/0rfelyus/*.x[ap]f $(DESTDIR)/examples
	@INSTALL@ examples/ZKovacs/*.x[ap]f $(DESTDIR)/examples
	@INSTALL@ examples/ZsKovacs/*.x[ap]f $(DESTDIR)/examples
	@INSTALL@ examples/Malczak/*.x[ap]f $(DESTDIR)/examples
	@INSTALL@ catalogs/*.cat catalogs/README $(DESTDIR)/catalogs
	@INSTALL@ doc/README doc/README.bugs doc/compilers.txt doc/AUTHORS doc/PROBLEMS $(DESTDIR)/doc
	@if test -f "help/XAOSWIN.HLP"; then          \
	  @INSTALL@ help/XAOSWIN.HLP $(DESTDIR)/help; \
	fi
	@INSTALL@ bin/xaos.exe $(DESTDIR)/bin

	if [ "@USE_NLS@" = "yes" ]; then $(MAKE) -C src/i18n/ install-win; fi
