# Makefile for error-table routines
#
# @configure_input@
# 
# Copyright (c) 1996-2000 Carnegie Mellon University.  All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer. 
#
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
#
# 3. The name "Carnegie Mellon University" must not be used to
#    endorse or promote products derived from this software without
#    prior written permission. For permission or any other legal
#    details, please contact  
#      Office of Technology Transfer
#      Carnegie Mellon University
#      5000 Forbes Avenue
#      Pittsburgh, PA  15213-3890
#      (412) 268-4387, fax: (412) 268-7395
#      tech-transfer@andrew.cmu.edu
#
# 4. Redistributions of any form whatsoever must retain the following
#    acknowledgment:
#    "This product includes software developed by Computing Services
#     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
#
# CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
# THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
# FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
# AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
# OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
srcdir = @srcdir@
VPATH = @srcdir@

CC = @CC@
INSTALL = @INSTALL@
RANLIB = @RANLIB@
ARCHIVE = ar cr

AWK = @AWK@
SED = sed

DEFS = @DEFS@
CPPFLAGS = @CPPFLAGS@
LIBS = @LIBS@

CFLAGS = @CFLAGS@ @BI_RC_CFLAGS@
LDFLAGS = @LDFLAGS@

SHELL = /bin/sh

LIBOBJS= error_message.o et_name.o init_et.o com_err.o
# for et_lex.lex.c include in error_table.y
LOCALINCLUDE=-I. -I.. -I$(srcdir)

all: compile_et libcom_err.a

install:

.c.o:
	$(CC) -c $(CPPFLAGS) $(DEFS) -I$(srcdir) -I$(srcdir)/../lib -I. -I.. $(CFLAGS) $<

# solaris make loses on com_err.c but not on init_et.c, but this helps
com_err.o: com_err.c

#
# real entries...
#

compile_et: $(srcdir)/compile_et.sh $(srcdir)/config_script
	$(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:
	rm -f compile_et compile_et.o error_table.o 
	rm -f libcom_err.a
	rm -f $(LIBOBJS)

distclean: clean
	rm -f compile_et compile_et.o error_table.o 
	rm -f libcom_err.a
	rm -f $(LIBOBJS)
	rm Makefile

depend: compile_et 

#install:: com_err.h 
#	$(INSTALLFILE) $(srcdir)/com_err.h  $(DESTDIR)$(INCLDIR)/com_err.h
#
#install:: mit-sipb-copyright.h
#	$(INSTALLFILE) $(srcdir)/mit-sipb-copyright.h $(DESTDIR)$(INCLDIR)/mit-sipb-copyright.h
#
#install:: com_err.3
#	$(INSTALLFILE) $(srcdir)/com_err.3 $(DESTDIR)$(MANDIR)/man3/com_err.3
#
#install:: compile_et.1
#	$(INSTALLFILE) $(srcdir)/compile_et.1 $(DESTDIR)$(MANDIR)/man1/compile_et.1


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

libcom_err.a: $(LIBOBJS)
	rm -f libcom_err.a
	$(ARCHIVE) $@ $(LIBOBJS)
	$(RANLIB) $@

#install::
#	$(INSTALLLIB) libcom_err.a $(DESTDIR)$(LIBDIR)/libcom_err.a
#	$(CHMOD) 644 $(DESTDIR)$(LIBDIR)/libcom_err.a
#	$(RANLIB)    $(DESTDIR)$(LIBDIR)/libcom_err.a
#	$(CHMOD) 444 $(DESTDIR)$(LIBDIR)/libcom_err.a
## 

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

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

