# Generated automatically from Makefile.os2 by configure.
# Makefile for TeX to C conversion programs.

O = .obj
A = .lib
X = .exe
S = .dll

xlibs = web2c.def

SHELL = /bin/sh
srcdir = .
VPATH = .

# This is so kpathsea will get remade automatically if you change
# something in it and recompile from the package directory.
kpathsea_parent = ../..
kpathsea_dir = $(kpathsea_parent)/kpathsea
kpathsea = $(kpathsea_dir)/kpathsea$A

# Routines used everywhere.
commono = ../lib/lib$A $(kpathsea)

CC = gcc
CFLAGS = -g
CPPFLAGS = -I$(srcdir)/../lib -I../..

LEX = flex
LEXLIB = -lfl
LEX_OUTPUT_ROOT = lex.yy
YACC = bison -y

CCLD = $(CC)
LDFLAGS = $(CFLAGS) $(XLDFLAGS)
LIBS =  $(extralibs)
libs = $(commono) $(LIBS) $(xlibs)

program = web2c fixwrites splitup regfix

.SUFFIXES:
.SUFFIXES: $O .c
.c$O:
	$(CC) $(CPPFLAGS) $(CFLAGS) -c $*.c


all: $(program)

web2c: web2c$O y.tab$O $(LEX_OUTPUT_ROOT)$O
	$(CCLD) -o web2c $(LDFLAGS) web2c$O y.tab$O $(LEX_OUTPUT_ROOT)$O \
	  $(LEXLIB) $(libs) 

web2c$O: web2c.c y.tab.h

$(LEX_OUTPUT_ROOT)$O: $(LEX_OUTPUT_ROOT).c y.tab.h
$(LEX_OUTPUT_ROOT).c: web2c.lex
	$(LEX) web2c.lex

y.tab$O: y.tab.c
y.tab.c y.tab.h: web2c.yacc
	@echo Expect one shift/reduce conflict.
	$(YACC) -d -v web2c.yacc

fixwrites: fixwrites$O
	$(CCLD) -o fixwrites $(LDFLAGS) fixwrites$O $(libs)

splitup: splitup$O
	$(CCLD) -o splitup $(LDFLAGS) splitup$O $(libs)

regfix: regfix$O
	$(CCLD) -o regfix $(LDFLAGS) regfix$O $(libs)


Makefile: Makefile.os2 ../config.status
	(cd ..; $(SH) config.status)


install install-exec install-data:

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


mostlyclean::
	-rm -f *$O *$X $(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:

clean::
	-rm -f y.tab.c y.tab.h y.output yacc.* $(LEX_OUTPUT_ROOT).c
