# Generated automatically from Makefile.in by configure.
# Makefile for TeX-project WEB sources to C conversion programs.

# These get expanded from the parent directory, not this one.
# common.make -- used by all Makefiles.
SHELL = /bin/sh

top_srcdir = ..
srcdir = .

CC = gcc
CFLAGS = -g -O2 $(XCFLAGS)
CPPFLAGS =  $(XCPPFLAGS)
DEFS = -DHAVE_CONFIG_H $(XDEFS)

# Kpathsea needs this for compiling, programs need it for linking.
LIBTOOL = $(kpathsea_srcdir_parent)/klibtool

# You can change [X]CPPFLAGS, [X]CFLAGS, or [X]DEFS, but
# please don't change ALL_CPPFLAGS or ALL_CFLAGS.
# prog_cflags is set by subdirectories of web2c.
ALL_CPPFLAGS = $(DEFS) -I. -I$(srcdir) $(prog_cflags) \
  -I$(kpathsea_parent) -I$(kpathsea_srcdir_parent) $(CPPFLAGS)
ALL_CFLAGS = $(ALL_CPPFLAGS) $(CFLAGS) -c
compile = $(CC) $(ALL_CFLAGS)

.SUFFIXES: .c .o # in case the suffix list has been cleared, e.g., by web2c
.c.o:
	$(compile) $<

# Installation.
INSTALL = ${DJDIR}/bin/ginstall -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = $(INSTALL_PROGRAM)
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_LIBTOOL_LIBS = INSTALL_DATA='$(INSTALL_DATA)' $(LIBTOOL) install-lib
INSTALL_LIBTOOL_PROG = INSTALL_PROGRAM='$(INSTALL_PROGRAM)' $(LIBTOOL) install-prog

# We use these for many things.
kpathsea_parent = ..
kpathsea_dir = $(kpathsea_parent)/kpathsea
kpathsea_srcdir_parent = $(top_srcdir)/..
kpathsea_srcdir = $(kpathsea_srcdir_parent)/kpathsea
kpathsea = $(kpathsea_dir)/libkpathsea.la

##ifeq ($(CC), gcc)
##XDEFS = -D__USE_FIXED_PROTOTYPES__ -Wall -Wpointer-arith $(warn_more)
##CFLAGS = -g $(XCFLAGS)
##endif
# End of common.make.
# programs.make -- used by Makefiles for executables only.

# Don't include $(CFLAGS), since ld -g under Linux forces
# static libraries, e.g., libc.a and libX*.a.
LDFLAGS =  $(XLDFLAGS)

# proglib is for web2c; 
# XLOADLIBES is for the installer.
LIBS = 
LOADLIBES = $(proglib) $(kpathsea) $(LIBS) -lm $(XLOADLIBES)

# May as well separate linking from compiling, just in case.
CCLD = $(CC)
link_command = $(CCLD) -o $@ $(LDFLAGS) 

# When we link with Kpathsea, have to take account that it might be a
# shared library, etc.
kpathsea_link = $(LIBTOOL) link $(link_command)
# End of programs.make.
# web2c/kpathsea.make -- In subdirectories of web2c, the build directory
# for kpathsea is one more level up.  c_auto_h_dir is used by make depend.
kpathsea_parent = ../..
c_auto_h_dir = ..

prog_cflags = -I.. -I$(srcdir)/..
# End of web2c/kpathsea.make.

LEX = flex
LEXLIB = -lfl
LEX_OUTPUT_ROOT = lexyy
YACC = bison -y

proglib = ../lib/lib.a
programs = web2c fixwrites splitup

web2c_objects = main.o y_tab.o $(LEX_OUTPUT_ROOT).o
all: $(programs)
web2c: $(web2c_objects)
	$(kpathsea_link) $(web2c_objects) $(LEXLIB) $(LOADLIBES) 

# Use y_tab.* for the sake of MS-DOS which doesn't allow multiple dots.
main.o: main.c y_tab.h
y_tab.c y_tab.h: web2c.y
	@echo Expect one shift/reduce conflict.
	$(YACC) -d -v $(srcdir)/web2c.y
	test -f	y_tab.c || mv -f y.tab.c y_tab.c
	test -f	y_tab.h || mv -f y.tab.h y_tab.h
$(LEX_OUTPUT_ROOT).o: y_tab.h
$(LEX_OUTPUT_ROOT).c: web2c.l
	$(LEX) $(srcdir)/web2c.l

fixwrites: fixwrites.o
	$(kpathsea_link) fixwrites.o $(LOADLIBES)
splitup: splitup.o
	$(kpathsea_link) splitup.o $(LOADLIBES)
regfix: regfix.o
	$(kpathsea_link) regfix.o $(LOADLIBES)

$(programs): $(proglib) $(kpathsea)

##ifdef HOSTNAME
### It's really not worth srcdir etc. here.
##lib_sources = $(addprefix ../lib/,alloca.c basechsuffix.c chartostring.c \
##  eofeoln.c fprintreal.c input2int.c inputint.c main.c openclose.c \
##  uexit.c usage.c version.c zround.c)
##$(proglib): $(lib_sources)
##	cd ../lib && $(MAKE)
##always:
##endif

Makefile: Makefile.in ../config.status
	cd .. && $(SHELL) config.status

# tkpathsea.make -- target for remaking kpathsea.
makeargs = $(MFLAGS) CC='$(CC)' CFLAGS='$(CFLAGS)' $(XMAKEARGS)

# This is wrong: the library doesn't depend on kpsewhich.c or
# acconfig.h.  But what to do?
$(kpathsea): $(kpathsea_srcdir)/*.c $(kpathsea_srcdir)/*.h \
	     $(kpathsea_srcdir)/texmf-in.cnf $(top_srcdir)/../make/paths.make
	cd $(kpathsea_dir) && $(MAKE) $(makeargs)
# End of tkpathsea.make.
# clean.make -- cleaning.
mostlyclean::
	rm -f *.o

clean:: mostlyclean
	rm -f $(program) $(programs) squeeze lib$(library).* $(library).a *.bad
	rm -f *.dvi *.lj

distclean:: clean
	rm -f Makefile
	rm -f config.status config.log config.cache c-auto.h 

# Although we can remake configure and c-auto.h-in, we don't remove
# them, since many people may lack Autoconf.  Use configclean for that.
maintainer-clean:: distclean
	rm -f *.info*

extraclean::
	rm -f *.aux *.bak *.bbl *.blg *.dvi *.log *.pl *.tfm *.vf *.vpl *gf *pk
	rm -f *.mpx *.i *.s *~ *.orig  *.rej *\#*
	rm -f CONTENTS.tex a.out core mfput.* texput.* mpout.*

configclean:
	rm -f configure c-auto.h-in c-auto.h
# End of clean.make.

clean::
	rm -f y_tab.c y_tab.h y.out yacc.* $(LEX_OUTPUT_ROOT).c

# rdepend.make -- rules for remaking the dependencies.
# 
# Have to use -M, not -MM, since we use <kpathsea/...> instead of
# "kpathsea/..." in the sources.  But that means we have to remove the
# directory prefixes and all the system include files.
# And <kpathsea/paths.h> is generated, not part of the distribution.
# 
# And, there's no need for any installer/user to ever run this, it can
# only cause trouble. So comment it out in the distribution.
# (It doesn't work when the source and build directories are different.)
##ifndef c_auto_h_dir
##c_auto_h_dir = .
##endif
##ifdef HOSTNAME
##depend depend.make:: $(c_auto_h_dir)/c-auto.h \
##  $(top_srcdir)/../make/rdepend.make 
##	$(CC) -M $(ALL_CPPFLAGS) -I$(c_auto_h_dir) *.c \
##	  | sed -e 's,\(\.\./\)\+kpathsea/,$$(kpathsea_srcdir)/,g' \
##	        -e 's,$$(kpathsea_srcdir)/paths.h,$$(kpathsea_dir)/paths.h,g' \
##	        -e 's,/usr[^ ]* ,,g' \
##	        -e 's,/usr[^ ]*$$,,g' \
##	        -e 's,dvi2xx.o,dvilj.o dvilj2p.o dvilj4.o dvilj4l.o,' \
##	  | grep -v '^ *\\$$' \
##	  >depend.make
### If kpathsea, we're making .lo library objects instead of .o's.
##	pwd | grep -v kpathsea >/dev/null \
##	  || (sed -e 's/\.o:/.lo:/' -e 's/kpsewhich.lo:/kpsewhich.o:/' \
##	      <depend.make >depend-tmp.make; mv depend-tmp.make depend.make)
##.PHONY: depend
##endif

# Let's stick a rule for TAGS here, just in case someone wants them.
# (We don't put them in the distributions, to keep them smaller.)
TAGS: *.c *.h
	pwd | grep kpathsea >/dev/null && append=../kpathsea/TAGS; \
	  etags $$append *.[ch]
	

# Prevent GNU make 3.[59,63) from overflowing arg limit on system V.
.NOEXPORT:

# End of rdepend.make.
fixwrites.o: fixwrites.c ../config.h ../../kpathsea/config.h \
 ../c-auto.h ../../kpathsea/c-std.h \
 ../../kpathsea/c-unistd.h ../../kpathsea/systypes.h \
 ../../kpathsea/c-memstr.h \
 ../../kpathsea/c-errno.h \
 ../../kpathsea/c-minmax.h \
 ../../kpathsea/c-limits.h \
 ../../kpathsea/c-proto.h ../../kpathsea/debug.h \
 ../../kpathsea/types.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/c-fopen.h ../../kpathsea/c-pathmx.h
$(LEX_OUTPUT_ROOT).o: $(LEX_OUTPUT_ROOT).c \
 web2c.h ../config.h ../../kpathsea/config.h ../c-auto.h \
 ../../kpathsea/c-std.h \
 ../../kpathsea/c-unistd.h ../../kpathsea/systypes.h \
 ../../kpathsea/c-memstr.h \
 ../../kpathsea/c-errno.h \
 ../../kpathsea/c-minmax.h \
 ../../kpathsea/c-limits.h \
 ../../kpathsea/c-proto.h ../../kpathsea/debug.h \
 ../../kpathsea/types.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/c-fopen.h y_tab.h
main.o: main.c web2c.h ../config.h ../../kpathsea/config.h ../c-auto.h \
 ../../kpathsea/c-std.h \
 ../../kpathsea/c-unistd.h ../../kpathsea/systypes.h \
 ../../kpathsea/c-memstr.h \
 ../../kpathsea/c-errno.h \
 ../../kpathsea/c-minmax.h \
 ../../kpathsea/c-limits.h \
 ../../kpathsea/c-proto.h ../../kpathsea/debug.h \
 ../../kpathsea/types.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/c-fopen.h y_tab.h
regfix.o: regfix.c ../config.h ../../kpathsea/config.h ../c-auto.h \
 ../../kpathsea/c-std.h \
 ../../kpathsea/c-unistd.h ../../kpathsea/systypes.h \
 ../../kpathsea/c-memstr.h \
 ../../kpathsea/c-errno.h \
 ../../kpathsea/c-minmax.h \
 ../../kpathsea/c-limits.h \
 ../../kpathsea/c-proto.h ../../kpathsea/debug.h \
 ../../kpathsea/types.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/c-fopen.h
splitup.o: splitup.c ../config.h ../../kpathsea/config.h ../c-auto.h \
 ../../kpathsea/c-std.h \
 ../../kpathsea/c-unistd.h ../../kpathsea/systypes.h \
 ../../kpathsea/c-memstr.h \
 ../../kpathsea/c-errno.h \
 ../../kpathsea/c-minmax.h \
 ../../kpathsea/c-limits.h \
 ../../kpathsea/c-proto.h ../../kpathsea/debug.h \
 ../../kpathsea/types.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/c-fopen.h
y_tab.o: y_tab.c web2c.h ../config.h ../../kpathsea/config.h \
 ../c-auto.h ../../kpathsea/c-std.h \
 ../../kpathsea/c-unistd.h ../../kpathsea/systypes.h \
 ../../kpathsea/c-memstr.h \
 ../../kpathsea/c-errno.h \
 ../../kpathsea/c-minmax.h \
 ../../kpathsea/c-limits.h \
 ../../kpathsea/c-proto.h ../../kpathsea/debug.h \
 ../../kpathsea/types.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/c-fopen.h
