# Generated automatically from Makefile.in by configure.
# Makefile for GNU recode.
# Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
# Francois Pinard <pinard@iro.umontreal.ca>, 1988.

# This program is 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.

# This program is distributed in the hope that it 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 this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

SHELL = /bin/sh

srcdir = .
VPATH = .
U = 

CC = gcc
AR = ar
RANLIB = ranlib
INSTALL = /c/install -c
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_PROGRAM = $(INSTALL)
MAKEINFO = makeinfo
TEXI2DVI = texi2dvi

# GNU awk (or nawk, or mawk) is required for remaking merged.c.
AWK = gawk
# Flex (2.3 or better) is required for remaking merged.c.
LEX = flex

# Special values for DEFS:
# -DMSDOS		If you are using Messy-DOS; implies USE_FPUTC.
# -DUSE_FPUTC		If merged.c overflows or thrashes the C compiler.

CFLAGS = -g
DEFS = -DHAVE_CONFIG_H
LDFLAGS = -g $(LDEFS)
LDEFS = 
LIBS =  

prefix = /usr/local
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
infodir = $(prefix)/info

CPPFLAGS = -I. -I$(srcdir) $(DEFS)

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

HEADERS = getopt.h pathmax.h recode.h charname.h charset.h
SOURCES = recode.c charname.c $(C_STEPS) $(L_STEPS)
OBJECTS = $Urecode.o $Ucharname.o $(STEPOBJS)
LIBSRCS = alloca.c argmatch.c getopt.c getopt1.c error.c xmalloc.c \
xstrdup.c flexlib.c
LIBOBJS =  argmatch.o getopt.o getopt1.o error.o xmalloc.o \
xstrdup.o  flexlib.o
# Beware that when ` flexlib.o' is empty, the last `\' may be wrong.

C_STEPS = charset.c applemac.c atarist.c bangbang.c cdcnos.c \
ebcdic.c flat.c ibmpc.c iconqnx.c lat1asci.c lat1ltex.c \
lat1txte.c nextstep.c

L_STEPS = ascilat1.l ltexlat1.l txtelat1.l

STEPOBJS = $Ucharset.o $Uapplemac.o $Uatarist.o $Ubangbang.o $Ucdcnos.o \
$Uebcdic.o $Uflat.o $Uibmpc.o $Uiconqnx.o $Ulat1asci.o $Ulat1ltex.o \
$Ulat1txte.o $Unextstep.o $Umerged.o

DISTFILES = README HINTS NEWS TODO THANKS COPYING INSTALL ChangeLog \
configure.in acconfig.h aclocal.m4 mkinstalldirs install.sh ansi2knr.c \
Makefile.in mergelex.awk unhexify.l recode.texi texinfo.tex \
$(HEADERS) $(SOURCES) $(LIBSRCS) c-boxes.el checkit \
rfc1345.txt charname.sed charname.pl charset.sed charset.pl \
.stamp-h.in config.h.in configure merged.c charset.texi recode.info

# Put aside for now: configdos.pl config.tcc.

CHECKTEST = @$(SHELL) $(srcdir)/checkit $(srcdir)/COPYING

all: recode

recode: .stamp-collect $(OBJECTS) librec.a
	$(CC) $(LDFLAGS) -o recode $(OBJECTS) librec.a $(LIBS)

$(srcdir)/merged.c: mergelex.awk $(L_STEPS)
	(cd $(srcdir); $(AWK) -f mergelex.awk $(L_STEPS)) \
	| $(LEX) -t8 | grep -v '^# *line [0-9]' > merged.tmp
	mv merged.tmp $(srcdir)/merged.c
	@rm -f $(srcdir)/merged*.tmp

charname.h: charname.sed charname.pl rfc1345.txt
	sed -n -f charname.sed rfc1345.txt | perl charname.pl

charset.h charset.texi: charset.sed charset.pl rfc1345.txt
	sed -n -f charset.sed rfc1345.txt | perl charset.pl

ansi2knr: ansi2knr.c
	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o ansi2knr $(srcdir)/ansi2knr.c
_recode.c: recode.c ansi2knr
	./ansi2knr $(srcdir)/recode.c > _recode.c
_charname.c: charname.c ansi2knr
	./ansi2knr $(srcdir)/charname.c > _charname.c
_charset.c: charset.c ansi2knr
	./ansi2knr $(srcdir)/charset.c > _charset.c
_applemac.c: applemac.c ansi2knr
	./ansi2knr $(srcdir)/applemac.c > _applemac.c
_atarist.c: atarist.c ansi2knr
	./ansi2knr $(srcdir)/atarist.c > _atarist.c
_bangbang.c: bangbang.c ansi2knr
	./ansi2knr $(srcdir)/bangbang.c > _bangbang.c
_cdcnos.c: cdcnos.c ansi2knr
	./ansi2knr $(srcdir)/cdcnos.c > _cdcnos.c
_ebcdic.c: ebcdic.c ansi2knr
	./ansi2knr $(srcdir)/ebcdic.c > _ebcdic.c
_flat.c: flat.c ansi2knr
	./ansi2knr $(srcdir)/flat.c > _flat.c
_ibmpc.c: ibmpc.c ansi2knr
	./ansi2knr $(srcdir)/ibmpc.c > _ibmpc.c
_iconqnx.c: iconqnx.c ansi2knr
	./ansi2knr $(srcdir)/iconqnx.c > _iconqnx.c
_lat1asci.c: lat1asci.c ansi2knr
	./ansi2knr $(srcdir)/lat1asci.c > _lat1asci.c
_lat1ltex.c: lat1ltex.c ansi2knr
	./ansi2knr $(srcdir)/lat1ltex.c > _lat1ltex.c
_lat1txte.c: lat1txte.c ansi2knr
	./ansi2knr $(srcdir)/lat1txte.c > _lat1txte.c
_nextstep.c: nextstep.c ansi2knr
	./ansi2knr $(srcdir)/nextstep.c > _nextstep.c
_merged.c: merged.c ansi2knr
	./ansi2knr $(srcdir)/merged.c > _merged.c

$(OBJECTS): config.h
$Urecode.o $Ucharname.o $Ucharset.o $(STEPOBJS): recode.h
$Urecode.o: initstep.h
$Ucharname.o: charname.h
$Ucharset.o: charset.h

.stamp-collect: charset.h $(C_STEPS) merged.c
	(cd $(srcdir); sed -n 's/^\(module_[^ ]*\).*/  \1 ();/p' \
	  charset.h $(C_STEPS) merged.c ) > initstep.tmp
	if cmp -s initstep.h initstep.tmp; then rm initstep.tmp; \
	else mv initstep.tmp initstep.h; fi
	touch .stamp-collect

librec.a: $(LIBOBJS)
	rm -f librec.a
	$(AR) cru librec.a $(LIBOBJS)
	$(RANLIB) librec.a

$(LIBOBJS): config.h
getopt.o getopt1.o: getopt.h

check: recode
	@./recode --version
	$(CHECKTEST) texte texte
	$(CHECKTEST) texte latin1
	$(CHECKTEST) texte ibmpc
	$(CHECKTEST) texte iconqnx
	$(CHECKTEST) texte bangbang
	$(CHECKTEST) ascii-bs ebcdic
	@echo "All checks completed successfully."

autocheck:
	@echo "The following test may take part of an hour.  Be patient."
	@(./recode --auto-check | grep UNACH | grep -v '^flat') || exit 0

info: recode.info

recode.info: recode.texi charset.texi
	$(MAKEINFO) -I$(srcdir) --no-split recode.texi

dvi: recode.dvi

recode.dvi: recode.texi
	$(TEXI2DVI) $(srcdir)/recode.texi

install: recode recode.info installdirs
	$(INSTALL_PROGRAM) recode $(bindir)/recode
	$(INSTALL_DATA) $(srcdir)/recode.info $(infodir)/recode.info

# Make sure all installation directories, e.g. $(bindir) actually exist by
# making them if necessary.
installdirs:
	$(SHELL) $(srcdir)/mkinstalldirs $(bindir) $(infodir)

uninstall: all
	rm -f $(bindir)/recode $(infodir)/recode.info

tags: $(HEADERS) $(SOURCES)
	ctags $(HEADERS) $(SOURCES)

TAGS: $(HEADERS) $(SOURCES)
	etags -t $(HEADERS) $(SOURCES)

texclean:
	rm -f *.aux *.cp *.dvi *.fn *.ky *.log *.pg *.toc *.tp *.vr

mostlyclean: texclean
	rm -f *~ *.tmp core

clean: mostlyclean
	rm -f recode unhexify _*.c *.o *.a

distclean: clean
	rm -f tags TAGS Makefile config.status config.h ansi2knr
	rm -f initstep.h .stamp-collect

realclean: distclean
	rm -f recode.info merged.c charname.h charset.h charset.texi

dist: $(DISTFILES)
	@echo "Did you run \`make detecthex' recently?"
	pwd | sed 's|.*/||' > .fname
	rm -rf `cat .fname`
	mkdir `cat .fname`
	chmod 777 `cat .fname`
	ln $(DISTFILES) `cat .fname`
	chmod -R a+r `cat .fname`
	tar chozf `cat .fname`.tar.gz `cat .fname`
	rm -rf `cat .fname` .fname

dist.dos: $(DISTFILES)
	rm -rf dist.dos
	rm -f recode.zoo
	mkdir dist.dos
	cp $(DISTFILES) dist.dos
	perl configdos.pl config.tcc > dist.dos/makefile
	echo $(OBJECTS) | tr -s ' ' "\012" | \
	  sed 's/\.o$$/.obj/' > dist.dos/objects.lst
	cd dist.dos; chmod +w *; ../recode :ibmpc *; zoo ahq ../recode *
	rm -rf dist.dos

# Once in a while, find ramping octal or hexadecimal!
detecthex: unhexify
	PATH=`pwd`:$(PATH); cd $(srcdir); \
	for file in $(HEADERS) $(SOURCES); do \
	  unhexify $$file | diff -u $$file -; \
	done

unhexify: unhexify.l
	$(LEX) $(srcdir)/unhexify.l
	$(CC) $(LDFLAGS) -o unhexify lex.yy.c $(LIBS)
	rm -f lex.yy.c

# The next rule also takes care of making config.h from config.h.in.
# If remaking config.h does not change it, its timestamp is untouched.
Makefile: Makefile.in config.status .stamp-h.in
	$(SHELL) config.status
config.status: configure
	$(SHELL) config.status --recheck
configure: configure.in aclocal.m4
	cd $(srcdir); autoconf
.stamp-h.in: configure.in aclocal.m4 acconfig.h
	cd $(srcdir); autoheader
	touch $(srcdir)/.stamp-h.in

# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
