
# Makefile.in for sdop. The building work is done by a separate Makefile in
# the src directory, which gets passed settings from here.

mkinstalldirs = $(SHELL) mkinstalldirs

# These variables get set up by the configure script.

CC = @CC@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@

INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@

BINDIR  = @prefix@/bin
DATADIR = @prefix@/share/sdop
MANDIR  = @prefix@/man

# BINDIR is the directory in which the commands are installed.
# DATADIR is the directory in which the hyphen list and font metrics are installed.
# MANDIR is the directory in which the man pages are installed.

SUPPORT_JPEG = @SUPPORT_JPEG@
SUPPORT_PNG  = @SUPPORT_PNG@

# The compile commands can be very long. To make the output look better,
# they are not normally echoed in full. To get full echoing, the caller
# must set FULLECHO='' on the command line and call make with -e. We default
# FULLECHO to '@' to suppress the full echo. Then define an abbreviation.

FULLECHO = @
FE       = $(FULLECHO)

# Do the building in the src directory

build:; @cd src; $(MAKE) all \
                BINDIR=$(BINDIR) \
                DATADIR=$(DATADIR) \
                MANDIR=$(MANDIR) \
                SUPPORT_JPEG=$(SUPPORT_JPEG) \
                SUPPORT_PNG=$(SUPPORT_PNG) \
                CC="$(CC)" \
                CFLAGS="$(CFLAGS)" \
                LDFLAGS="$(LDFLAGS)" \
                LIBS="$(LIBS)" \
                FE="$(FE)"

clean:; cd src; $(MAKE) clean

distclean:;     rm Makefile config.cache config.log config.status; \
                cd src; $(MAKE) clean

test:           build
		cd testing; runtest

install:        build
		$(mkinstalldirs) $(BINDIR)
		$(mkinstalldirs) $(DATADIR)
		$(mkinstalldirs) $(DATADIR)/fontmetrics
		$(mkinstalldirs) $(MANDIR)
		$(mkinstalldirs) $(MANDIR)/man1
		$(INSTALL) src/sdop $(BINDIR)/sdop
		$(INSTALL_DATA) share/HyphenData $(DATADIR)
		$(INSTALL_DATA) share/PSheader $(DATADIR)
		$(INSTALL_DATA) share/arttemplate $(DATADIR)
		$(INSTALL_DATA) share/foottable* $(DATADIR)
		$(INSTALL_DATA) share/foottable-p* $(DATADIR)
		$(INSTALL_DATA) share/foottable-t* $(DATADIR)
		$(INSTALL_DATA) share/headtable* $(DATADIR)
		$(INSTALL_DATA) share/headtable-p* $(DATADIR)
		$(INSTALL_DATA) share/headtable-t* $(DATADIR)
		$(INSTALL_DATA) share/indexcollate $(DATADIR)
		$(INSTALL_DATA) share/titletemplate $(DATADIR)
		$(INSTALL_DATA) share/toctemplate $(DATADIR)
		$(INSTALL_DATA) share/fontmetrics/* $(DATADIR)/fontmetrics
		$(INSTALL_DATA) doc/sdop.1 $(MANDIR)/man1

uninstall:
		rm $(BINDIR)/sdop
		rm -rf $(DATADIR)/*
		rm $(MANDIR)/man1/sdop.1

# End
