## Process this file with automake to produce Makefile.in

AUTOMAKE_OPTIONS = check-news

SUBDIRS = pubtext unicode doc \
	include generic \
	lib nsgmls spent spam sgmlnorm sx spcat \
	intl po

pkginclude_HEADERS = config.h

docdir = $(datadir)/doc
pkgdocdir = $(docdir)/@PACKAGE@
man1dir=$(mandir)/man1

man_MANS = onsgmls.1 osgmlnorm.1 ospent.1 ospam.1 osx.1

pkgdoc_DATA = README ABOUT-NLS NEWS COPYING AUTHORS ChangeLog \
	releasenotes.html releasenotes.pdf releasenotes.ps

BUILT_SOURCES = config.h msggen.pl

# these are not in CVS and get generated by 'automake --add-missing'
MAINTAINERCLEANFILES = install-sh mkinstalldirs missing \
	config.guess config.sub	ltconfig ltmain.sh INSTALL \
	Makefile.in

## Note that we include the windows-only aux files.
## We include msggen.pl, since it won't be generated on Windows.
EXTRA_DIST = instmac.pl msggen.pl sunfix.sh SP.dsw SP.mak \
	build-win32.bat sp-generate.mak .cvsignore all \
	@PACKAGE@-@VERSION@.spec config.rpath onsgmls.1 \
	osgmlnorm.1 ospam.1 ospent.1 osx.1 releasenotes.html \
	releasenotes.pdf releasenotes.ps

dist-hook:
	mv $(distdir)/include/config.h.old $(distdir)/config.h
	if test -f $(top_srcdir)/update-changelog; then \
	  cd $(top_srcdir); \
	  ./update-changelog; \
	  cp $(top_srcdir)/ChangeLog $(top_distdir); \
	fi

dist-zip: distdir
	-chmod -R a+r $(distdir)
	zip -rql $(distdir).zip $(distdir)
	-rm -rf $(distdir)

install-man:
	$(mkinstalldirs) $(DESTDIR)$(man1dir)
	@list='$(man1_MANS)'; \
	l2='$(man_MANS)'; for i in $$l2; do \
	  case "$$i" in \
            *.1*) list="$$list $$i" ;; \
	  esac; \
	done; \
	for i in $$list; do \
	  if test -f $(TOP)/docsrc/$$i; then file=$(TOP)/docsrc/$$i; \
	  else file=$$i; fi; \
	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
	  echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \
	  $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \
	done
