#----------------------------------------------------------------------------
# Ligatex - Makefile
#
# v0.2.0
#
# Taken from the GNU Talkfilters v 1.0 
# See GNU General Public License for modification and distribution
# information.
#----------------------------------------------------------------------------

SHELL = /bin/sh

.SUFFIXES: .c .l .o

#----------------------------------------------------------------------------

srcdir = @srcdir@
VPATH = @srcdir@

CC = @CC@
LEX = @LEX@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@

CFLAGS = @CFLAGS@ 
LFLAGS =  -Cf -8
CFLAGS_COMPILE_ONLY = -c 
LDFLAGS = @LDFLAGS@
O=o

LIBS = @LIBS@ -lfl

prefix = @prefix@
exec_prefix = @exec_prefix@

# Where the installed binary goes.
bindir = @bindir@
binprefix = 

mandir = ${prefix}/man/man${manext}
manext = 1
manprefix = 

#### End of system configuration section. ####

#----------------------------------------------------------------------------

PACKAGE		= ligatex-0.2.0
FILTERS		= ligatex
PROGS		= $(FILTERS) 

all:		$(PROGS)

GETOPT = getopt.o getopt1.o
COMMON = $(GETOPT) common.o

.l.c:
	$(LEX) $(LFLAGS) $<
	mv lex.yy.c $@

.c.o:
	$(CC) -c $<

ligatex: ligatex.o $(COMMON)
	$(CC) $(CFLAGS) ligatex.o $(COMMON) -o $@ $(LIBS)



install: all installdirs
	${INSTALL_DATA} ${srcdir}/ligatex.man \
		${mandir}/${manprefix}/ligatex.${manext}; \
	for i in $(FILTERS); do \
		${INSTALL_PROGRAM} $$i ${bindir}/${binprefix}$$i; \
		${INSTALL_DATA} ${srcdir}/$$i.man \
			${mandir}/${manprefix}$$i.${manext}; \
	done

uninstall:
	for i in $(PROGS); do \
		rm -f ${bindir}/${binprefix}/$$i; \
		rm -f ${mandir}/$$i.${manext}; \
	done

install-strip:
	$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install

dist: 	distclean
	cd .. ; \
	rm -f $(PACKAGE).tar $(PACKAGE).tar.gz ; \
	tar cvf $(PACKAGE).tar ./$(PACKAGE) ; \
	gzip $(PACKAGE).tar

distclean: clean
	rm -f *.log config.cache config.status  ref.man

installdirs:
	$(SHELL) ${srcdir}/mkinstalldirs ${bindir} ${mandir}

mostlyclean: clean

clean:
	rm -f core *.o *.log
	for i in $(PROGS); do \
		rm -f $$i; \
	done;
	for i in $(FILTERS); do \
	  rm -f $$i.c; \
	done;









