thisconfigdir=.
myfulldir=util/et
mydir=.
BUILDTOP=$(REL)$(U)$(S)$(U)
RELDIR=../util/et
SED = sed

##DOS##BUILDTOP = ..\..
##DOS##LIBNAME=$(OUTPRE)comerr.lib
##DOS##XTRA=
##DOS##OBJFILE=$(OUTPRE)comerr.lst

STLIBOBJS=error_message.o et_name.o init_et.o com_err.o
STOBJLISTS=OBJS.ST
LIB=com_err
LIBMAJOR=3
LIBMINOR=0

all-unix:: all-liblinks
clean-unix:: clean-liblinks clean-libs clean-libobjs
install-unix:: install-libs

LINTFLAGS=-uhvb 
LINTFILES= error_message.c et_name.c init_et.c com_err.c
LIBOBJS=$(OUTPRE)com_err.$(OBJEXT) \
	$(OUTPRE)error_message.$(OBJEXT) \
	$(OUTPRE)et_name.$(OBJEXT) \
	$(OUTPRE)init_et.$(OBJEXT)
# for et_lex.lex.c include in error_table.y
LOCALINCLUDES=-I. -I$(srcdir)

FILES=	Makefile et_name.c error_message.c compile_et.c \
		et_lex.lex.l error_table.y init_et.c \
		com_err.c com_err.h \
		error_table.h mit-sipb-copyright.h \
		test_et.c test1.et test2.et \
		compiler.h internal.h \
		com_err.texinfo texinfo.tex
#SRCS=	compile_et.c error_table.c error_message.c et_name.c \
#	init_et.c com_err.c
SRCS= $(srcdir)/error_message.c \
	$(srcdir)/et_name.c \
	$(srcdir)/init_et.c \
	$(srcdir)/com_err.c

#
# Warning flags
#
# Uncomment WFLAGS if you want really anal GCC warning messages
#
#
WFLAGS=		-ansi -D_POSIX_SOURCE -pedantic \
			-Wall -Wwrite-strings -Wpointer-arith \
			-Wcast-qual -Wcast-align -Wtraditional \
			-Wstrict-prototypes -Wmissing-prototypes \
			-Wnested-externs -Winline -DNO_INLINE_FUNCS -Wshadow 

DEPLIBS=
SHLIB_LIBS=
SHLIB_LDFLAGS= $(LDFLAGS) @SHLIB_RPATH_DIRS@	
SHLIB_LIBDIRS= @SHLIB_LIBDIRS@

COM_ERR_HDR=$(BUILDTOP)$(S)include$(S)com_err.h

all-windows:: $(COM_ERR_HDR)

$(COM_ERR_HDR): com_err.h
	$(CP) com_err.h $@

error_table.c: et_lex.lex.c 
error_table.c: $(srcdir)/error_table.y

error_table.o: error_table.c et_lex.lex.c
	$(CC) $(ALL_CFLAGS) -c error_table.c

com_err.o : com_err.c

et_lex.lex.o: et_lex.lex.c
test1.o: test1.c
test2.o: test2.c
test_et.o: test1.h test2.h

test_et: test_et.o test1.o test2.o $(LIBOBJS)
	$(CC) -o test_et test_et.o test1.o test2.o $(LIBOBJS)

all-unix:: compile_et includes

includes:: com_err.h
	if cmp $(srcdir)/com_err.h \
	$(BUILDTOP)/include/com_err.h >/dev/null 2>&1; then :; \
	else \
		(set -x; $(RM) $(BUILDTOP)/include/com_err.h; \
		 $(CP) $(srcdir)/com_err.h \
			$(BUILDTOP)/include/com_err.h) ; \
	fi

clean-unix::
	$(RM) $(BUILDTOP)/include/com_err.h

# The real compile_et just isn't portable.  (But then again, anything using 
# lex and yacc isn't portable by definition.  :-(  )
#
#compile_et: compile_et.o error_table.o
#	$(CC) $(CFLAGS) -o $@ compile_et.o error_table.o $(LEXLIB) $(BSDLIB)
#
#install::
#	$(INSTALLPROG) compile_et $(DESTDIR)$(PROGDIR)/compile_et

compile_et: $(srcdir)/compile_et.sh $(srcdir)/config_script
	$(SHELL) $(srcdir)/config_script $(srcdir)/compile_et.sh \
		$(AWK) $(SED) > compile_et
	chmod 755 compile_et	

et_c.awk: $(srcdir)/et_c.awk
	$(CP) $(srcdir)/et_c.awk et_c.awk
et_h.awk: $(srcdir)/et_h.awk
	$(CP) $(srcdir)/et_h.awk et_h.awk

clean-unix::
	$(RM) compile_et

depend:: 

install:: com_err.h 
	$(INSTALL_DATA) $(srcdir)/com_err.h  $(DESTDIR)$(KRB5_INCDIR)/com_err.h

install:: mit-sipb-copyright.h
	$(INSTALL_DATA) $(srcdir)/mit-sipb-copyright.h $(DESTDIR)$(KRB5_INCDIR)/mit-sipb-copyright.h

#
#install:: compile_et.1
#	$(INSTALL_DATA) $(srcdir)/compile_et.1 $(DESTDIR)$(CLIENT_MANDIR)/compile_et.1
#

## install_library_target(com_err,$(LIBOBJS),$(LINTFILES),)

clean-unix:: clean-files

clean-files::
	rm -f *~ \#* *.bak \
		*.otl *.aux *.toc *.PS *.dvi *.x9700 *.ps \
		*.cp *.fn *.ky *.log *.pg *.tp *.vr \
		*.o profiled/?*.o libcom_err.a libcom_err_p.a \
		com_err.o compile_et \
		et.ar TAGS y.tab.c lex.yy.c error_table.c \
		et_lex.lex.c \
		test1.h test1.c test2.h test2.c test_et \
		eddep makedep *.ln

clean-windows::
	$(RM) $(COM_ERR_HDR)

com_err.ps : com_err.dvi
com_err.dvi: com_err.texinfo

libcom_err.o:	$(LIBOBJS)
	ld -r -s -o libcom_err.o $(LIBOBJS)
	chmod -x libcom_err.o

archive:	et.tar

TAGS:	et_name.c error_message.c compile_et.c error_table.c \
		lex.yy.c init_et.c
	etags et_name.c error_message.c compile_et.c \
		error_table.c init_et.c

depend::  et_lex.lex.c

