# $Source: /hpux/shared/supp//usr/src/cmd/text/./neqn.d/makefile,v $
# $Revision: 74.1 $

# Common makefile for neqn (text subsystem)

PFLAGS  = -DNEQN -Aa -D_HPUX_SOURCE
YFLAGS  = -d
FINDMSG	= /usr/bin/findmsg
GENCAT	= /usr/bin/gencat
LIBS	= -ly
OFILES  = diacrit.o eqnbox.o font.o fromto.o funny.o glob.o integral.o \
	  io.o lex.o lookup.o mark.o matrix.o move.o over.o paren.o \
	  pile.o shift.o size.o sqrt.o text.o hpux_rel.o
CFILES  = diacrit.c eqnbox.c font.c fromto.c funny.c glob.c integral.c \
	  io.c lex.c lookup.c mark.c matrix.c move.c over.c paren.c \
	  pile.c shift.c size.c sqrt.c text.c hpux_rel.c
MSGSRC	= funny.c io.c lex.c lookup.c sqrt.c text.c e.y

default: all

all:    neqn neqn.cat

metrics: neqn.M

neqn:   e.o $(OFILES)
	$(CC) $(LDFLAGS) -o neqn $(OFILES) e.o $(LIBS)

neqn.M:   e.c $(CFILES)
	$(METRICS) $(CFLAGS) $(PFLAGS) -o neqn.M $(CFILES) e.c $(LIBS)

$(OFILES): e.h e.def

e.def:    y.tab.h
	  -cmp -s y.tab.h e.def || cp y.tab.h e.def

y.tab.h:  e.o

neqn.cat: $(MSGSRC)
	for i in $(MSGSRC); do \
		$(FINDMSG) $$i >neqn.msg;\
		$(GENCAT) $@ neqn.msg;\
	done

clean:
	/usr/bin/rm -f *.o y.tab.[ch] e.def neqn.msg

clobber:  clean
	/usr/bin/rm -f neqn neqn.cat

# Redefine the .c to .o rule as to include PFLAGS
.c.o:
	$(CC) $(CFLAGS) $(PFLAGS) -c $<
