# This file makes the web2c library routines.

SHELL = /bin/sh
srcdir = @srcdir@
VPATH = @srcdir@

# Unlike all other directories, we need @DEFS@ here because we need
# -DHAVE_CONFIG_H to compile getopt.
CC = @CC@
CFLAGS = -g
CPPFLAGS = @DEFS@ -I../lib -I../..

AR = ar
ARFLAGS = cq
RANLIB = @RANLIB@

# Name of the file we make.
lib = lib.a

# We don't make `openinout.o' or `texmf.o', since TeX and Metafont need
# to use different routine names, hence they need different .o files.
objs = alloca.o eofeoln.o fprintreal.o getopt.o getopt1.o inputint.o \
       main.o ourpaths.o strpascal.o uexit.o version.o xfopen-pas.o zround.o


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

default: all
triptrap: all

all: $(lib)

$(lib): $(objs)
	rm -f $(lib)
	$(AR) $(ARFLAGS) $(lib) $(objs)
	$(RANLIB) $(lib)

# Do not use CPPFLAGS for this, because including "config.h" might
# result in a conflicting decl of xmalloc. How annoying.
alloca.o: alloca.c 
	$(CC) $(CFLAGS) -c alloca.c

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

install install-exec install-data:

$(srcdir)/../lib/c-auto.h.in: $(srcdir)/../lib/c-auto.h.start \
                              $(configure_in) $(autoheader) 
	rm -f $(srcdir)/../lib/c-auto.h.in
	cd $(srcdir)/../lib; cp c-auto.h.start c-auto.h.in
	echo '/* Below here generated by autoheader.  */' \
	  >>$(srcdir)/../lib/c-auto.h.in
	@echo 'GLUERATIO_TYPE will not be covered.'
	-cd $(srcdir)/..; autoheader configure.in >>lib/c-auto.h.in

c-auto.h: $(srcdir)/../lib/c-auto.h.in
	cd ..; $(SHELL) config.status

TAGS: *.c *.h
	etags -t *.c *.h


mostlyclean::
	rm -f *.o $(program) $(lib) $(programs)

clean:: mostlyclean
	rm -f *.dvi *.pool

distclean:: clean
	rm -f Makefile config.status 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.
realclean:: distclean
	rm -f TAGS *.info*

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

configclean:
	rm -f configure c-auto.h.in c-auto.h


# Prevent GNU make 3 from overflowing arg limit on system V.
.NOEXPORT:

# Dependencies.
eofeoln.o: eofeoln.c config.h getopt.h ourpaths.h c-auto.h
fprintreal.o: fprintreal.c config.h getopt.h ourpaths.h c-auto.h
getopt.o: getopt.c config.h getopt.h ourpaths.h c-auto.h
getopt1.o: getopt1.c config.h getopt.h ourpaths.h c-auto.h
inputint.o: inputint.c config.h getopt.h ourpaths.h c-auto.h
main.o: main.c config.h getopt.h ourpaths.h c-auto.h
ourpaths.o: ourpaths.c config.h getopt.h ourpaths.h \
  ../../kpathsea/paths.h c-auto.h 
strpascal.o: strpascal.c config.h getopt.h ourpaths.h c-auto.h
uexit.o: uexit.c config.h getopt.h ourpaths.h c-auto.h
xfopen-pas.o: xfopen-pas.c config.h getopt.h ourpaths.h c-auto.h
zround.o: zround.c config.h getopt.h ourpaths.h c-auto.h
