# /*
# ================================================================================
#                         Texinfo converting Tools
#                          Release 1.00  28.03.97
#                        (c) 1996 by Andreas Kaiser
#                     (c) 1997 by Karl Heinz Marbaise
# ================================================================================
#
# Discription:
#    makefile to compile the Texinfo converting Tools
#
# Authors:
#    Andreas Kaiser
#    Karl Heinz Marbaise
#
# e-mail:
#    Internet: KHMarbaise@p69.ks.fido.de
#    Fido-net: 2:2452/117.69
#
# Bugs, question:
#    to above e-mail adress.
#
# Register:
#    Please send a e-mail to above adress to register.
#    (include the release you want to register)
#    This registration should be done to let me
#    know how many people using these tools and
#    if it is worth to invest more time in continuing
#    development these tools or let the first release
#    of them be the last.
#    That is the only reason to make a registration.
#    I think a e-mail is not to much, isn't it?
#
# License:
#    The "Texinfo converting tools" are free software;
#    you can redistribute it and/or modify it under the terms of
#    the GNU General Public License as published by the Free
#    Software Foundation; either version 2, or (at your option)
#    any later version.
#
#    The "Texinfo converting tools" are distributed in the hope that
#    they will be useful, but WITHOUT ANY WARRANTY; without even the
#    implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
#    PURPOSE.  See the GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with the "Texinfo converting tools" ; see the file COPYING.
#    If not, write to the:
#    Free Software Foundation,
#    59 Temple Place - Suite 330,
#    Boston, MA 02111-1307, USA.
#
#    See \texicvt1.00\COPYING for details.
#
# ================================================================================
# */
#
# $Id: MAKEFILE 1.6 1997/03/30 15:08:20 KHM Exp $
#
ifeq ($(OS),linux)
O=.o
EXE=
else
O=.o
EXE=.exe
endif
#
.SUFFIXES:
.SUFFIXES: .l .y .cc .h
#
vpath %$(O) .
vpath %.c   .
vpath %.cc  .
vpath %.h   .
vpath %.l   .
vpath %.y   .
#
YACC = bison
YFLAGS = -l -d -v
LEX = flex
ifdef DEBUG
LFLAGS = -p -d -8 -L -s
else
LFLAGS = -p -8 -L -s -d
endif
CC = gcc
##
ifdef DEBUG
CFLAGS = -Wall -g -DDEBUG -Igen -I.
LDFLAGS += -g
else
CFLAGS = -O2 -s -Igen -I.
endif
##
ifeq ($(OS),linux)
LDLIBS	+= -Lgen -lg++ -lstdc++ -lstr
else
LDLIBS	+= -Lgen -lgpp -lstdcpp -lstr
endif

#
%$(O): %.cc
	$(CC) $(CFLAGS) -c $<

%.c: %.l
	$(LEX) $(LFLAGS) -o$@ $<

%.cc: %.l
	$(LEX) $(LFLAGS) -o$@ $<

%.c: %.y
	$(YACC) $(YFLAGS) -o $@ $<
#
#
OBJIPF = version$(O) main$(O) util$(O) scan$(O)
OBJHTML = version$(O) utilhtml$(O) mainhtml$(O) htmlnew$(O)
OBJRTF = version$(O) utilrtf$(O) mainrtf$(O) rtf$(O)
#####OBJTEST = utiltest$(O) maintest$(O) htmltest$(O) outhtml$(O)
OBJTESTNEW = testmain$(O) test$(O) output$(O) \
	     outipf$(O) outhtml$(O) outrtf$(O) outroff$(O)
#
.PHONY: all clean lexer

all: texi2ipf$(EXE) texihtml$(EXE) texi2rtf$(EXE)



clean:
	-rm *$(O)
	-rm *.bak
	-rm texi2ipf$(EXE)
	-rm texihtmlf$(EXE)
	-rm texitest$(EXE)
	-rm texi2rtf$(EXE)
	-rm test$(EXE)
	-rm scan.cc
	-rm scan.out
	-rm html.cc
	-rm html.out
	-rm htmltest.cc
	-rm htmlnew.cc
	-rm rtf.cc
	-rm test.cc


texi2ipf$(EXE): $(OBJIPF) scan$(O)
	$(CC) $(LDFLAGS) -o $@ $(OBJIPF) $(LDLIBS)

texihtml$(EXE): $(OBJHTML) htmlnew$(O)
	$(CC) $(LDFLAGS) -o $@ $(OBJHTML) $(LDLIBS)

texitest$(EXE): $(OBJTEST)
	$(CC) $(LDFLAGS) -o $@ $(OBJTEST) $(LDLIBS)

texi2rtf$(EXE): $(OBJRTF)
	$(CC) $(LDFLAGS) -o $@ $(OBJRTF) $(LDLIBS)

test$(EXE): $(OBJTESTNEW)
	$(CC) $(LDFLAGS) -o $@ $(OBJTESTNEW) $(LDLIBS)


lexer: scan$(O) html$(O)

# -------------------
#    explicit rules
# -------------------
#
# Lexical analyser
scan.cc: scan.l version.h

scan$(O): scan.cc info.h version.h

main$(O): main.cc info.h version.h

util$(O): util.cc info.h version.h

utilhtml$(O): utilhtml.cc info.h version.h

utiltest$(O): utiltest.cc info.h version.h

mainhtml$(O): mainhtml.cc info.h version.h

maintest$(O): maintest.cc info.h version.h

html$(O): html.cc info.h version.h

html.cc: html.l version.h

test$(O): test.cc info.h version.h

test.cc: test.l version.h

htmlnew$(O): htmlnew.cc info.h version.h

htmlnew.cc: htmlnew.l version.h

htmltest$(O): htmltest.cc info.h version.h

htmltest.cc: htmltest.l version.h

version$(O): version.cc version.h







